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 8.1.46
add TensorRT 10 support
#9516
Conversation
only modifies existing code to keep prior functionalities in place
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9516 +/- ##
==========================================
+ Coverage 76.12% 76.48% +0.35%
==========================================
Files 121 121
Lines 15294 15327 +33
==========================================
+ Hits 11643 11723 +80
+ Misses 3651 3604 -47
Flags with carried forward coverage won't be shown. Click here to find out more. β View full report in Codecov by Sentry. |
Not happy with how this is at present, but it's a reasonable starting point that doesn't impact inference speeds. When testing with TRT 9 exports with TRT 10 environment, the TRT 9 model would not load and would return Need to do more investigation into TRT version compatibility. |
@Burhan-Q got it! You can also check version like this instead of using Try: Except fields: if check_version(trt.__version__, "<10.0.0"):
# logic here Or you could return the Major version like this: trt_major_version = parse_version(trt.__version__)[0] |
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.
@glenn-jocher I saw you added some updates, I was thinking about using the walrus operator to assign is_trt_10
_ = (is_trt_10 := check_version(trt.__version__, ">=10.0.0"))
Thought this could be really clean. I'll let you make the call on how to design it tho. Let me know if you want me to test anything on Windows or Linux
β¦ bugs when exporting a tensorrt file .engine with flag half=True or when inference (#9840) Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@Burhan-Q oh hey buddy, |
ultralytics 8.1.46
add TensorRT 10 support
My bad, I thought I read it was supported in 3.8 as well |
@Burhan-Q yeah actually maybe you're right, I got myself mixed up. So even though we're officially 3.7 deprecated we still see a high amount of workflows out there running 3.7 per our analytics so we have to try to stay 3.7-friendly for the time being. |
@glenn-jocher removed excess conditionals from |
@Burhan-Q oh this looks much nicer! But are you sure we didn't need a more signficant if-else in autobackend forward()? |
@Burhan-Q issue here |
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com>
@glenn-jocher sounds good. Looks like the older TensorRT versions require use of the |
The oldest version of TensorRT I could install for python 3.10 is pip install tensorrt==8.4.*
ERROR: Could not find a version that satisfies the requirement tensorrt==8.4.*
(from versions: 0.0.1.dev5, 0.0.1, 8.5.1.7, 8.5.2.2, 8.5.3.1, 8.6.0, 8.6.1, 8.6.1.post1,
9.0.0.post11.dev1, 9.0.0.post12.dev1, 9.0.1.post11.dev4, 9.0.1.post12.dev4,
9.1.0.post11.dev4, 9.1.0.post12.dev4, 9.2.0.post11.dev5, 9.2.0.post12.dev5,
9.3.0.post11.dev1, 9.3.0.post12.dev1, 10.0.0b6) |
@glenn-jocher it appears that the oldest version of TensorRT that is downloadable for install with python 3.8 is |
@glenn-jocher CI is passing now and I was able to test with TensorRT
so I guess this means that some components of the code are deprecated during each release. These are maintained for some time before being completely removed. |
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: δΉζ―ε¦ιζηη§°εΌ <1069679911@qq.com>
Working to add TensorRT >=10 support now that it's in early access. TensorRT 10 documentation reference. Appending code to add support for latest version changes, but retains code for use with prior versions of TensorRT.
ultralytics/engine/exporter.py
TensorRT 10.0.0b6
,Ultralytics 8.1.42
,PyTorch 2.2.0
,ONNX 1.15.0
model.export(format="engine")
model.export(format="engine", half=True, dynamic=True)
model.export(format="engine", half=True, dynamic=True, simplify=True, workspace=5, imgsz=320)
TensorRT <10
still functionalultralytics/AutoBackend
half
+dynamic
exporthalf
+dynamic
+simplify
+imgsz=320
exportπ οΈ PR Summary
Made with β€οΈ by Ultralytics Actions
π Summary
Improved support for NVIDIA TensorRT exports in Ultralytics YOLOv8 models.
π Key Changes
π― Purpose & Impact
These updates are aimed at improving the user experience by ensuring compatibility with newer technologies and optimizing model performance, marking a significant step forward in deploying Ultralytics YOLO models in production environments.