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

Recipe Visulization and new Prediction #15

Open
demdecuong opened this issue Dec 23, 2018 · 4 comments
Open

Recipe Visulization and new Prediction #15

demdecuong opened this issue Dec 23, 2018 · 4 comments

Comments

@demdecuong
Copy link

demdecuong commented Dec 23, 2018

I am using Ubuntu 18.04,Pytorch 0.4.1, Py27, no cuda
In test.py, i have deleted all line which format is ".cuda()" since my local computer is not suit the GPU way. Moreover , i haved modified the batch_size in agr.py = 1 instead of 160.
Then, i meet the problem in :
File "test.py", line 107, in test
output = model(input_var[0],input_var[1], input_var[2], input_var[3], input_var[4])
IndexError: list index out of range

This the whole process with the command : python test.py --model_path=snapshots/model_e500_v-8.950.pth.tar
=> loading checkpoint 'snapshots/model_e500_v-8.950.pth.tar'
=> loaded checkpoint 'snapshots/model_e500_v-8.950.pth.tar' (epoch 500)
/home/minh/anaconda2/envs/im2recipe/lib/python2.7/site-packages/torchvision/transforms/transforms.py:188: UserWarning: The use of the transforms.Scale transform is deprecated, please use transforms.Resize instead.
"please use transforms.Resize instead.")
Test loader prepared.
Exception OSError: OSError(104, 'Connection reset by peer') in <bound method _DataLoaderIter.del of <torch.utils.data.dataloader._DataLoaderIter object at 0x7f1a29958810>> ignored
Traceback (most recent call last):
File "test.py", line 179, in
main()
File "test.py", line 81, in main
test(test_loader, model, criterion)
File "test.py", line 107, in test
output = model(input_var[0],input_var[1], input_var[2], input_var[3], input_var[4])
IndexError: list index out of range

Please give me some advices , Thanks anyway !

@nhynes
Copy link
Contributor

nhynes commented Dec 23, 2018

Hi! Thanks for the issue report. Do you know which of the inputs to model(...) are out of range? You can find this out by adding

from IPython import embed
embed()

before line 107 in test.py. That'll spawn an interpreter in which you can probe each of the inputs.

@demdecuong
Copy link
Author

Hi! Thanks for the issue report. Do you know which of the inputs to model(...) are out of range? You can find this out by adding

from IPython import embed
embed()

before line 107 in test.py. That'll spawn an interpreter in which you can probe each of the inputs.

Thanks you. I realize that the target_val type is long while input_val type is float which is the main problem

@nhynes
Copy link
Contributor

nhynes commented Dec 23, 2018

Cool. Glad you were able to solve your problem. I'm tentatively closing this issue but you should feel free to reopen it if you run into any trouble.

@nhynes nhynes closed this as completed Dec 23, 2018
@demdecuong
Copy link
Author

demdecuong commented Dec 25, 2018 via email

@nhynes nhynes reopened this Dec 25, 2018
@demdecuong demdecuong changed the title Test.py IndexError Recipe Visulization and new Prediction Dec 26, 2018
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