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
jit.trace() not working #57
Comments
It looks like you're trying to use a PyTorch function on a Detecto object - I think the following should hopefully fix the error: model_trace = torch.jit.trace(model.get_internal_model(), example) |
I have tried that too, but in that case it throws another error
But if you see my code above m not training a model m trying to trace model already trained on custom data set with custom classes |
Maybe try adding the following line: internal_model = model.get_internal_model()
internal_model.eval() # add this line
model_trace = torch.jit.trace(internal_model, example) |
Okay I tried that too but m getting another error now
Even cuda is available on my machine as There is one more thing that is confusing me, if we are extract the internal model, doesn't it only returns the official pretrained version on of faster rcnn ? I mean will it still be able to detect the objects with the classes i have trained the model ? |
When you train the Detecto model, it applies transfer learning on the internal PyTorch model, so the internal model will still be able to do everything (and more) that the Detecto model does. The Detecto model is mainly a wrapper around the PyTorch model to make things simpler to use. As for the issue you're getting, I'm not too sure as that seems to be getting more into PyTorch's domain than Detecto's. I would suggest maybe trying to manually send the internal model to the GPU (maybe |
Currently RCNN models are not supported by jit.trace() in pytorch and even wit jit.script() there is an issue on which they are working on. |
I am using detecto model which is trained on custom data set, but the problem is when i try to use that model with jit.trace it throws an error.
Code:
Error:
Traceback (most recent call last):
File “c:/Users/shehr/Desktop/Android Project/Android_Model.py”, line 21, in
model_trace = torch.jit.script(model, example)
File “C:\Users\shehr\Anaconda3\envs\tf_gpu\lib\site-packages\torch\jit_init_.py”, line 1257, in script
qualified_name = _qualified_name(obj)
File “C:\Users\shehr\Anaconda3\envs\tf_gpu\lib\site-packages\torch_jit_internal.py”, line 682, in _qualified_name
name = obj.name
AttributeError: ‘Model’ object has no attribute ‘name’
Any idea why m getting this ? Any help will be appreciated.
The text was updated successfully, but these errors were encountered: