Skip to content

Commit 0ed13a5

Browse files
committed
skip fp16 tests if TensorRT-RTX < 1.6
1 parent c260c00 commit 0ed13a5

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

py/torch_tensorrt/_utils.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ def check_cross_compile_trt_win_lib() -> bool:
4040
return False
4141

4242

43+
def is_tensorrt_rtx_version_supported(min_version: str) -> bool:
44+
"""
45+
Check if the installed TensorRT-RTX version supports the specified minimum version.
46+
Args:
47+
min_version (str): Minimum required TensorRT-RTX version
48+
Returns:
49+
bool: True if TensorRT-RTX version is >= min_version, False otherwise
50+
"""
51+
if trt._package_name != "tensorrt_rtx":
52+
return True
53+
54+
from packaging.version import Version
55+
56+
return bool(Version(trt.__version__) >= Version(min_version))
57+
58+
4359
def is_tensorrt_version_supported(min_version: str) -> bool:
4460
"""
4561
Check if the installed TensorRT version supports the specified minimum version.

tests/py/dynamo/models/test_hf_gqa_model.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import pytest
55
import torch
66
import torch_tensorrt
7+
from torch_tensorrt._utils import is_tensorrt_rtx_version_supported
78

89
if importlib.util.find_spec("transformers"):
910
import transformers
@@ -21,6 +22,15 @@
2122
"transformers is required to run this test",
2223
)
2324
def test_dynamic_head_dim_with_hf_model(dtype, decompose_attention):
25+
if (
26+
torch_tensorrt.ENABLED_FEATURES.tensorrt_rtx
27+
and not is_tensorrt_rtx_version_supported("1.6")
28+
):
29+
pytest.skip(
30+
"TensorRT-RTX >= 1.6 is required because it fixed some accuracy issues for FP16"
31+
)
32+
return
33+
2434
from transformers import AutoModelForCausalLM
2535

2636
model_name = "Qwen/Qwen2.5-0.5B-Instruct"

0 commit comments

Comments
 (0)