Re-write model with current YOLOv5/PyTorch versions? #9138
Replies: 3 comments
-
@agentmorris I'm unable to produce any backwards compatibility issues with older models running inference in master. Here is a v6.0 model trained in October 2021 running inference with today's master: !python detect.py --weights https://github.com/ultralytics/yolov5/releases/download/v6.0/yolov5s.pt We've created a few short guidelines below to help users provide what we need in order to start investigating a possible problem. How to create a Minimal, Reproducible ExampleWhen asking a question, people will be better able to provide help if you provide code that they can easily understand and use to reproduce the problem. This is referred to by community members as creating a minimum reproducible example. Your code that reproduces the problem should be:
For Ultralytics to provide assistance your code should also be:
If you believe your problem meets all the above criteria, please close this issue and raise a new one using the 🐛 Bug Report template with a minimum reproducible example to help us better understand and diagnose your problem. Thank you! 😃 |
Beta Was this translation helpful? Give feedback.
-
Thanks! You're right, it does seem to be working with the latest YOLOv5 and the latest PyTorch. Unless I'm losing my mind, based on my own experience and @glenn-jocher's reply to issue 6498, it seems that there was a period where the "upsample" incompatibility had been fixed, but running old models (from before the incompatibility existed) still required re-training. But now the incompatibility appears to be... even more fixed, such that even old models work. So, sorry for the false alarm, and thanks for the quick reply! |
Beta Was this translation helpful? Give feedback.
-
Interestingly, although as per above I confirmed that this issue appears to be resolved with the latest YOLOv5 code and the most recent stable PyTorch build (1.12 as of today), it appears to still exist in the most recent PyTorch nightly build (version 1.13.0. as of today), regardless of whether I use a current or old version of YOLOv5. This is surprising, but not impossible; maybe this was fixed as a one-off prior to releasing PyTorch 1.12. I'm crossing my fingers and hoping that when version 1.13 is released for real, this issue will (still) be fixed. |
Beta Was this translation helpful? Give feedback.
-
I have a YOLOv5 model that was trained a few months ago, and due to issue 6948, I cannot run inference with current PyTorch builds. I would like to allow inference with current PyTorch and YOLOv5 builds, in particular to take advantage of recently-added M1 support.
My understanding, based the discussion of that issue (in particular @glenn-jocher's reply, is that updating the inference environment is not sufficient; the model needs to be re-written. Experiments suggest that fine-tuning on new data achieves the desired result, but may modify the weights, which we don't want in this case; it's important that the weights not change at all.
Is there a recommended way of "fine-tuning" without adding any new data, i.e. just re-writing the existing weights in a new YOLOv5/PyTorch environment?
Thanks!
-Dan
Beta Was this translation helpful? Give feedback.
All reactions