wide-residual-networks icon indicating copy to clipboard operation
wide-residual-networks copied to clipboard

TypeError: 'int' object has no attribute '__getitem__'

Open renatosc opened this issue 7 years ago • 1 comments

Hi. Thank you for sharing your work.

I was trying to run your training code (python main.py --save ./logs/resnet_$RANDOM$RANDOM --depth 28 --width 10) but I keep getting the following error:

('48 ', 'group2.block0.bn0.running_var ', '(320L,) ', 'torch.cuda.FloatTensor') ('49 ', 'group2.block0.bn0.running_mean ', '(320L,) ', 'torch.cuda.FloatTensor') ('\nTotal number of parameters:', 36497146) 0%| | 0/391 [00:00<?, ?it/s]Traceback (most recent call last): File "main.py", line 221, in main() File "main.py", line 217, in main engine.train(h, train_loader, opt.epochs, optimizer) File "/anaconda/lib/python2.7/site-packages/torchnet/engine/engine.py", line 23, in train for sample in state['iterator']: File "/anaconda/lib/python2.7/site-packages/tqdm/_tqdm.py", line 862, in iter for obj in iterable: File "/anaconda/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 174, in next return self._process_next_batch(batch) File "/anaconda/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 198, in _process_next_batch raise batch.exc_type(batch.exc_msg) TypeError: Traceback (most recent call last): File "/anaconda/lib/python2.7/site-packages/torch/utils/data/dataloader.py", line 34, in _worker_loop samples = collate_fn([dataset[i] for i in batch_indices]) File "/anaconda/lib/python2.7/site-packages/torchnet/dataset/transformdataset.py", line 50, in getitem z[k] = transform(z[k]) File "/anaconda/lib/python2.7/site-packages/torchnet/transform.py", line 14, in composition z = tr(z) File "build/bdist.linux-x86_64/egg/torchvision/transforms.py", line 173, in call return ImageOps.expand(img, border=self.padding, fill=self.fill) File "/anaconda/lib/python2.7/site-packages/PIL/ImageOps.py", line 259, in expand width = left + image.size[0] + right TypeError: 'int' object has no attribute 'getitem'

Full log here: https://pastebin.com/E0YZNm0B

Any idea of what that could be?

I am using a Azure Data Science VM (Ubuntu) with python 2.7

renatosc avatar Jun 05 '17 21:06 renatosc

I think you need to update torchvision package.

szagoruyko avatar Jun 12 '17 08:06 szagoruyko