wbw520 / BotCL

Learning Bottleneck Concepts in Image Classification (CVPR 2023)
33 stars 6 forks source link

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

Open DavidCarlyn opened 1 year ago

DavidCarlyn commented 1 year ago

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))