DeepSpeedExamples icon indicating copy to clipboard operation
DeepSpeedExamples copied to clipboard

AttributeError: '_MultiProcessingDataLoaderIter' object has no attribute 'next'

Open ranggihwang opened this issue 2 years ago • 1 comments

Bug report.

When executing python cifar10_tutorial.py, it shows AttributeError: '_MultiProcessingDataLoaderIter' object has no attribute 'next'.

One more thing is that. pip install -r requirements.txt it shows below ERROR: No matching distribution found for torchvision==0.4.0

My system version is same as below Python 3.8.13 Torch 1.13.0a0+d0d6b1f

ranggihwang avatar Nov 17 '22 08:11 ranggihwang

The code needs to be fixed. Change from:

images, labels = dataiter.next()

to:

images, labels = next(dataiter)

avolkov1 avatar Nov 23 '22 02:11 avolkov1

This works.

WillGoad avatar Jul 12 '23 10:07 WillGoad

In deep learning, data is usually processed in batches. The line images, labels = next(dataiter) is used to retrieve the next batch of data for processing. below also works if you have iter through_tain loader for batch_idx, (data, target) in enumerate(train_loader): metax, mask = next(metaloader)

The dataiter object is an iterator that has been initialized with a dataset, and next() is called on it to retrieve the next batch of data. The batch is divided into two variables: images and labels

VasuTammisetti avatar Oct 10 '23 11:10 VasuTammisetti