1

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 "train.py", line 12, in <module>
    from data_manager import *
  File "/data1/lijun/cross_modal_reid_bigma/transformer/data_manager.py", line 7, in <module>
    from util.data_loader import DataLoader
  File "/data1/lijun/cross_modal_reid_bigma/transformer/util/data_loader.py", line 6, in <module>
    from torchtext.legacy.data import Field, BucketIterator
  File "/usr/local/anaconda3/lib/python3.6/site-packages/torchtext/__init__.py", line 3, in <module>
    from . import datasets
  File "/usr/local/anaconda3/lib/python3.6/site-packages/torchtext/datasets/__init__.py", line 2, in <module>
    from .ag_news import AG_NEWS
  File "/usr/local/anaconda3/lib/python3.6/site-packages/torchtext/datasets/ag_news.py", line 2, in <module>
    from torchtext.data.datasets_utils import _RawTextIterableDataset
  File "/usr/local/anaconda3/lib/python3.6/site-packages/torchtext/data/datasets_utils.py", line 205, in <module>
    class _RawTextIterableDataset(torch.utils.data.IterableDataset):
AttributeError: module 'torch.utils' has no attribute 'data'

2 Answers 2

1


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

Sign up to request clarification or add additional context in comments.

1 Comment

I see, so there's literally no way to solve the problem with 1.1.x torch?
1

When use Pytorch 1.1, You can simply solve this problem by add this import:

import torch.utils.data

And Pytorch 1.7+ has this bug fixed.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.