eladhoffer / convNet.pytorch

ConvNet training using pytorch
MIT License
345 stars 88 forks source link

How to run the code in Colaboratory? #23

Open abdulsam opened 2 years ago

abdulsam commented 2 years ago

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?

sudo-install-MW commented 2 years ago

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

abdulsam commented 2 years ago

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