Fix Model.load fail if model_params is str
@@ -319,7 +319,7 @@ class Model(torch.nn.Module, Registrable):
"""
# Peak at the class of the model.
- model_type = config["model"]["type"]
+ model_type = config["model"] if isinstance(config["model"], str) else config["model"]["type"]
# Load using an overridable _load method.
# This allows subclasses of Model to override _load.
@@ -354,6 +354,7 @@ class Model(torch.nn.Module, Registrable):
model_path=model_path)
def remove_pretrained_embedding_params(params: Params):
+ if isinstance(params, Params): # The model could possible be a string, for example.
keys = params.keys()
if 'pretrained_file' in keys:
del params['pretrained_file']
