The model behaves normally during training, but during prediction, the weightdrop mechanism cannot be stopped and an error is reported:
Applying weight drop of 0.5 to weight_hh_l0
Applying weight drop of 0.5 to weight_hh_l0
Traceback (most recent call last):
File "D:\0730waid11\prediction.py", line 101, in
load_network.load_state_dict(torch.load(modelname, map_location=lambda storage, loc: storage))
File "C:\Users\admin.conda\envs\tf\lib\site-packages\torch\nn\modules\module.py", line 845, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for reverb:
Unexpected key(s) in state_dict: "rnn1.weight_hh_l0", "rnn2.weight_hh_l0", "wdrnn1.module.weight_hh_l0", "wdrnn2.module.weight_hh_l0".
hi,
I see the code you share at GitHub's address below(https://github.com/salesforce/awd-lstm-lm),and use your weight dropout technical code to train my LSTM model.
def init(self,input_dim,hidden1_dim,hidden2_dim, num_layers = 1,target = 're' ,biFlag = True):
The model behaves normally during training, but during prediction, the weightdrop mechanism cannot be stopped and an error is reported: Applying weight drop of 0.5 to weight_hh_l0 Applying weight drop of 0.5 to weight_hh_l0 Traceback (most recent call last):
File "D:\0730waid11\prediction.py", line 101, in
load_network.load_state_dict(torch.load(modelname, map_location=lambda storage, loc: storage))
File "C:\Users\admin.conda\envs\tf\lib\site-packages\torch\nn\modules\module.py", line 845, in load_state_dict self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for reverb: Unexpected key(s) in state_dict: "rnn1.weight_hh_l0", "rnn2.weight_hh_l0", "wdrnn1.module.weight_hh_l0", "wdrnn2.module.weight_hh_l0".
How should I deal with it? Thank you very much.