Exclude tensorrt==10.2.0 to fix libnvinfer_builder_resource_win.so.10.2.0 error (#24367)

Signed-off-by: Lakshantha Dissanayake <lakshantha@ultralytics.com>
Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Laughing-q <1185102784@qq.com>
This commit is contained in:
Lakshantha Dissanayake 2026-04-28 23:08:59 -07:00 committed by GitHub
parent c5a0e0331e
commit a2ae024ef2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 6 additions and 7 deletions

View File

@ -9,8 +9,8 @@ from pathlib import Path
import numpy as np
import torch
from ultralytics.utils import IS_JETSON, LINUX, LOGGER, PYTHON_VERSION
from ultralytics.utils.checks import check_requirements, check_version
from ultralytics.utils import IS_JETSON, LOGGER, PYTHON_VERSION
from ultralytics.utils.checks import check_requirements, check_tensorrt, check_version
from .base import BaseBackend
@ -36,12 +36,11 @@ class TensorRTBackend(BaseBackend):
try:
import tensorrt as trt
except ImportError:
if LINUX:
check_requirements("tensorrt>7.0.0,!=10.1.0")
check_tensorrt()
import tensorrt as trt
check_version(trt.__version__, ">=7.0.0", hard=True)
check_version(trt.__version__, "!=10.1.0", msg="https://github.com/ultralytics/ultralytics/pull/14239")
check_version(trt.__version__, "!=10.2.0", msg="https://github.com/ultralytics/ultralytics/pull/24367")
if self.device.type == "cpu":
self.device = torch.device("cuda:0")

View File

@ -531,7 +531,7 @@ def check_tensorrt(min_version: str = "7.0.0"):
"""
if LINUX:
cuda_version = torch.version.cuda.split(".")[0]
check_requirements(f"tensorrt-cu{cuda_version}>={min_version},!=10.1.0")
check_requirements(f"tensorrt-cu{cuda_version}>={min_version},!=10.2.0")
def check_torchvision():

View File

@ -143,7 +143,7 @@ def onnx2engine(
check_tensorrt()
import tensorrt as trt
check_version(trt.__version__, ">=7.0.0", hard=True)
check_version(trt.__version__, "!=10.1.0", msg="https://github.com/ultralytics/ultralytics/pull/14239")
check_version(trt.__version__, "!=10.2.0", msg="https://github.com/ultralytics/ultralytics/pull/24367")
LOGGER.info(f"\n{prefix} starting export with TensorRT {trt.__version__}...")
output_file = output_file or Path(onnx_file).with_suffix(".engine")