[pyTorch] trained model save & load
model = MyModel()
# ... after training, save your model
model.save_state_dict('mytraining.pt')
# .. to load your previously training model:
model.load_state_dict(torch.load('mytraining.pt'))
model = MyModel()
# ... after training, save your model
model.save_state_dict('mytraining.pt')
# .. to load your previously training model:
model.load_state_dict(torch.load('mytraining.pt'))
torch.save(the_model, PATH)
답글삭제This is correct !
the_model = torch.load(PATH)
답글삭제