How to save/load weights in Pytorch?
How can I save and load the pre-trained weights for a model of classification in Pytorch 1.6?
How can I save and load the pre-trained weights for a model of classification in Pytorch 1.6?
If you have already designed your model, then you can save and load your weights in the following way.
model = MyNet()
...
torch.save(model.state_dict(), 'weights/model_{}'.format(epoch))
...
model.load_state_dict(torch.load('weights/model_10'))