Home [PyTorch] Model Save & Load
Post
Cancel

[PyTorch] Model Save & Load

모델 저장 및 로드

  • torch.save : net.state_dict()를 저장
  • torch.load : load_state_dict로 모델을 로드
1
2
PATH = '저장할 경로'
torch.save(net.state_dict(), PATH)
1
2
net = NeuralNet()
net.load_state_dict(torch.load(PATH))
This post is licensed under CC BY 4.0 by the author.