langml.plm.albert
Module Contents
Functions
|
Load pretrained ALBERT |
- langml.plm.albert.load_albert(config_path: str, checkpoint_path: str, seq_len: Optional[int] = None, pretraining: bool = False, with_mlm: bool = True, with_nsp: bool = True, lazy_restore: bool = False, weight_prefix: Optional[str] = None, dropout_rate: float = 0.0, **kwargs) Union[Tuple[langml.tensor_typing.Models, Callable], Tuple[langml.tensor_typing.Models, Callable, Callable]][source]
Load pretrained ALBERT :param - config_path: str, path of albert config :param - checkpoint_path: str, path of albert checkpoint :param - seq_len: Optional[int], specify fixed input sequence length, default None :param - pretraining: bool, pretraining mode, default False :param - with_mlm: bool, whether to use mlm task in pretraining, default True :param - with_nsp: bool, whether to use nsp/sop task in pretraining, default True :param - lazy_restore: bool, whether to restore pretrained weights lazily, default False.
Set it as True for distributed training.
- Parameters
weight_prefix (-) –
- Optional[str], prefix name of weights, default None.
You can set a prefix name in unshared siamese networks.
dropout_rate: float, dropout rate, default 0.
- Returns
keras model - bert: bert instance - restore: conditionally, it will return when lazy_restore=True
- Return type
model