Closed zhanhl316 closed 2 years ago
Is there any follow up to this? I'm trying too use from torchtext.legacy import data in my jupyter notebook problem and no matter what I do I get, ModuleNotFoundError: No module named 'torchtext.legacy'. I made sure the both torchtext and pytorch(1.11) are up to date.
Hi. Thanks for your interest.
I think the issue is with the torchtext's version, you can always stay with smaller version of torchtext like 0.8.0 and this could work. you might find this link (https://stackoverflow.com/questions/66854921/legacy-torchtext-0-9-0) helpful. Thanks,
torchtext.legacy is only for pytorch1.9+
for those who use lower version of pytorch (e.g. I use the pytorch1.6 + torchtext 0.6), you can revise the "train_ebr.py" script in the "fairseq" folders.
"from torchtext.legacy import data, datasets" --> "from torchtext import data, datasets" "from torchtext.legacy.vocab import Vocab" --> "from torchtext.vocab import Vocab"