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

Quantization-aware pytorch model convert tflite #63

Closed
jiesonshan opened this issue Apr 1, 2022 · 3 comments
Closed

Quantization-aware pytorch model convert tflite #63

jiesonshan opened this issue Apr 1, 2022 · 3 comments
Labels
question Further information is requested

Comments

@jiesonshan
Copy link

when using converter.convert()

File "/home/shanshaojie/project/TinyNeuralNetwork/tinynn/converter/base.py", line 356, in convert
self.init_jit_graph()
File "/home/shanshaojie/project/TinyNeuralNetwork/tinynn/converter/base.py", line 143, in init_jit_graph
script = torch.jit.trace(self.model, self.dummy_input)
File "/home/shanshaojie/anaconda3/lib/python3.6/site-packages/torch/jit/_trace.py", line 742, in trace
_module_class,
File "/home/shanshaojie/anaconda3/lib/python3.6/site-packages/torch/jit/_trace.py", line 928, in trace_module
module = make_module(mod, _module_class, _compilation_unit)
File "/home/shanshaojie/anaconda3/lib/python3.6/site-packages/torch/jit/_trace.py", line 560, in make_module
return _module_class(mod, _compilation_unit=_compilation_unit)
File "/home/shanshaojie/anaconda3/lib/python3.6/site-packages/torch/jit/_trace.py", line 1040, in init
submodule, TracedModule, _compilation_unit=None
File "/home/shanshaojie/anaconda3/lib/python3.6/site-packages/torch/jit/_trace.py", line 560, in make_module
return _module_class(mod, _compilation_unit=_compilation_unit)
File "/home/shanshaojie/anaconda3/lib/python3.6/site-packages/torch/jit/_trace.py", line 1040, in init
submodule, TracedModule, _compilation_unit=None
File "/home/shanshaojie/anaconda3/lib/python3.6/site-packages/torch/jit/_trace.py", line 560, in make_module
return _module_class(mod, _compilation_unit=_compilation_unit)
File "/home/shanshaojie/anaconda3/lib/python3.6/site-packages/torch/jit/_trace.py", line 1040, in init
submodule, TracedModule, _compilation_unit=None
File "/home/shanshaojie/anaconda3/lib/python3.6/site-packages/torch/jit/_trace.py", line 549, in make_module
elif torch._jit_internal.module_has_exports(mod):
File "/home/shanshaojie/anaconda3/lib/python3.6/site-packages/torch/_jit_internal.py", line 505, in module_has_exports
item = getattr(mod, name)
File "/home/shanshaojie/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 779, in getattr
type(self).name, name))
torch.nn.modules.module.ModuleAttributeError: 'ConvModule' object has no attribute 'norm'
How to debug the problem? thanks

@peterjc123
Copy link
Collaborator

@jiesonshan It means that your model cannot go through torch.jit.trace. Please search for the keyword norm in the class ConvModule at your side.

@peterjc123 peterjc123 added the question Further information is requested label Apr 1, 2022
@jiesonshan
Copy link
Author

@peterjc123 thank you,the problem has been solved by modified ConvModule‘s norm method; but It may be an upstream bug from PyTorch, which refers to pytorch/pytorch#50680

@peterjc123
Copy link
Collaborator

I'm glad that you got it resolved. And thanks for the reference to the upstream bug report. But unluckily, there's not much we can help here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants