diff --git a/.github/scripts/install-torch-tensorrt.sh b/.github/scripts/install-torch-tensorrt.sh index b184d683d0..fe03b0bd58 100755 --- a/.github/scripts/install-torch-tensorrt.sh +++ b/.github/scripts/install-torch-tensorrt.sh @@ -2,7 +2,6 @@ set -x TORCH=$(grep "^torch>" ${PWD}/py/requirements.txt) -TORCHVISION=$(grep "^torchvision>" ${PWD}/tests/py/requirements.txt) INDEX_URL=https://download.pytorch.org/whl/${CHANNEL}/${CU_VERSION} PLATFORM=$(python -c "import sys; print(sys.platform)") @@ -13,10 +12,34 @@ if [[ $(uname -m) == "aarch64" ]]; then fi # Install all the dependencies required for Torch-TensorRT -pip install --pre -r ${PWD}/tests/py/requirements.txt -# dependencies in the tests/py/requirements.txt might install a different version of torch or torchvision +pip install --upgrade "pip>=25.1" "tomli>=1.1.0; python_version < '3.11'" +pip install \ + --pre \ + --extra-index-url https://pypi.nvidia.com \ + --extra-index-url https://download.pytorch.org/whl/nightly/cu130 \ + --group test \ + --group test-ext \ + --group quantization +TORCHVISION=$(python - <<'PY' +try: + import tomllib +except ModuleNotFoundError: + import tomli as tomllib + +with open("pyproject.toml", "rb") as f: + deps = tomllib.load(f)["dependency-groups"]["test-ext"] + +for dep in deps: + if dep.startswith("torchvision"): + print(dep) + break +else: + raise SystemExit("torchvision was not found in dependency group test-ext") +PY +) +# test dependencies might install a different version of torch or torchvision # eg. timm will install the latest torchvision, however we want to use the torchvision from nightly -# reinstall torch torchvisionto make sure we have the correct version +# reinstall torch torchvision to make sure we have the correct version pip uninstall -y torch torchvision pip install --force-reinstall --pre ${TORCHVISION} --index-url ${INDEX_URL} --extra-index-url https://pypi.org/simple pip install --force-reinstall --pre ${TORCH} --index-url ${INDEX_URL} --extra-index-url https://pypi.org/simple diff --git a/docsrc/RELEASE_CHECKLIST.md b/docsrc/RELEASE_CHECKLIST.md index aae506164f..7321eba86a 100644 --- a/docsrc/RELEASE_CHECKLIST.md +++ b/docsrc/RELEASE_CHECKLIST.md @@ -24,7 +24,7 @@ will result in a minor version bump and significant bug fixes will result in a p 4. Version bump PR - There should be a PR which will be the PR that bumps the actual version of the library, this PR should contain the following - Bump version in `py/setup.py` - - Make sure dependency versions are updated in `py/requirements.txt`, `tests/py/requirements.txt` and `py/setup.py` + - Make sure dependency versions are updated in `py/requirements.txt`, `pyproject.toml` dependency groups, and `py/setup.py` - Bump version in `cpp/include/macros.h` - Add new link to doc versions in `docsrc/conf.py` - Generate frozen docs for new version diff --git a/noxfile.py b/noxfile.py index b86a88be75..e6d2b62828 100644 --- a/noxfile.py +++ b/noxfile.py @@ -39,7 +39,23 @@ def install_deps(session): print("Installing deps") session.install("-r", os.path.join(TOP_DIR, "py", "requirements.txt")) - session.install("-r", os.path.join(TOP_DIR, "tests", "py", "requirements.txt")) + session.install( + "--upgrade", + "pip>=25.1", + ) + session.install( + "--pre", + "--extra-index-url", + "https://pypi.nvidia.com", + "--extra-index-url", + "https://download.pytorch.org/whl/nightly/cu130", + "--group", + "test", + "--group", + "test-ext", + "--group", + "quantization", + ) def download_models(session): diff --git a/pyproject.toml b/pyproject.toml index 041c2288d1..d08684f81a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -76,11 +76,15 @@ debug = [ ] test = [ - "pytest", - "pytest-xdist", - "pytest-forked>=1.6.0", - "parameterized>=0.2.0", "expecttest==0.1.6", + "networkx", + "numpy", + "parameterized>=0.2.0", + "pytest>=8.2.1", + "pytest-forked>=1.6.0", + "pytest-xdist>=3.6.1", + "pyyaml", + "setuptools", ] test-ext = [ @@ -88,7 +92,6 @@ test-ext = [ "transformers>=5.0.0", "torchvision>=0.27.0.dev,<0.28.0", "flashinfer-python; python_version >'3.9' and python_version <'3.13'", - #"nvidia-modelopt[hf]@git+https://github.com/NVIDIA/Model-Optimizer.git; python_version >'3.10' and python_version <'3.14'" ] docs = [ @@ -102,7 +105,9 @@ docs = [ "pillow", ] -quantization = ["nvidia-modelopt[hf]>=0.43.0"] +quantization = [ + "nvidia-modelopt[hf]>=0.43.0; python_version > '3.9' and python_version < '3.13'", +] [project.urls] Homepage = "https://pytorch.org/tensorrt" diff --git a/tests/py/requirements.txt b/tests/py/requirements.txt index 8d0f9a2e5d..fe6bff6f03 100644 --- a/tests/py/requirements.txt +++ b/tests/py/requirements.txt @@ -1,19 +1,2 @@ -# This file is specifically to install correct version of libraries during CI testing. -# networkx library issue: https://discuss.pytorch.org/t/installing-pytorch-under-python-3-8-question-about-networkx-version/196740 -expecttest -networkx -numpy -setuptools -parameterized>=0.2.0 -pytest>=8.2.1 -pytest-xdist>=3.6.1 -pyyaml -transformers==4.53.1 -nvidia-modelopt[all]; python_version >'3.9' and python_version <'3.13' ---extra-index-url https://pypi.nvidia.com -# flashinfer-python is not supported for python version 3.13 or higher -# flashinfer-python is broken on python 3.9 at the moment, so skip it for now -flashinfer-python; python_version >'3.9' and python_version <'3.13' ---extra-index-url https://download.pytorch.org/whl/nightly/cu130 -torchvision>=0.27.0.dev,<0.28.0 -timm>=1.0.3 \ No newline at end of file +# Compatibility stub for tooling that still expects this file to exist. +# Shared test dependencies live in pyproject.toml dependency groups.