我是 Pytorch 的新学习者,我正在研究 Character_Level_LSTM_Exercise。
为什么他们在模型名称中使用 .net 扩展名保存模型?
我正在寻找解释,但没有得到任何好的解释。
# change the name, for saving multiple files
model_name = 'rnn_x_epoch.net'
checkpoint = {'n_hidden': net.n_hidden,
'n_layers': net.n_layers,
'state_dict': net.state_dict(),
'tokens': net.chars}
with open(model_name, 'wb') as f:
torch.save(checkpoint, f)
您可以使用任何您喜欢的扩展名!只要确保一致。
文档建议使用 .pt 扩展名。
https://pytorch.org/docs/stable/generated/torch.save.html
有关更多解释和更多扩展选项,请参阅Soumith Chintala 的评论。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句