Skip to content

Commit

Permalink
chore: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
peri044 committed May 30, 2024
2 parents 9aab410 + 1e272b4 commit 5f9753f
Show file tree
Hide file tree
Showing 148 changed files with 612 additions and 481 deletions.
18 changes: 8 additions & 10 deletions .github/scripts/install-torch-tensorrt-windows.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/usr/bin/env bash
set -eou pipefail
source "${BUILD_ENV_FILE}"
# Source conda so it's available to the script environment
source ${BUILD_ENV_FILE}
export EXTRA_INDEX_URL="https://download.pytorch.org/whl/nightly/${CU_VERSION}"

# Install test index version of Torch and Torchvision
${CONDA_RUN} ${PIP_INSTALL_TORCH} torchvision
${CONDA_RUN} pip install pyyaml mpmath==1.3.0
# Install all the dependencies required for Torch-TensorRT
${CONDA_RUN} pip install --pre -r ${PWD}/tests/py/requirements.txt --use-deprecated=legacy-resolver --extra-index-url=${EXTRA_INDEX_URL}

# Install TRT from PyPi
TRT_VERSION=$(${CONDA_RUN} python -c "import yaml; print(yaml.safe_load(open('dev_dep_versions.yml', 'r'))['__tensorrt_version__'])")
${CONDA_RUN} pip install tensorrt==${TRT_VERSION} tensorrt-${CU_VERSION::4}==${TRT_VERSION} tensorrt-${CU_VERSION::4}-bindings==${TRT_VERSION} tensorrt-${CU_VERSION::4}-libs==${TRT_VERSION} --extra-index-url https://pypi.nvidia.com

# Install pre-built Torch-TRT
# Install Torch-TensorRT
${CONDA_RUN} pip install ${RUNNER_ARTIFACT_DIR}/torch_tensorrt*.whl

echo -e "Running test script";
echo -e "Running test script";
14 changes: 5 additions & 9 deletions .github/scripts/install-torch-tensorrt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@
set -eou pipefail
# Source conda so it's available to the script environment
source ${BUILD_ENV_FILE}
${CONDA_RUN} ${PIP_INSTALL_TORCH} torchvision
${CONDA_RUN} python -m pip install pyyaml mpmath==1.3.0
export TRT_VERSION=$(${CONDA_RUN} python -c "import versions; versions.tensorrt_version()")
export EXTRA_INDEX_URL="https://download.pytorch.org/whl/nightly/${CU_VERSION}"

