Saving & Loading Model for Inference
Save/Load state_dict
(Recommended)
Save:
torch.save(model.state_dict(), PATH)
Load:
model = TheModelClass(*args, **kwargs) model.load_state_dict(torch.load(PATH)) model.eval()
REF
https://pytorch.org/tutorials/beginner/saving_loading_models.html