PyTorch SAVING AND LOADING MODELS

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

 

上一篇:vue3封装全局loading


下一篇:[MOPT] 4. Loading Code at Runtime