Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save n0obcoder/1c2137b473e8d6623ca3660038db4ae9 to your computer and use it in GitHub Desktop.

Select an option

Save n0obcoder/1c2137b473e8d6623ca3660038db4ae9 to your computer and use it in GitHub Desktop.
# saving state_dict() of 'model'
torch.save(model.state_dict(), 'weights_only.pth')
# loading the state_dict
model_new = NeuralNet()
model_new.load_state_dict(torch.load('weights_only.pth'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment