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

Training Error regarding variable i #9

Open
msiraj83 opened this issue May 21, 2018 · 6 comments
Open

Training Error regarding variable i #9

msiraj83 opened this issue May 21, 2018 · 6 comments

Comments

@msiraj83
Copy link

Hello,
I generated the .h5 file according to your instruction in issues #8. But now i got new error as attached in screen shot.
sesr_i_variable_error

Where you define the variable i in the main.py file. The error generated by highlighted line in the attached file.
main py

can you correct the code please

Thanks

@opteroncx
Copy link
Owner

imglist[i] ---> imglist[-1]

@opteroncx
Copy link
Owner

I have fixed this bug, thank you.

@msiraj83
Copy link
Author

msiraj83 commented May 21, 2018

Dear @opteroncx

Thanks for your correction but now i got another error loss_x2.backward(retain_variables=True) TypeError: backward() got an unexpected keyword argument 'retain_variables' as attached in the screen shot
another_error
Its like undefined variable i think.

@opteroncx
Copy link
Owner

Are you using PyTorch with version > 0.2 ?
Change to retain_graph=True may fix this.

@msiraj83
Copy link
Author

@opteroncx

Thanks you so much. Yea its now running. a little bit worry about this warning..
main.py:119: UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number print("===> Epoch[{}]({}/{}): Loss: {:.10f}".format(epoch, iteration, len(training_data_loader), loss.data[0])) ===> Epoch[1](100/686): Loss: 12758226.0000000000 ===> Epoch[1](200/686): Loss: 6495788.5000000000
is it is ok ??

@opteroncx
Copy link
Owner

loss.data[0] --> loss.item()
This won't cause any error if you do not update your Pytorch to 0.5.0

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