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

PyTorch to IR error #419

Open
uhvardhan opened this issue Sep 19, 2018 · 5 comments
Open

PyTorch to IR error #419

uhvardhan opened this issue Sep 19, 2018 · 5 comments
Assignees

Comments

@uhvardhan
Copy link

Platform (like ubuntu 16.04/win10): Ubuntu 16.04

Python version: 3.5

Source framework with version (like Tensorflow 1.4.1 with GPU): Pytorch 0.3.1 with gpu

Destination framework with version (like CNTK 2.3 with GPU): Tensorflow

Pre-trained model path (webpath or webdisk path): https://drive.google.com/file/d/1Y2ritTA6PXosQ9u66f2JVpP_CMTt9fxl/view?usp=sharing

Running scripts:
mmtoir -f pytorch -d out -n ResNet-2018-09-18T21:50:42.pth --inputShape 3,224,224
Traceback (most recent call last):
File "/usr/local/bin/mmtoir", line 11, in
sys.exit(_main())
File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/_script/convertToIR.py", line 192, in _main
ret = _convert(args)
File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/_script/convertToIR.py", line 91, in _convert
from mmdnn.conversion.pytorch.pytorch_parser import PytorchParser
File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/pytorch/pytorch_parser.py", line 12, in
from mmdnn.conversion.pytorch.pytorch_graph import PytorchGraph
File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/pytorch/pytorch_graph.py", line 12, in
from torch.jit import _unique_state_dict
ImportError: cannot import name '_unique_state_dict'

@muzi-8
Copy link

muzi-8 commented Sep 20, 2018

@uhvardhan  I think the major problem is torch' version.
You should update to the torch 0.4.0 ; torchvision 0.2.1
Maybe you can refer to the same issue#274#413
Good Luck!

@uhvardhan
Copy link
Author

I have tried updating it 0.4.0 and 0.2.1 torchvision but couldn't solve the problem. I will have a look at the issues now

Thanks for the help.

@namizzz
Copy link
Contributor

namizzz commented Sep 21, 2018

Hi @uhvardhan ,from the stack trace:

File "/usr/local/lib/python3.5/dist-packages/mmdnn/conversion/pytorch/pytorch_graph.py", line 12, in 
from torch.jit import _unique_state_dict
ImportError: cannot import name '_unique_state_dict'

image
I try to reproduce your problem, but it can pass. Please try again, thanks!

@uhvardhan
Copy link
Author

Hi @namizzz

I am not sure if it worked because I have been getting another error.

Traceback (most recent call last):
File "/home/harshvardhan/anaconda3/lib/python3.6/site-packages/mmdnn/conversion/pytorch/pytorch_parser.py", line 74, in init
model = torch.load(model_file_name)
File "/home/harshvardhan/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 358, in load
return _load(f, map_location, pickle_module)
File "/home/harshvardhan/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 542, in _load
result = unpickler.load()
ModuleNotFoundError: No module named 'agents'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/harshvardhan/anaconda3/bin/mmtoir", line 11, in
sys.exit(_main())
File "/home/harshvardhan/anaconda3/lib/python3.6/site-packages/mmdnn/conversion/_script/convertToIR.py", line 192, in _main
ret = _convert(args)
File "/home/harshvardhan/anaconda3/lib/python3.6/site-packages/mmdnn/conversion/_script/convertToIR.py", line 92, in _convert
parser = PytorchParser(args.network, inputshape[0])
File "/home/harshvardhan/anaconda3/lib/python3.6/site-packages/mmdnn/conversion/pytorch/pytorch_parser.py", line 76, in init
model = torch.load(model_file_name, map_location='cpu')
File "/home/harshvardhan/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 358, in load
return _load(f, map_location, pickle_module)
File "/home/harshvardhan/anaconda3/lib/python3.6/site-packages/torch/serialization.py", line 542, in _load
result = unpickler.load()
ModuleNotFoundError: No module named 'agents'

Can you please have a look ?

Thanks

@namizzz
Copy link
Contributor

namizzz commented Sep 22, 2018

Hi @uhvardhan ,It is a class named as 'agents' defined by you. Please refer to

#241

#281

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