Error(s) in loading state_dict for TransformerModel:
Nimishasri opened this issue · 3 comments
Nimishasri commented
downloaded all the models (mm-all was commented out in scripts/download-and-setup-models.sh
).
Ran the test translation script as mentioned in the Readme.
Error(s) in loading state_dict for TransformerModel:
size mismatch for encoder.embed_tokens.weight: copying a param with shape torch.Size([28168, 512]) from checkpoint, the shape in current model is torch.Size([26346, 512]).
size mismatch for decoder.embed_out: copying a param with shape torch.Size([28160, 512]) from checkpoint, the shape in current model is torch.Size([26346, 512]).
size mismatch for decoder.embed_tokens.weight: copying a param with shape torch.Size([28160, 512]) from checkpoint, the shape in current model is torch.Size([26346, 512]).
jerinphilip commented
This is weird, it should work. Maybe some fairseq-padding option. Try to use the more recent ones.
"mm-all-iter0"
"mm-all-iter1"
"mm-to-en-iter1"
Nimishasri commented
Error on Gogle colab , invoking "mm-all-iter0"
| [src] dictionary: 40897 types
| [tgt] dictionary: 40897 types
/content/MyDrive/ColabNotebooks/ilmulti-master/ilmulti/translator/translator.py:23: UserWarning: utils.load_ensemble_for_inference is deprecated. Please use checkpoint_utils.load_model_ensemble instead.
self.models, model_args = fairseq.utils.load_ensemble_for_inference(model_paths, self.task, model_arg_overrides=eval(args.model_overrides))
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-8-cba9eb6f9aca> in <module>()
2 from ilmulti.translator import from_pretrained
3 translator = from_pretrained(tag='mm-all-iter0')
----> 4 sample = translator('I am going', tgt_lang = 'hi')
5 print(sample)
5 frames
/usr/local/lib/python3.6/dist-packages/fairseq/search.py in step(self, step, lprobs, scores)
79 out=(self.scores_buf, self.indices_buf),
80 )
---> 81 torch.div(self.indices_buf, vocab_size, out=self.beams_buf)
82 self.indices_buf.fmod_(vocab_size)
83 return self.scores_buf, self.indices_buf, self.beams_buf
RuntimeError: Integer division of tensors using div or / is no longer supported, and in a future release div will perform true division as in Python 3. Use true_divide or floor_divide (// in Python) instead.
jerinphilip commented
Check #1.
Why are you using colab? Switch the install to torch=1.0.0 at the start of the notebook, that should work. Before installing ilmulti <- fairseq-ilmt.