Can I use torch.save() and torch.load to keep training my model?

Well, I saved my model with torch.save(). And I can also test this model by using torch.load(). However, I just wanna ask, can I keep training this model?Because when I did this, the code was “stopped”… I mean it still running, but it looks like the code was stocking there.

By the way, I am using Adam method…Do I need to save the optimizer too?

Have a look at the ImageNet example to see, how to store all necessary information in order to be able to continue the training.
Also, I would recommend to save and load the state_dict instead of the complete model.

1 Like

Thank you so much for telling me those. Well, I used state_dict to save the model in the previous version.

Anyway, so it is possible to keep train the model which saved by torch.save() function?

you should check this out saving_loading_models

Pytorch docs are just too good :slight_smile: