OpenNMT Forum

AttributeError: Can't get attribute 'TextDataset'

Hi, I am a user of OpenNMT-py.
I recently merged the updated git codes and encountered an attribute error, as written below. (Before, I had no problem using it)

Traceback (most recent call last):
File “”, line 120, in
File “”, line 51, in main
single_main(opt, 0)
File “/PATH/OpenNMT-py/onmt/”, line 160, in main
File “/PATH/OpenNMT-py/onmt/”, line 189, in train
File “/PATH/OpenNMT-py/onmt/”, line 124, in _accum_batches
for batch in iterator:
File “/PATH/OpenNMT-py/onmt/inputters/”, line 561, in iter
for batch in self._iter_dataset(path):
File “/PATH/OpenNMT-py/onmt/inputters/”, line 531, in _iter_dataset
cur_dataset = torch.load(path)
File “/PATH’/.conda/envs/NAME/lib/python3.7/site-packages/torch/”, line 367, in load
return _load(f, map_location, pickle_module)
File “/PATH’/.conda/envs/NAME/lib/python3.7/site-packages/torch/”, line 538, in _load
result = unpickler.load()
AttributeError: Can’t get attribute ‘TextDataset’ on <module ‘onmt.inputters.text_dataset’ from ‘/PATH/OpenNMT-py/onmt/inputters/’>

I am very confused, since I did not change anything from the code.
Also, when I search for ‘TextDataset’, I found only [docs/source/] contains it.
Is this something to do with the .rst file?

I would appreciate any help from you.
P.S. I’m using pytorch 1.0.0 and torchtext 0.4.0.

you need to re preprocess your data.

we’ve mentioned this in the last release.