My model contains LSTM. when i use only one layer of lstm it works fine with saving and loading model state dictionary. but when I do num_layers=2 in lstm it runs well but giving error while loading the saved state dictionary. the error trace is
KeyError                                  Traceback (most recent call last)
 in ()
133 #n_samples = len(traindata)
134 model = MySiamese3(hdim)
–> 135 model.load_state_dict(torch.load(‘TrainedModels/projectmodelmultilayers20news27.pth’))
136 model.cuda()
137 print “para2vec model loaded”
/home/vaijenath/anaconda2/lib/python2.7/site-packages/torch/nn/modules/module.pyc in load_state_dict(self, state_dict, strict)
488             elif strict:
489                 raise KeyError(‘unexpected key “{}” in state_dict’
–> 490                                .format(name))
491         if strict:
492             missing = set(own_state.keys()) - set(state_dict.keys())
KeyError: ‘unexpected key “lstm1.weight_ih_l1” in state_dict’