PyTorch 2 · Training and saving
Load a model
Create the model, then load the saved weights.
model = Net()
model.load_state_dict(torch.load("model.pt", weights_only=True))
model.eval()
Official PyTorch 2 documentation
PyTorch 2 · Training and saving
Create the model, then load the saved weights.
model = Net()
model.load_state_dict(torch.load("model.pt", weights_only=True))
model.eval()
Official PyTorch 2 documentation
Was this page helpful?