mirror of
https://github.com/NVIDIA/Model-Optimizer.git
synced 2026-10-02 03:14:52 +08:00
## What does this PR do? **Type of change:** CI/CD Improvement <!-- Use one of the following: Bug fix, new feature, new example, new tests, documentation. --> Updated CI/CD test matrix (new `cuda13-gpu-trtllm` dedicated job for gpu tests on trtllm container) | Workflow | Trigger | Test Matrix | GPU Runner | |---|---|---|---| | **GPU tests** | PR | `cuda13-gpu`, `cuda13-gpu-megatron`, `cuda13-gpu-trtllm` | 1x RTX Pro 6000 | | **GPU tests** | Nightly | `cuda13-gpu`, `cuda13-gpu-megatron`, `cuda13-gpu-trtllm` | 2x RTX Pro 6000 | | **Example tests (torch)** | PR | `llm_distill`, `llm_qat`, `llm_sparsity`, `speculative_decoding` | 1x H100 | | **Example tests (torch)** | Nightly | `llm_distill`, `llm_qat`, `llm_sparsity`, `speculative_decoding` | 2x RTX Pro 6000 | | **Example tests (trtllm)** | PR | `llm_ptq`, `vlm_ptq` | 1x RTX Pro 6000 | | **Example tests (trtllm)** | Nightly | `llm_autodeploy`, `llm_eval`, `llm_ptq`, `vlm_ptq` | 2x RTX Pro 6000 | | **Example tests (onnx)** | PR | `diffusers`, `torch_onnx` | 1x L4 | | **Example tests (onnx)** | Nightly | `diffusers`, `torch_onnx` | 2x RTX Pro 6000 | ## Testing <!-- Mention how have you tested your change if applicable. --> - [ ] Per PR tests pass in this PR - [ ] Nightly tests manually triggered: https://github.com/NVIDIA/Model-Optimizer/actions/runs/22495679199 (GPU tests), ? (Example tests) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Unified and simplified CI test matrices and reduced duplicate workflow configuration. * Updated GPU runner targets and container images for test jobs to newer GPU types. * **Tests** * Added new GPU test variants and several new test modules. * Simplified test gating: megatron auto-skip removed; tests now use a single dependency check for the mamba provider. * **Tooling** * Added a new tox environment for an additional GPU test suite. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
84 lines
2.8 KiB
Python
84 lines
2.8 KiB
Python
# SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
import ctypes
|
|
import importlib.metadata
|
|
import os
|
|
import shutil
|
|
|
|
import pytest
|
|
from packaging import version
|
|
|
|
|
|
def skip_if_no_tensorrt():
|
|
from modelopt.onnx.quantization.ort_utils import _check_for_tensorrt
|
|
|
|
try:
|
|
_check_for_tensorrt()
|
|
except (AssertionError, ImportError) as e:
|
|
pytest.skip(f"{e}", allow_module_level=True)
|
|
|
|
# Also verify that ORT's TensorRT EP can actually load its native library.
|
|
# The tensorrt Python package may be installed, but ORT's provider shared library
|
|
# (libonnxruntime_providers_tensorrt.so) could fail to load due to CUDA version
|
|
# mismatches (e.g., ORT built for CUDA 12 running on a CUDA 13 system).
|
|
try:
|
|
import onnxruntime
|
|
|
|
ort_capi_dir = os.path.join(os.path.dirname(onnxruntime.__file__), "capi")
|
|
trt_provider_lib = os.path.join(ort_capi_dir, "libonnxruntime_providers_tensorrt.so")
|
|
if os.path.isfile(trt_provider_lib):
|
|
ctypes.CDLL(trt_provider_lib)
|
|
except OSError as e:
|
|
pytest.skip(
|
|
f"ORT TensorRT EP native library cannot be loaded: {e}",
|
|
allow_module_level=True,
|
|
)
|
|
|
|
|
|
def skip_if_no_trtexec():
|
|
if not shutil.which("trtexec"):
|
|
pytest.skip("trtexec cmdline tool is not available", allow_module_level=True)
|
|
|
|
|
|
def skip_if_no_libcudnn():
|
|
from modelopt.onnx.quantization.ort_utils import _check_for_libcudnn
|
|
|
|
try:
|
|
_check_for_libcudnn()
|
|
except FileNotFoundError as e:
|
|
pytest.skip(f"{e}!", allow_module_level=True)
|
|
|
|
|
|
def skip_if_no_mamba():
|
|
try:
|
|
import mamba_ssm # noqa: F401
|
|
except ImportError:
|
|
pytest.skip("Mamba required for Megatron test", allow_module_level=True)
|
|
|
|
|
|
def skip_if_onnx_version_above_1_18():
|
|
package_name = "onnx"
|
|
required_version = "1.18.0"
|
|
|
|
try:
|
|
installed_version = importlib.metadata.version(package_name)
|
|
except importlib.metadata.PackageNotFoundError:
|
|
pytest.skip(f"{package_name} is not installed")
|
|
|
|
if version.parse(installed_version) > version.parse(required_version):
|
|
pytest.skip(
|
|
f"{package_name} version {installed_version} is greater than required {required_version}"
|
|
)
|