You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a class method in Model Bundler to facilitate model creation with user-defined configuration and checkpoint (#1442)
Summary:
Import from github
Command used:
`python pytorch/import.py --project_name text --commit_ids 2040d8d`
Note that we still not importing the whole repo using import_text.sh. using import.py would be the worflow we would rely on till we merge [legacy code removal commit](2cebac3) into fbcode.
Reviewed By: Nayef211
Differential Revision: D32603181
fbshipit-source-id: 1f583e5ac96e693b583ae42d5841bf387cf3727a
head (nn.Module): A module to be attached to the encoder to perform specific task. If provided, it will replace the default member head (Default: ``None``)
87
+
load_weights (bool): Indicates whether or not to load weights if available. (Default: ``True``)
88
+
freeze_encoder (bool): Indicates whether or not to freeze the encoder weights. (Default: ``False``)
89
+
dl_kwargs (dictionary of keyword arguments): Passed to :func:`torch.hub.load_state_dict_from_url`. (Default: ``None``)
"""Class method to create model with user-defined encoder configuration and checkpoint
125
+
126
+
Args:
127
+
encoder_conf (RobertaEncoderConf): An instance of class RobertaEncoderConf that defined the encoder configuration
128
+
head (nn.Module): A module to be attached to the encoder to perform specific task. (Default: ``None``)
129
+
freeze_encoder (bool): Indicates whether to freeze the encoder weights. (Default: ``False``)
130
+
checkpoint (str or Dict[str, torch.Tensor]): Path to or actual model state_dict. state_dict can have partial weights i.e only for encoder. (Default: ``None``)
131
+
override_head (bool): Override the checkpoint's head state dict (if present) with provided head state dict. (Default: ``False``)
132
+
dl_kwargs (dictionary of keyword arguments): Passed to :func:`torch.hub.load_state_dict_from_url`. (Default: ``None``)
0 commit comments