Skip to content

Commit 9dc646d

Browse files
committed
fix: Refactor Docker Torch version to auto-sync
- Build issue encountered in Docker arising from mismatched versions in WORKSPACE and Docker folder - Update Dockerfile build process to adapt Torch version from `requirements.txt` - Remove references to Torch version in Docker `WORKSPACE` file; instead use local Torch version
1 parent 97209fe commit 9dc646d

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

docker/Dockerfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ RUN ln -s /usr/bin/python3.8 /usr/bin/python
1212
RUN python get-pip.py
1313
RUN pip3 install wheel
1414

15-
# Install Pytorch
16-
RUN pip3 install torch==2.0.0.dev20230103+cu117 torchvision==0.15.0.dev20230103+cu117 --extra-index-url https://download.pytorch.org/whl/nightly/cu117
17-
1815
# Install CUDNN + TensorRT
1916
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
2017
RUN mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
@@ -64,6 +61,7 @@ COPY . /opt/torch_tensorrt
6461
COPY --from=torch-tensorrt-builder /workspace/torch_tensorrt/src/py/dist/ .
6562

6663
RUN cp /opt/torch_tensorrt/docker/WORKSPACE.docker /opt/torch_tensorrt/WORKSPACE
64+
RUN pip install -r /opt/torch_tensorrt/py/requirements.txt
6765
RUN pip3 install *.whl && rm -fr /workspace/torch_tensorrt/py/dist/* *.whl
6866

6967
# Install native tensorrt python package required by torch_tensorrt whl file

docker/WORKSPACE.docker

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,16 @@ new_local_repository(
4848
# Tarballs and fetched dependencies (default - use in cases when building from precompiled bin and tarballs)
4949
#############################################################################################################
5050

51-
http_archive(
51+
new_local_repository(
5252
name = "libtorch",
53-
build_file = "@//third_party/libtorch:BUILD",
54-
sha256 = "59b8b5e1954a86d50b79c13f06398d385b200da13e37a08ecf31d3c62e5ca127",
55-
strip_prefix = "libtorch",
56-
urls = ["https://download.pytorch.org/libtorch/nightly/cu117/libtorch-cxx11-abi-shared-with-deps-2.0.0.dev20230103%2Bcu117.zip"],
53+
path = "/usr/local/lib/python3.8/dist-packages/torch/",
54+
build_file = "third_party/libtorch/BUILD"
5755
)
5856

59-
http_archive(
57+
new_local_repository(
6058
name = "libtorch_pre_cxx11_abi",
61-
build_file = "@//third_party/libtorch:BUILD",
62-
sha256 = "e260fc7476be89d1650953e8643e9f7363845f5a52de4bab87ac0e619c1f6ad4",
63-
strip_prefix = "libtorch",
64-
urls = ["https://download.pytorch.org/libtorch/nightly/cu117/libtorch-shared-with-deps-2.0.0.dev20230103%2Bcu117.zip"],
59+
path = "/usr/local/lib/python3.8/dist-packages/torch/",
60+
build_file = "third_party/libtorch/BUILD"
6561
)
6662

6763
####################################################################################

0 commit comments

Comments
 (0)