-
-
Notifications
You must be signed in to change notification settings - Fork 16.5k
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
Update torch.cuda.amp to torch.amp #13244
base: master
Are you sure you want to change the base?
Conversation
All Contributors have signed the CLA. ✅ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 Hello @jacobdbrown4, thank you for submitting a YOLOv5 🚀 PR! To allow your work to be integrated as seamlessly as possible, we advise you to:
- ✅ Verify your PR is up-to-date with
ultralytics/yolov5
master
branch. If your PR is behind you can update your code by clicking the 'Update branch' button or by runninggit pull
andgit merge master
locally. - ✅ Verify all YOLOv5 Continuous Integration (CI) checks are passing.
- ✅ Reduce changes to the absolute minimum required for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee
I have read the CLA Document and I sign the CLA |
recheck |
@jacobdbrown4 thank you for your comment! To ensure we address your issue effectively, could you please verify that you are using the latest versions of YOLOv5 and all related dependencies? This helps us confirm whether the problem persists with the most recent updates. If the issue is still reproducible, please provide additional details such as error messages, steps to reproduce, and any relevant code snippets. This information will help us diagnose and resolve the issue more efficiently. Looking forward to your response! 😊 |
This pull request needs to be merged, inference times are slower due to this error constantly popping up with the newest versions of pytorch. |
Thank you for your input. Please ensure you're using the latest YOLOv5 version to see if the issue persists. If the problem continues, provide additional details so we can assist further. |
Reproducible with this commit 907bef2 |
Please ensure you're using the latest YOLOv5 version, as updates may resolve this issue. If it persists, let us know with more details. |
Are you guys just bots designed to repeat the same thing when a real issue is present within the code? The latest version of yolov5 is literally fetched every single time I initialize my script. The issue is with your code being outdated. |
@ijnrghjkdsmigywneig203 thank you for your feedback. We recommend ensuring all dependencies are up-to-date. If the issue persists, please provide more details so we can investigate further. |
Everything is up to date and the error for your outdated code still occurs. What can I do to solve it? torch.cuda.amp is deprecated as of Pytorch 2.4. This PR updates use to torch.amp. This gets rid of the FutureWarning: |
Thank you for bringing this to our attention. Please check if there's an open pull request addressing this update. If not, consider submitting one to help resolve the issue. |
There is an open pull request regarding this issue that will solve it. It is this one. Please merge this PR. |
Thank you for pointing this out. Please follow the pull request for updates, as it will be reviewed and merged if it meets the requirements. |
will this be merged anytime soon? |
Thank you for following up. The PR appears to address the deprecation warning for torch.cuda.amp in PyTorch 2.4. I'll let the maintainers review and make a decision on merging. In the meantime, you can track the PR status for updates. |
torch.cuda.amp
is deprecated as of Pytorch 2.4. This PR updates use totorch.amp
. This gets rid of thewarning as mentioned in #13226.
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Update to use latest CUDA AMP (Automatic Mixed Precision) API across various files for better compatibility and performance.
📊 Key Changes
torch.cuda.amp.autocast
withtorch.amp.autocast("cuda")
in multiple files.torch.cuda.amp.GradScaler
withtorch.amp.GradScaler("cuda")
.🎯 Purpose & Impact