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

AttributeError: creator #17

Open
thnkim opened this issue May 13, 2017 · 7 comments
Open

AttributeError: creator #17

thnkim opened this issue May 13, 2017 · 7 comments

Comments

@thnkim
Copy link

thnkim commented May 13, 2017

hello,
When I try sample code (in README) to export PyTorch model, like

out = net.forward(torch.autograd.Variable(torch.FloatTensor(1,3,227,227)))
thexport.save('pymodel.net', out)

I got the following error.

File "...... /python3.6/site-packages/torch/autograd/variable.py", line 63, in __getattr__
    raise AttributeError(name)
AttributeError: creator
@mvitez
Copy link
Owner

mvitez commented May 13, 2017

This is a pytorch issue and has nothing to do with thnets. I have now installed the latest pytorch to see if there are any changes in syntax, but those commands work to me without any issues. Do you have maybe some (very) old version of pytorch?

@thnkim
Copy link
Author

thnkim commented May 13, 2017

I dump all that I tried:

[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> from torchvision import models
>>> import thexport
>>>
>>> net = models.alexnet().eval()
>>> out = net.forward(torch.autograd.Variable(torch.FloatTensor(1,3,227,227)))
>>> thexport.save('pymodel.net', out)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/polphit/work/thnets/thexport.py", line 104, in save
    e.write(output.creator)
  File "/home/polphit/anaconda3/lib/python3.6/site-packages/torch/autograd/variable.py", line 63, in __getattr__
    raise AttributeError(name)
AttributeError: creator

my pytorch version is

>>> torch.__version__
'0.1.12+d1a4467'

I'll try this on another machine.
Thank you.

@thnkim
Copy link
Author

thnkim commented May 13, 2017

Hello,
it worked perfectly on pytorch 0.1.11, but I got this issue on 0.1.12.
I tested on
0.1.12 + Python 3.6.0 Anaconda: had the issue
0.1.11 + Python 3.6.0 Anaconda: worked!
0.1.12 + Python 3.5.0 (no Anaconda): had the issue
0.1.11 + Python 3.5.0 (no Anaconda): worked!

Thank you. (Surely I pulled pytorch from master branch).

@mvitez
Copy link
Owner

mvitez commented May 13, 2017

I have tested it on 0.1.12_2 with Python 3.5. I don' t have Python 3.6. Maybe PyTorch has some issues with Python 3.6, I don't know.

@thnkim
Copy link
Author

thnkim commented May 13, 2017

Thank you.
I guess, it may be related to 'https://discuss.pytorch.org/t/variable-no-attribute-creator/2866', which says pytorch 0.1.12 refactored autograd.

@mvitez
Copy link
Owner

mvitez commented May 13, 2017

Yes, but I am using 0.1.12. The latest version downloaded today!

@minhnh
Copy link

minhnh commented Jul 18, 2017

It seems pytorch refactored from 'creator' to 'grad_fn'. There's a pull request on the tutorial repository updating this.

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

3 participants