I'm getting the following error when I try to run this line of code:
from torchtext.data import Field, TabularDataset, BucketIterator, Iterator
ImportError: cannot import name 'Field' from 'torchtext.data' (C:\Users\user1\anaconda3\lib\site-packages\torchtext\data\__init__.py)
I was wondering if anyone knows what the issue might be and how to resolve it?
torchtext.data
becomes torchtext.legacy.data
from torchtext.legacy.data import Field, TabularDataset, BucketIterator, Iterator
conda install -c pytorch torchtext==0.8
This worked for me on Ubuntu 18.04.
I come up with this when using colab, then I update the torchtext version by
pip install -U torchtext
and it works for me
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With