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
I am using coremltools to do so.
But I get error