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

How to convert torch model to torch jit model ? #249

Open
VpkPrasanna opened this issue May 28, 2021 · 1 comment
Open

How to convert torch model to torch jit model ? #249

VpkPrasanna opened this issue May 28, 2021 · 1 comment
Labels

Comments

@VpkPrasanna
Copy link

How to convert psenet_r50_fpnf_600e_icdar2015_pretrain-eefd8fe6.pth model to torch jit model , when i tried so i am getting an error of
The code which i used to convert is
def convert_model(model,image): model = torch.load(model) with torch.jit.optimized_execution(True,): traced_model = torch.jit.trace(model,image) return traced_model
Error which i got Traceback (most recent call last): File "/home/laptop-obs-128/Downloads/funhouse-backend/app/server/ai_runner/ocr/models/model_conversion.py", line 13, in <module> det_traced_model = convert_model(model=det_model,image=test_image) File "/home/laptop-obs-128/Downloads/funhouse-backend/app/server/ai_runner/ocr/models/model_conversion.py", line 10, in convert_model traced_model = torch.jit.trace(model,image) File "/home/laptop-obs-128/miniconda3/envs/funhouse-backend/lib/python3.9/site-packages/torch/jit/_trace.py", line 777, in trace name = _qualified_name(func) File "/home/laptop-obs-128/miniconda3/envs/funhouse-backend/lib/python3.9/site-packages/torch/_jit_internal.py", line 876, in _qualified_name raise RuntimeError("Could not get name of python class object") RuntimeError: Could not get name of python class object

@cuhk-hbsun
Copy link
Collaborator

We are locating the bug. It may be because the data type of image you give to model since model forward need both image and image_metas.

@innerlee innerlee added the jit label May 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants