AttributeError: module 'torch.utils' has no attribute 'data'
I am trying to run my PyTorch code on a Ubuntu server, it works well on my own computer, but it failed to run on the server.
Is this because of something related to PyTorch version?
This problem seems typical but yet no solutions work.
Traceback (most recent call last):
  File &quot;train.py&quot;, line 12, in &lt;module&gt;
    from data_manager import *
  File &quot;/data1/lijun/cross_modal_reid_bigma/transformer/data_manager.py&quot;, line 7, in &lt;module&gt;
    from util.data_loader import DataLoader
  File &quot;/data1/lijun/cross_modal_reid_bigma/transformer/util/data_loader.py&quot;, line 6, in &lt;module&gt;
    from torchtext.legacy.data import Field, BucketIterator
  File &quot;/usr/local/anaconda3/lib/python3.6/site-packages/torchtext/__init__.py&quot;, line 3, in &lt;module&gt;
    from . import datasets
  File &quot;/usr/local/anaconda3/lib/python3.6/site-packages/torchtext/datasets/__init__.py&quot;, line 2, in &lt;module&gt;
    from .ag_news import AG_NEWS
  File &quot;/usr/local/anaconda3/lib/python3.6/site-packages/torchtext/datasets/ag_news.py&quot;, line 2, in &lt;module&gt;
    from torchtext.data.datasets_utils import _RawTextIterableDataset
  File &quot;/usr/local/anaconda3/lib/python3.6/site-packages/torchtext/data/datasets_utils.py&quot;, line 205, in &lt;module&gt;
    class _RawTextIterableDataset(torch.utils.data.IterableDataset):
AttributeError: module 'torch.utils' has no attribute 'data'



it worked for me...please make sure that you are using 1.7 + pytorch version
