-
-
Notifications
You must be signed in to change notification settings - Fork 16.6k
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
Fix FP32 TensorRT model export #8046
Conversation
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 @SahilChachra, 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 upstream/master. If your PR is behind upstream/master an automatic GitHub Actions merge may be attempted by writing /rebase in a new comment, or by running the following code, replacing 'feature' with the name of your local branch:
git remote add upstream https://github.com/ultralytics/yolov5.git
git fetch upstream
# git checkout feature # <--- replace 'feature' with local branch name
git merge upstream/master
git push -u origin -f
- ✅ Verify all 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
@SahilChachra I'd defaulted all TRT to FP16, but you're right, this is probably more aligned with the expected behavior here. |
@SahilChachra PR is merged. Thank you for your contributions to YOLOv5 🚀 and Vision AI ⭐ |
Thankyou @glenn-jocher 😃 |
Fixed FP32 TRT model export Co-authored-by: Glenn Jocher <[email protected]>
Fixed FP32 TRT model export Co-authored-by: Glenn Jocher <[email protected]>
@SahilChachra you're welcome! The YOLO community and the Ultralytics team have put in a lot of effort to make YOLOv5 a success. Thank you for being a part of it! If you have any more questions or feedback, feel free to ask. |
Problem :- While exporting model as TensorRT, the code was using FP16 precision even without using "--half" flag with the export command. Hence, was unable to export FP32 precision models with the export command.
Fix :- Passed "half" variable to the if condition which means we will get FP16 model only if user has passed the "half" flag and the hardware supports FP16. Also modified the logger code to print appropriate precision being used. Just adding "half" variable, the bug has been resolved. Thanks 😄
Have tested the code for FP16 and FP32 both. It's working.
Attaching screenshots.
After fixing the code, we get,
🛠️ PR Summary
Made with ❤️ by Ultralytics Actions
🌟 Summary
Improved TensorRT export flexibility regarding precision modes.
📊 Key Changes
half
flag.🎯 Purpose & Impact
half
setting, potentially improving performance on compatible hardware. 🚀