PyTorch 2 · Training and saving

Save a model

Save the weights, which is recommended over pickling the whole model.

torch.save(model.state_dict(), "model.pt")

Official PyTorch 2 documentation

More training and saving commands

All training and saving commands · PyTorch 2 cheatsheet

Was this page helpful?