-
Notifications
You must be signed in to change notification settings - Fork 153
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
Ultralytics yolov5 complilation, using weights attempt_load not working with torch.load() #277
Comments
Hi anubhavdavid, thank you for filing the issue. We will take a look. |
Hi Anubhav, Thanks for the query. I noticed this issue (which is unrelated to neuron): pytorch/pytorch#46971. It appears the issue here is caused by training a model and saving it in an earlier version of PyTorch and then loading in the current version (or a recent one). The comments indicate that loading just the state dictionary may be productive, if this sound like it matches your use of the model. While the error is not identical it looks similar. Please also note the compilation notes for YOLOv5 here: #253, and the upstreamed change to YOLOv5 here: ultralytics/yolov5#2953. It was merged here: ultralytics/yolov5#2982. If you are working with a recent version of YOLOv5 then I believe this should 'just work' for you. On saving and loading in neuron, typically you'd do something like this:
There is a difference between https://pytorch.org/docs/stable/generated/torch.load.html and https://pytorch.org/docs/stable/generated/torch.jit.load.html. I don't think this is the source of your issue, but worth noting to avoid any future issues. Thanks for trying torch-neuron, and I hope this information will help you resolve the problem. If you are still having problems and you believe it is related to Neuron, please share some code that reproduces the issue and we'll take a deeper look. |
Hi Anubhav, Since we haven't heard back on this issue for a week I am going to close it. Please feel free to reopen it if you have some additional information to share. |
If I'm directly loading the pre-trained weights using torch.hub.load, the compilation for neuron graph seems to be working, but if I download the weights using attempt_load and then load them with torch.load(), it give the error:
torch.nn.modules.module.ModuleAttributeError: 'Detect' object has no attribute 'inplace'
Compiler Version=> 1.3.7.0+fc8e67ab4
The text was updated successfully, but these errors were encountered: