torch.save(model1.state_dict(), model_save_dir + 'model1_epoch_%d.pth' % (epoch + 1)) code example
Example: how to save a neural network pytorch
Saving:
torch.save(model, PATH)
Loading:
model = torch.load(PATH)
model.eval()
Saving:
torch.save(model, PATH)
Loading:
model = torch.load(PATH)
model.eval()