Skip to content
Snippets Groups Projects
Commit b4c87a7f authored by Jan Ebert's avatar Jan Ebert
Browse files

Include singular loading function

Just for the sake of completeness.
parent c0bff5b5
No related branches found
No related tags found
No related merge requests found
......@@ -129,6 +129,15 @@ def save_model(model, save_dir):
)
def load_model_singular(model, *args, **kwargs):
"""Pass all other given arguments to `torch.load` and load the
resulting state dict into the given model.
"""
state_dict = torch.load(*args, **kwargs)
model.load_state_dict(state_dict)
return model
def load_model(model, load_dir):
"""Set the given model's state dictionary in-place from the given
distributed checkpoint directory.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment