Skip to content

chore: move external dep installation into a separate script #3672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/scripts/install-test-deps.sh
Original file line number Diff line number Diff line change
@@ -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}
13 changes: 2 additions & 11 deletions .github/scripts/install-torch-tensorrt.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 testing Torch-TensorRT in CI
source .github/scripts/install-test-deps.sh


# Install Torch-TensorRT
Expand Down
2 changes: 1 addition & 1 deletion tests/py/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading