Open herleeyandi opened 7 years ago
Make sure your dataset is exactly the same, because lineToTensor
relies on the number and order of characters in all_characters
to create the input tensors. Another solution is to make that function and character list directly attached to the model.
Hi guys I am a newbie in pytorch. I find that pytorch has simple way to save our model. When practicing tutorial in RNN Classification, I found a problem to save the model. To save the model I do a simple way by execute
torch.save(rnn,'char-rnn-classification.pt')
, then as in thepredict.py
files, I load the model byrnn = torch.load('char-rnn-classification.pt')
. This mechanism should be save the entire model from network until the weights. However when I execute it, it successfully save the model file but when I predicting the input in testing phase I got this error. Anybody know how to save the model correctly?