I was able to train the model on cnndm, but during decoding time the following error occurs:
[2019-09-16 10:54:58,479 INFO] Translating shard 0.
/data/user/anaconda3/envs/encoder-agnostic/lib/python3.5/site-packages/torchtext/data/field.py:359: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).
var = torch.tensor(arr, dtype=self.dtype, device=device)
Traceback (most recent call last):
File "translate.py", line 93, in <module>
main(opt)
File "translate.py", line 64, in main
tag_shard=tag_shard
File "/home/user/workspace/encoder-agnostic-adaptation/onmt/translate/translator.py", line 366, in translate
translations = xlation_builder.from_batch(batch_data)
File "/home/user/workspace/encoder-agnostic-adaptation/onmt/translate/translation.py", line 93, in from_batch
for n in range(self.n_best)]
File "/home/user/workspace/encoder-agnostic-adaptation/onmt/translate/translation.py", line 93, in <listcomp>
for n in range(self.n_best)]
File "/home/user/workspace/encoder-agnostic-adaptation/onmt/translate/translation.py", line 42, in _build_target_tokens
tokens.append(src_vocab.itos[tok - len(vocab)])
AttributeError: 'NoneType' object has no attribute 'itos'
It appears that in the constructor of TranslationBuilder, self._has_text_src is set to False because self.fields is actually a dict, so hasattr(self.fields, 'src') returns False. It should probably be "src" in self.fields?
Hi!
I was able to train the model on
cnndm
, but during decoding time the following error occurs:This is my decoding command:
It appears that in the constructor of
TranslationBuilder
,self._has_text_src
is set toFalse
becauseself.fields
is actually adict
, sohasattr(self.fields, 'src')
returnsFalse
. It should probably be"src" in self.fields
?