# Install TensorRT manually
wget -q -P /opt/torch-tensorrt-builds/ https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/10.0.1/tars/TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar.gz
tar -xzf /opt/torch-tensorrt-builds/TensorRT-10.0.1.6.Linux.x86_64-gnu.cuda-12.4.tar.gz -C /opt/torch-tensorrt-builds/
python -m pip install /opt/torch-tensorrt-builds/TensorRT-10.0.1.6/python/tensorrt-10.0.1-cp${PYTHON_VERSION//./}-none-linux_x86_64.whl
# Install all the dependencies required for Torch-TensorRT
${CONDA_RUN} pip install --pre -r ${PWD}/tests/py/requirements.txt --use-deprecated=legacy-resolver --extra-index-url=${EXTRA_INDEX_URL}

# Install Torch-TensorRT
${CONDA_RUN} python -m pip install /opt/torch-tensorrt-builds/torch_tensorrt*+${CU_VERSION}*.whl
${CONDA_RUN} pip install /opt/torch-tensorrt-builds/torch_tensorrt*.whl

echo -e "Running test script";
echo -e "Running test script";
7 changes: 0 additions & 7 deletions .github/workflows/build-test-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ jobs:
export LD_LIBRARY_PATH=/usr/lib64:$LD_LIBRARY_PATH
pushd .
cd tests/modules
${CONDA_RUN} python -m pip install --pre -r ../py/requirements.txt --use-deprecated=legacy-resolver
${CONDA_RUN} python hub.py
popd
pushd .
Expand Down Expand Up @@ -113,7 +112,6 @@ jobs:
export USE_HOST_DEPS=1
pushd .
cd tests/py/dynamo
${CONDA_RUN} python -m pip install --pre -r ../requirements.txt --use-deprecated=legacy-resolver
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_converters_test_results.xml -n 10 conversion/
popd
Expand Down Expand Up @@ -141,7 +139,6 @@ jobs:
export USE_HOST_DEPS=1
pushd .
cd tests/py/dynamo
${CONDA_RUN} python -m pip install --pre -r ../requirements.txt --use-deprecated=legacy-resolver
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_fe_test_results.xml --ir dynamo models/test_models_export.py
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/dyn_models_export.xml --ir dynamo models/test_dyn_models.py
popd
Expand Down Expand Up @@ -170,7 +167,6 @@ jobs:
export USE_HOST_DEPS=1
pushd .
cd tests/py/dynamo
${CONDA_RUN} python -m pip install --pre -r ../requirements.txt --use-deprecated=legacy-resolver
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/export_serde_test_results.xml --ir dynamo models/test_export_serde.py
popd
Expand Down Expand Up @@ -198,7 +194,6 @@ jobs:
export USE_HOST_DEPS=1
pushd .
cd tests/py/dynamo
${CONDA_RUN} python -m pip install --pre -r ../requirements.txt --use-deprecated=legacy-resolver
${CONDA_RUN} python -m pytest -n 10 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_be_test_results.xml backend/
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_comple_be_e2e_test_results.xml --ir torch_compile models/test_models.py
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_dyn_models_export.xml --ir torch_compile models/test_dyn_models.py
Expand Down Expand Up @@ -228,7 +223,6 @@ jobs:
export USE_HOST_DEPS=1
pushd .
cd tests/py/dynamo
${CONDA_RUN} python -m pip install --pre -r ../requirements.txt --use-deprecated=legacy-resolver
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_runtime_test_results.xml runtime/
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_partitioning_test_results.xml partitioning/
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_lowering_test_results.xml lowering/
Expand Down Expand Up @@ -257,6 +251,5 @@ jobs:
export USE_HOST_DEPS=1
pushd .
cd tests/py/core
${CONDA_RUN} python -m pip install --pre -r ../requirements.txt --use-deprecated=legacy-resolver
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_core_test_results.xml .
popd
4 changes: 0 additions & 4 deletions .github/workflows/build-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ jobs:
export USE_HOST_DEPS=1
pushd .
cd tests/py/dynamo
${CONDA_RUN} python -m pip install --pre -r ../requirements.txt --use-deprecated=legacy-resolver
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_converters_test_results.xml -n 10 conversion/
popd
Expand All @@ -98,7 +97,6 @@ jobs:
export USE_HOST_DEPS=1
pushd .
cd tests/py/dynamo
${CONDA_RUN} python -m pip install --pre -r ../requirements.txt --use-deprecated=legacy-resolver
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_fe_test_results.xml --ir dynamo models/test_models_export.py
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/dyn_models_export.xml --ir dynamo models/test_dyn_models.py
popd
Expand All @@ -125,7 +123,6 @@ jobs:
export USE_HOST_DEPS=1
pushd .
cd tests/py/dynamo
${CONDA_RUN} python -m pip install --pre -r ../requirements.txt --use-deprecated=legacy-resolver
${CONDA_RUN} python -m pytest -n 10 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_be_test_results.xml backend/
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_comple_be_e2e_test_results.xml --ir torch_compile models/test_models.py
popd
Expand All @@ -152,7 +149,6 @@ jobs:
export USE_HOST_DEPS=1
pushd .
cd tests/py/dynamo
${CONDA_RUN} python -m pip install --pre -r ../requirements.txt --use-deprecated=legacy-resolver
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_runtime_test_results.xml runtime/
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_partitioning_test_results.xml partitioning/
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_lowering_test_results.xml lowering/
Expand Down
9 changes: 1 addition & 8 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,10 @@ RUN pyenv install -v ${PYTHON_VERSION}
RUN pyenv global ${PYTHON_VERSION}

# Install TensorRT + dependencies
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-ubuntu2204.pin
RUN mv cuda-ubuntu2204.pin /etc/apt/preferences.d/cuda-repository-pin-600
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/7fa2af80.pub
RUN add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /"
RUN apt-get update

RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/3bf863cc.pub
RUN add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/ /"
RUN apt-get update

RUN apt-get install -y libnvinfer8=${TENSORRT_VERSION}.* libnvinfer-plugin8=${TENSORRT_VERSION}.* libnvinfer-dev=${TENSORRT_VERSION}.* libnvinfer-plugin-dev=${TENSORRT_VERSION}.* libnvonnxparsers8=${TENSORRT_VERSION}.* libnvonnxparsers-dev=${TENSORRT_VERSION}.* libnvparsers8=${TENSORRT_VERSION}.* libnvparsers-dev=${TENSORRT_VERSION}.* libnvinfer-headers-dev=${TENSORRT_VERSION}.* libnvinfer-headers-plugin-dev=${TENSORRT_VERSION}.*
RUN TENSORRT_MAJOR_VERSION=`echo ${TENSORRT_VERSION} | cut -d '.' -f 1` && apt-get install -y libnvinfer${TENSORRT_MAJOR_VERSION}=${TENSORRT_VERSION}.* libnvinfer-plugin${TENSORRT_MAJOR_VERSION}=${TENSORRT_VERSION}.* libnvinfer-dev=${TENSORRT_VERSION}.* libnvinfer-plugin-dev=${TENSORRT_VERSION}.* libnvonnxparsers${TENSORRT_MAJOR_VERSION}=${TENSORRT_VERSION}.* libnvonnxparsers-dev=${TENSORRT_VERSION}.*

# Setup Bazel via Bazelisk
RUN wget -q https://github.com/bazelbuild/bazelisk/releases/download/v1.17.0/bazelisk-linux-amd64 -O /usr/bin/bazel &&\
Expand Down
6 changes: 3 additions & 3 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Use `Dockerfile` to build a container which provides the exact development environment that our master branch is usually tested against.

* The `Dockerfile` currently uses <a href="https://github.com/bazelbuild/bazelisk">Bazelisk</a> to select the Bazel version, and uses the exact library versions of Torch and CUDA listed in <a href="https://github.com/pytorch/TensorRT#dependencies">dependencies</a>.
* The desired version of TensorRT must be specified as build-args, with major and minor versions as in: `--build-arg TENSORRT_VERSION=a.b`
* The desired versions of TensorRT must be specified as build-args, with major and minor versions as in: `--build-arg TENSORRT_VERSION=a.b`
* [**Optional**] The desired base image be changed by explicitly setting a base image, as in `--build-arg BASE_IMG=nvidia/cuda:11.8.0-devel-ubuntu22.04`, though this is optional
* [**Optional**] Additionally, the desired Python version can be changed by explicitly setting a version, as in `--build-arg PYTHON_VERSION=3.10`, though this is optional as well.

Expand All @@ -17,14 +17,14 @@ Note: By default the container uses the `pre-cxx11-abi` version of Torch + Torch

### Instructions

- The example below uses TensorRT 8.6
- The example below uses TensorRT 10.0.1.6
- See <a href="https://github.com/pytorch/TensorRT#dependencies">dependencies</a> for a list of current default dependencies.

> From root of Torch-TensorRT repo
Build:
```
DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=8.6 -f docker/Dockerfile -t torch_tensorrt:latest .
DOCKER_BUILDKIT=1 docker build --build-arg TENSORRT_VERSION=10.0.1 -f docker/Dockerfile -t torch_tensorrt:latest .
```

Run:
Expand Down
4 changes: 2 additions & 2 deletions docs/_cpp_api/classtorch__tensorrt_1_1DataType.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Class DataType &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Class DataType &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Class Device::DeviceType &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Class Device::DeviceType &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
4 changes: 2 additions & 2 deletions docs/_cpp_api/classtorch__tensorrt_1_1TensorFormat.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Class TensorFormat &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Class TensorFormat &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Template Class Int8CacheCalibrator &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Template Class Int8CacheCalibrator &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Template Class Int8Calibrator &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Template Class Int8Calibrator &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Define STR &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Define STR &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Define TORCH_TENSORRT_PATCH_VERSION &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Define TORCH_TENSORRT_PATCH_VERSION &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Define TORCH_TENSORRT_MAJOR_VERSION &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Define TORCH_TENSORRT_MAJOR_VERSION &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Define TORCH_TENSORRT_MINOR_VERSION &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Define TORCH_TENSORRT_MINOR_VERSION &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Define TORCHTRT_API &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Define TORCHTRT_API &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Define XSTR &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Define XSTR &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>Define TORCHTRT_HIDDEN &mdash; Torch-TensorRT v2.4.0.dev0+779d8d6 documentation</title>
<title>Define TORCHTRT_HIDDEN &mdash; Torch-TensorRT v2.4.0.dev0+7ec1060 documentation</title>



Expand Down Expand Up @@ -275,7 +275,7 @@


<div class="version">
v2.4.0.dev0+779d8d6
v2.4.0.dev0+7ec1060
</div>


Expand Down
Loading

0 comments on commit 5f9753f

Please sign in to comment.