BotCL icon indicating copy to clipboard operation
BotCL copied to clipboard

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

Open DavidCarlyn opened this issue 2 years ago • 0 comments

I get the following error when running python main_recon.py --num_classes 10 --num_cpt 20 --lr 0.001 --epoch 50 --lr_drop 30:

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

Pytorch versions: torch==2.0.1 and torchvision==0.15.2

Error happens in utils/engine_recon.py on line 80 and in vis_recon.py on line 37. I used the solution mentioned in https://stackoverflow.com/questions/74289077/attributeerror-multiprocessingdataloaderiter-object-has-no-attribute-next to fix it.

There may be other areas of the codebase that also use this syntax.

Current line:

data, label = iter(loader).next()

Proposed line change:

data, label = next(iter(loader))

DavidCarlyn avatar Aug 18 '23 18:08 DavidCarlyn