-
Notifications
You must be signed in to change notification settings - Fork 161
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
I encounted with the same problem "AttributeError: 'NoneType' object has no attribute 'gradInput'" #24
Comments
I come up with the same problem, do you solve this ? |
Hi, I had same problem which have been solved. from torch.utils.serialization import load_lua
model = load_lua("path_to_your_model.t7")
print(model) In my case, I got following output:
This seems complicated but it's just a
Then, the problem is occuring in def torch_to_pytorch(t7_filename,outputname=None):
model = load_lua(t7_filename,unknown_classes=True)
if type(model).__name__=='hashable_uniq_dict':
model=model.model
model.gradInput = None
slist = lua_recursive_source(lnn.Sequential().add(model))
s = simplify_source(slist)
header = ''' you can see the line
Finally, def torch_to_pytorch(t7_filename,outputname=None):
model = load_lua(t7_filename,unknown_classes=True)
if type(model).__name__=='hashable_uniq_dict':
model = model['stylenet']
model.gradInput = None
slist = lua_recursive_source(lnn.Sequential().add(model))
s = simplify_source(slist)
header = ''' worked. |
Hi @kenmikanmi As you pointed out, the error seems to be in command: model = model.model Can you help on this? Best |
@Jamesswiz |
@kenmikanmi Yes I get the same error. another thing which i tried was to replace the whole 'if' statement itself with just model=model[0]. but I still don't have exact idea so I may be wrong. Here is my model. |
Before someone came up with this problem, your suggestion is that you can debug to locate where the attribute 'gradInput' is, Thus? next what we should do? comment or what? May you in detail explain how to revise the code? Thank you very much!
The text was updated successfully, but these errors were encountered: