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 can I convert pre-trained model to coreml to use it on ios application? #62

Open
sarojraut opened this issue Jun 15, 2023 · 0 comments

Comments

@sarojraut
Copy link

sarojraut commented Jun 15, 2023

I am using coremltools to do so.

import coremltools as ct
 import torch
 import torch.nn as nn

 model = torch.load('/Users/sarojraut/Downloads/side.pth',map_location=torch.device('cpu'))
 example_input = torch.rand(1, 3, 224, 224) 

 traced_model = torch.jit.trace(model, example_input)

But I get error

Traceback (most recent call last):
 File "<pyshell#34>", line 1, in <module>
 traced_model = torch.jit.trace(model, dummy_input)
 File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-   packages/torch/jit/_trace.py", line 846, in trace
 name = _qualified_name(func)
 File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site- packages/torch/_jit_internal.py", line 1145, in _qualified_name
 raise RuntimeError("Could not get name of python class object")
 RuntimeError: Could not get name of python class object
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

1 participant