convNet.pytorch icon indicating copy to clipboard operation
convNet.pytorch copied to clipboard

How to run the code in Colaboratory?

Open abdulsam opened this issue 4 years ago • 2 comments

I'm trying to run main.py using colab and I executed following command in colab

!python /content/convNet.pytorch/main.py --dataset cifar10 --model resnet --model-config "{'depth': 44}" --duplicates 40 --cutout -b 64 --epochs 100 --save resnet44_cutout_m-40

and I'm getting the following error

Traceback (most recent call last): File "/content/convNet.pytorch/main.py", line 14, in <module> from data import DataRegime, SampledDataRegime File "/content/convNet.pytorch/data.py", line 9, in <module> from utils.dataset import IndexedFileDataset File "/content/convNet.pytorch/utils/dataset.py", line 6, in <module> from torch.utils.data.sampler import Sampler, RandomSampler, BatchSampler, _int_classes ImportError: cannot import name '_int_classes' from 'torch.utils.data.sampler' (/usr/local/lib/python3.7/dist-packages/torch/utils/data/sampler.py)

How can I fix this issue? What steps do I need to follow to be able to run the code in colab? What changes do I need to make?

abdulsam avatar Sep 30 '21 06:09 abdulsam

This is an ImportError what version of pytorch did you use?

sudo-install-MW avatar Sep 30 '21 13:09 sudo-install-MW

As I'm using colab so it is 1.9.0+cu102

abdulsam avatar Oct 01 '21 03:10 abdulsam