mirror of
https://github.com/NVIDIA/Model-Optimizer.git
synced 2026-10-02 03:14:52 +08:00
- Transformers upper bound bumped from `<5.8` to `<5.10` - Enable torch 2.12 CICD testing - Bump TRT-LLM container to `1.3.0rc16` (transformers 5.5) - Use pytorch and tensorrt 26.04 containers in CICD <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated CI test container images and targeted Torch version across workflows; adjusted release CI job to use the newer torch config. * Broadened Transformers constraint in project metadata and test/dev pins. * Removed strict transformers pins from example requirements and lifted a compression dependency cap. * Raised the import-time Transformers version threshold for compatibility warnings. * **Tests** * Refactored a GPU test to collect and report validation errors and updated numeric expected baselines. <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/NVIDIA/Model-Optimizer/pull/1554?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Keval Morabia <28916987+kevalmorabia97@users.noreply.github.com>
62 lines
2.0 KiB
Python
62 lines
2.0 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.
|
|
|
|
"""Model optimization and deployment subpackage for torch."""
|
|
|
|
import importlib
|
|
import warnings as _warnings
|
|
|
|
from packaging.version import Version as _Version
|
|
from torch import __version__ as _torch_version
|
|
|
|
# Pre-initialize torch._dynamo to prevent double-registration with peft's torch.compile() call
|
|
importlib.import_module("torch._dynamo")
|
|
from . import ( # noqa: E402
|
|
distill,
|
|
nas,
|
|
opt,
|
|
peft,
|
|
prune,
|
|
quantization,
|
|
sparsity,
|
|
speculative,
|
|
utils,
|
|
)
|
|
|
|
if _Version(_torch_version) < _Version("2.9"):
|
|
_warnings.warn(
|
|
"nvidia-modelopt will drop torch<2.9 support in a future release.", DeprecationWarning
|
|
)
|
|
|
|
|
|
try:
|
|
from transformers import __version__ as _transformers_version
|
|
|
|
if _Version(_transformers_version) < _Version("4.56") or _Version(
|
|
_transformers_version
|
|
) >= _Version("5.10"):
|
|
_warnings.warn(
|
|
f"transformers {_transformers_version} is not tested with current version of modelopt and may cause issues."
|
|
" Please install recommended version with `pip install -U nvidia-modelopt[hf]` if working with HF models.",
|
|
)
|
|
except ImportError:
|
|
pass
|
|
|
|
# Initialize modelopt_internal if available
|
|
with utils.import_plugin(
|
|
"modelopt_internal", success_msg="modelopt_internal successfully initialized", verbose=True
|
|
):
|
|
import modelopt_internal
|