From 6a66833235fad3ee9cbde3f75d4f3ce73ace04c6 Mon Sep 17 00:00:00 2001 From: Dheeraj Peri Date: Tue, 8 Jul 2025 15:18:15 -0700 Subject: [PATCH 1/4] chore: move external dep installation into a separate script --- .github/scripts/install-external-deps.sh | 24 +++++++++++++++++++++++ .github/scripts/install-torch-tensorrt.sh | 13 ++---------- 2 files changed, 26 insertions(+), 11 deletions(-) create mode 100644 .github/scripts/install-external-deps.sh diff --git a/.github/scripts/install-external-deps.sh b/.github/scripts/install-external-deps.sh new file mode 100644 index 0000000000..e9cc0d1ac7 --- /dev/null +++ b/.github/scripts/install-external-deps.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# This script installs all the external dependencies required for Torch-TensorRT +# It defines the required variables and installs the dependencies + +set -x + +# Set default values for CHANNEL and CU_VERSION if not defined +CHANNEL=${CHANNEL:-nightly} +CU_VERSION=${CU_VERSION:-cu129} + +# Define variables for torch and torchvision versions +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} + +# 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 +# eg. timm will install the latest torchvision, however we want to use the torchvision from nightly +# 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} +pip install --force-reinstall --pre ${TORCH} --index-url ${INDEX_URL} \ No newline at end of file diff --git a/.github/scripts/install-torch-tensorrt.sh b/.github/scripts/install-torch-tensorrt.sh index 94de5f022a..e5aeea297e 100755 --- a/.github/scripts/install-torch-tensorrt.sh +++ b/.github/scripts/install-torch-tensorrt.sh @@ -1,9 +1,6 @@ #set -exou pipefail 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)") if [[ $(uname -m) == "aarch64" ]]; then @@ -12,14 +9,8 @@ if [[ $(uname -m) == "aarch64" ]]; then install_cuda_aarch64 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 -# 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 -pip uninstall -y torch torchvision -pip install --force-reinstall --pre ${TORCHVISION} --index-url ${INDEX_URL} -pip install --force-reinstall --pre ${TORCH} --index-url ${INDEX_URL} +# Install all the external dependencies required for Torch-TensorRT +source .github/scripts/install-external-deps.sh # Install Torch-TensorRT From 9ebcf433a167c2f480305523c56df32cd757a3d0 Mon Sep 17 00:00:00 2001 From: Dheeraj Peri Date: Tue, 8 Jul 2025 15:49:12 -0700 Subject: [PATCH 2/4] chore: upgrade torchvision --- tests/py/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/py/requirements.txt b/tests/py/requirements.txt index b806a668db..5ab7689dec 100644 --- a/tests/py/requirements.txt +++ b/tests/py/requirements.txt @@ -14,5 +14,5 @@ nvidia-modelopt[all]; python_version >'3.9' and python_version <'3.13' # 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/cu129 -torchvision>=0.23.0.dev,<0.24.0 +torchvision>=0.24.0.dev,<0.25.0 timm>=1.0.3 \ No newline at end of file From 1d298343ae2372b6d9567337fd5b4f7e0641004c Mon Sep 17 00:00:00 2001 From: Dheeraj Peri Date: Tue, 8 Jul 2025 16:05:28 -0700 Subject: [PATCH 3/4] chore: address review comments --- .github/scripts/install-external-deps.sh | 24 ----------------------- .github/scripts/install-torch-tensorrt.sh | 4 ++-- 2 files changed, 2 insertions(+), 26 deletions(-) delete mode 100644 .github/scripts/install-external-deps.sh diff --git a/.github/scripts/install-external-deps.sh b/.github/scripts/install-external-deps.sh deleted file mode 100644 index e9cc0d1ac7..0000000000 --- a/.github/scripts/install-external-deps.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# This script installs all the external dependencies required for Torch-TensorRT -# It defines the required variables and installs the dependencies - -set -x - -# Set default values for CHANNEL and CU_VERSION if not defined -CHANNEL=${CHANNEL:-nightly} -CU_VERSION=${CU_VERSION:-cu129} - -# Define variables for torch and torchvision versions -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} - -# 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 -# eg. timm will install the latest torchvision, however we want to use the torchvision from nightly -# 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} -pip install --force-reinstall --pre ${TORCH} --index-url ${INDEX_URL} \ No newline at end of file diff --git a/.github/scripts/install-torch-tensorrt.sh b/.github/scripts/install-torch-tensorrt.sh index e5aeea297e..4e51f2c43f 100755 --- a/.github/scripts/install-torch-tensorrt.sh +++ b/.github/scripts/install-torch-tensorrt.sh @@ -9,8 +9,8 @@ if [[ $(uname -m) == "aarch64" ]]; then install_cuda_aarch64 fi -# Install all the external dependencies required for Torch-TensorRT -source .github/scripts/install-external-deps.sh +# Install all the external dependencies required for testing Torch-TensorRT in CI +source .github/scripts/install-test-deps.sh # Install Torch-TensorRT From 75e65d559b90606a316025a802fd848f63fc5f84 Mon Sep 17 00:00:00 2001 From: Dheeraj Peri Date: Thu, 10 Jul 2025 22:55:33 +0000 Subject: [PATCH 4/4] chore: add test deps file --- .github/scripts/install-test-deps.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/scripts/install-test-deps.sh diff --git a/.github/scripts/install-test-deps.sh b/.github/scripts/install-test-deps.sh new file mode 100644 index 0000000000..cf34aab07a --- /dev/null +++ b/.github/scripts/install-test-deps.sh @@ -0,0 +1,19 @@ +#set -exou pipefail +set -x +# Set default values for CHANNEL and CU_VERSION if not already set +CHANNEL=${CHANNEL:-nightly} +CU_VERSION=${CU_VERSION:-cu129} + +PLATFORM=$(python -c "import sys; print(sys.platform)") +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} + +# 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 +# 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 +pip uninstall -y torch torchvision +pip install --force-reinstall --pre ${TORCHVISION} --index-url ${INDEX_URL} +pip install --force-reinstall --pre ${TORCH} --index-url ${INDEX_URL}