Skip to content

Commit 3e7be44

Browse files
fix tensorrt dependencies issue (#3105)
1 parent 51ccbea commit 3e7be44

File tree

6 files changed

+20
-14
lines changed

6 files changed

+20
-14
lines changed

examples/dynamo/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
cupy==13.1.0
2-
tensorrt==10.1.0
32
torch>=2.4.0.dev20240503+cu121
43
torch-tensorrt>=2.4.0.dev20240503+cu121
54
triton==2.3.0

packaging/pre_build_script.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,18 @@ INDEX_URL=https://download.pytorch.org/whl/${CHANNEL}/${CU_VERSION}
1717
# Install all the dependencies required for Torch-TensorRT
1818
pip uninstall -y torch torchvision
1919
pip install --force-reinstall --pre ${TORCH_TORCHVISION} --index-url ${INDEX_URL}
20-
pip install --pre -r tests/py/requirements.txt --use-deprecated legacy-resolver
21-
2220

2321
export TORCH_BUILD_NUMBER=$(python -c "import torch, urllib.parse as ul; print(ul.quote_plus(torch.__version__))")
2422
export TORCH_INSTALL_PATH=$(python -c "import torch, os; print(os.path.dirname(torch.__file__))")
2523

24+
if [[ "${CU_VERSION::4}" < "cu12" ]]; then
25+
# replace dependencies from tensorrt-cu12-bindings/libs to tensorrt-cu11-bindings/libs
26+
sed -i -e "s/tensorrt-cu12==/tensorrt-${CU_VERSION::4}==/g" \
27+
-e "s/tensorrt-cu12-bindings==/tensorrt-${CU_VERSION::4}-bindings==/g" \
28+
-e "s/tensorrt-cu12-libs==/tensorrt-${CU_VERSION::4}-libs==/g" \
29+
pyproject.toml
30+
fi
31+
2632
cat toolchains/ci_workspaces/MODULE.bazel.tmpl | envsubst > MODULE.bazel
2733

2834
cat MODULE.bazel

packaging/pre_build_script_windows.sh

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@ set -exou pipefail
22

33
pip install -U numpy packaging pyyaml setuptools wheel
44

5-
# Install TRT from PyPI
6-
TRT_VERSION=$(python -c "import yaml; print(yaml.safe_load(open('dev_dep_versions.yml', 'r'))['__tensorrt_version__'])")
7-
pip install tensorrt==${TRT_VERSION} tensorrt-${CU_VERSION::4}-bindings==${TRT_VERSION} tensorrt-${CU_VERSION::4}-libs==${TRT_VERSION} --extra-index-url https://pypi.nvidia.com
8-
95
choco install bazelisk -y
106

7+
if [[ "${CU_VERSION::4}" < "cu12" ]]; then
8+
# replace dependencies from tensorrt-cu12-bindings/libs to tensorrt-cu11-bindings/libs
9+
sed -i -e "s/tensorrt-cu12==/tensorrt-${CU_VERSION::4}==/g" \
10+
-e "s/tensorrt-cu12-bindings==/tensorrt-${CU_VERSION::4}-bindings==/g" \
11+
-e "s/tensorrt-cu12-libs==/tensorrt-${CU_VERSION::4}-libs==/g" \
12+
pyproject.toml
13+
fi
14+
1115
#curl -Lo TensorRT.zip https://developer.download.nvidia.com/compute/machine-learning/tensorrt/10.0.1/zip/TensorRT-10.0.1.6.Windows10.win10.cuda-12.4.zip
1216
#unzip -o TensorRT.zip -d C:/
1317
TORCH_TORCHVISION=$(grep "^torch" py/requirements.txt)
@@ -16,7 +20,6 @@ INDEX_URL=https://download.pytorch.org/whl/${CHANNEL}/${CU_VERSION}
1620
# Install all the dependencies required for Torch-TensorRT
1721
pip uninstall -y torch torchvision
1822
pip install --force-reinstall --pre ${TORCH_TORCHVISION} --index-url ${INDEX_URL}
19-
pip install --pre -r tests/py/requirements.txt --use-deprecated legacy-resolver
2023

2124
export CUDA_HOME="$(echo ${CUDA_PATH} | sed -e 's#\\#\/#g')"
2225
export TORCH_INSTALL_PATH="$(python -c "import torch, os; print(os.path.dirname(torch.__file__))" | sed -e 's#\\#\/#g')"

py/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,3 @@ torch>=2.5.0.dev,<2.6.0
66
torchvision>=0.20.0.dev,<0.21.0
77
--extra-index-url https://pypi.ngc.nvidia.com
88
pyyaml
9-
tensorrt==10.1.0

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ requires = [
88
"cffi>=1.15.1",
99
"typing-extensions>=4.7.0",
1010
"future>=0.18.3",
11-
"tensorrt==10.1.0",
11+
"tensorrt-cu12==10.1.0",
1212
"torch >=2.5.0.dev,<2.6.0",
1313
"pybind11==2.6.2",
1414
"numpy",
@@ -55,9 +55,9 @@ keywords = [
5555
]
5656
dependencies = [
5757
"torch >=2.5.0.dev,<2.6.0",
58-
"tensorrt==10.1.0",
59-
"tensorrt-cu12_bindings==10.1.0",
60-
"tensorrt-cu12_libs==10.1.0",
58+
"tensorrt-cu12==10.1.0",
59+
"tensorrt-cu12-bindings==10.1.0",
60+
"tensorrt-cu12-libs==10.1.0",
6161
"packaging>=23",
6262
"numpy",
6363
"typing-extensions>=4.7.0",

tests/py/requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ parameterized>=0.2.0
77
pytest>=8.2.1
88
pytest-xdist>=3.6.1
99
pyyaml
10-
tensorrt==10.1.0
1110
timm>=1.0.3
1211
transformers==4.40.2
1312
--extra-index-url https://pypi.nvidia.com

0 commit comments

Comments
 (0)