Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork399
-
By default, the best model and the last model are saved by catalyst as checkpoints. For example, I have the following files in thecheckpoints folder: I then use the following code to read the checkpoint. checkpoint=utils.load_checkpoint(path=os.path.join(model_dir,'model.best.pth'))checkpoint.keys()# the output is: odict_keys(['model.0.weight', 'model.0.bias', 'model.2.weight', 'model.2.bias', 'model.4.weight', 'model.4.bias']) The obtained Now the question is how I can restore the network model with Is there any method in |
BetaWas this translation helpful?Give feedback.
All reactions
Sorry for my ignorance..
In the model-only saving mode, themodel.*.pth file contains exactly thestate_dict of a model in pytorch. Supposing we have defined ourmodel, simply do it like this to restore the trained model:
model.load_state_dict(torch.load(os.path.join(model_dir,'model.best.pth'))
Replies: 1 comment
-
Sorry for my ignorance.. In the model-only saving mode, the model.load_state_dict(torch.load(os.path.join(model_dir,'model.best.pth')) |
BetaWas this translation helpful?Give feedback.