I’m new to PyTorch. I’m trying to follow a tutorial online but I’ve not been able to make progress since yesterday. I always get an error message when I try executing the code below on my laptop.
from torchtext.datasets import TranslationDataset
from torchtext.data import Field, BucketIterator
These are the type of error messages I get
ImportError: cannot import name 'TranslationDataset' from 'torchtext.datasets' (C:\ProgramData\Anaconda3\lib\site-packages\torchtext\datasets\__init__.py)
ImportError: cannot import name 'Field' from 'torchtext.data' (C:\ProgramData\Anaconda3\lib\site-packages\torchtext\data\__init__.py)
I read online that I should use torchtext.legacy instead. So when I tried the code below
from torchtext.legacy.data import Field, BucketIterator, Iterator
I got this error message
ModuleNotFoundError: No module named 'torchtext.legacy'
==============
Please can someone kindly assist me on how to get my error fixed. I’m using torchtext version ‘0.15.1’ and torch version ‘2.0.0+cpu’