Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
renatosc opened this issue Jun 5, 2017 · 1 comment
Open

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

renatosc opened this issue Jun 5, 2017 · 1 comment

Comments

@renatosc
Copy link

renatosc commented Jun 5, 2017

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

@szagoruyko
Copy link
Owner

I think you need to update torchvision package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants