You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "translate.py", line 42, in module
main(opt)
File "translate.py", line 27, in main
attn_debug=opt.attn_debug
File "/home/txr/OpenNMT-py-ende/onmt/translate/translator.py", line 208, in translate
for batch in data_iter:
File "/home/txr/anaconda3/envs/python3/lib/python3.5/site-packages/torchtext/data/iterator.py", line 157, in iter
yield Batch(minibatch, self.dataset, self.device)
File "/home/txr/anaconda3/envs/python3/lib/python3.5/site-packages/torchtext/data/batch.py", line 26, in init
self.input_fields = [k for k, v in dataset.fields.items() if
File "/home/txr/anaconda3/envs/python3/lib/python3.5/site-packages/torchtext/data/batch.py", line 27, in
v is not None and not v.is_target]
AttributeError: 'TextMultiField' object has no attribute 'is_target'
The text was updated successfully, but these errors were encountered:
This bug has been fixed in master recently, and your code will work if you install torchtext from source. RawField, which TextMultiField inherits from, was missing the is_target attribute.
Just for everyone running on the currently latest version on pip, version 0.3.1, and won't or can't install from source here is a simple work around for the issue:
Traceback (most recent call last):
File "translate.py", line 42, in module
main(opt)
File "translate.py", line 27, in main
attn_debug=opt.attn_debug
File "/home/txr/OpenNMT-py-ende/onmt/translate/translator.py", line 208, in translate
for batch in data_iter:
File "/home/txr/anaconda3/envs/python3/lib/python3.5/site-packages/torchtext/data/iterator.py", line 157, in iter
yield Batch(minibatch, self.dataset, self.device)
File "/home/txr/anaconda3/envs/python3/lib/python3.5/site-packages/torchtext/data/batch.py", line 26, in init
self.input_fields = [k for k, v in dataset.fields.items() if
File "/home/txr/anaconda3/envs/python3/lib/python3.5/site-packages/torchtext/data/batch.py", line 27, in
v is not None and not v.is_target]
AttributeError: 'TextMultiField' object has no attribute 'is_target'
The text was updated successfully, but these errors were encountered: