OpenNMT-py: Assertion error: assert len(self) == len(inputs_)
Hi,
I have two data text files in which each word has a feature, I use the ‘│’ to annotate the word, so as to specify its cluster. The training process went well but something got wrong in the translation step:
python /disk/ocean/lhe/transliteration/nmt-py/OpenNMT-py/translate.py -src en_dev_2 cls.txt -model model_step_350.pt -output rrr.txt -verbose -replace_unk -gpu 1 Traceback (most recent call last): File "/disk/ocean/lhe/transliteration/nmt-py/OpenNMT-py/translate.py", line 36, in <module> main(opt) File "/disk/ocean/lhe/transliteration/nmt-py/OpenNMT-py/translate.py", line 24, in main attn_debug=opt.attn_debug) File "/disk/ocean/lhe/transliteration/nmt-py/OpenNMT-py/onmt/translate/translator.py", line 213, in translate batch_data = self.translate_batch(batch, data, fast=self.fast) File "/disk/ocean/lhe/transliteration/nmt-py/OpenNMT-py/onmt/translate/translator.py", line 314, in translate_batch return self._translate_batch(batch, data) File "/disk/ocean/lhe/transliteration/nmt-py/OpenNMT-py/onmt/translate/translator.py", line 559, in _translate_batch step=i) File "/disk/ocean/lhe/condaPytorch/envs/pytorch/lib/python2.7/site-packages/torch/nn/modules/module.py", line 491, in __call__ result = self.forward(*input, **kwargs) File "/disk/ocean/lhe/transliteration/nmt-py/OpenNMT-py/onmt/decoders/decoder.py", line 136, in forward tgt, memory_bank, state, memory_lengths=memory_lengths) File "/disk/ocean/lhe/transliteration/nmt-py/OpenNMT-py/onmt/decoders/decoder.py", line 314, in _run_forward_pass emb = self.embeddings(tgt) File "/disk/ocean/lhe/condaPytorch/envs/pytorch/lib/python2.7/site-packages/torch/nn/modules/module.py", line 491, in __call__ result = self.forward(*input, **kwargs) File "/disk/ocean/lhe/transliteration/nmt-py/OpenNMT-py/onmt/modules/embeddings.py", line 184, in forward emb = self.make_embedding(source) File "/disk/ocean/lhe/condaPytorch/envs/pytorch/lib/python2.7/site-packages/torch/nn/modules/module.py", line 491, in __call__ result = self.forward(*input, **kwargs) File "/disk/ocean/lhe/condaPytorch/envs/pytorch/lib/python2.7/site-packages/torch/nn/modules/container.py", line 91, in forward input = module(input) File "/disk/ocean/lhe/condaPytorch/envs/pytorch/lib/python2.7/site-packages/torch/nn/modules/module.py", line 491, in __call__ result = self.forward(*input, **kwargs) File "/disk/ocean/lhe/transliteration/nmt-py/OpenNMT-py/onmt/modules/util_class.py", line 42, in forward assert len(self) == len(inputs_) AssertionError
Please help me with that. Everything is fine for the original data without word features.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 19 (4 by maintainers)
The same error with
case_featureand last version:only source features. it’s on the README page.