Skip to content

Commit

Permalink
Merge pull request #11 from anarkiwi/dep
Browse files Browse the repository at this point in the history
Speed up dynamic model dependency installation by pre-installing comm…
  • Loading branch information
anarkiwi authored Dec 13, 2023
2 parents e31c535 + 46a7a60 commit de8efd8
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 8 deletions.
2 changes: 2 additions & 0 deletions docker/Dockerfile.cuda-torchserve
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM nvidia/cuda:11.8.0-runtime-ubuntu22.04
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /root
COPY torchserve/clone-torchserve.sh /torchserve/clone-torchserve.sh
COPY torchserve/install-common.sh /torchserve/install-common.sh
COPY torchserve/install-torchserve.sh /torchserve/install-torchserve.sh
RUN --mount=type=cache,target=/root/.cache /torchserve/install-torchserve.sh --cuda cu118
RUN /usr/local/bin/torchserve --help
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile.orin-torchserve
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM nvcr.io/nvidia/l4t-pytorch:r35.2.1-pth2.0-py3
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /root
COPY torchserve/clone-torchserve.sh /torchserve/clone-torchserve.sh
COPY torchserve/install-common.sh /torchserve/install-common.sh
COPY torchserve/install-orin-torchserve.sh /torchserve/install-orin-torchserve.sh
RUN --mount=type=cache,target=/root/.cache /torchserve/install-orin-torchserve.sh
RUN /usr/local/bin/torchserve --help
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile.rocm-torchserve
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM rocm/pytorch:latest
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /root
COPY torchserve/clone-torchserve.sh /torchserve/clone-torchserve.sh
COPY torchserve/install-common.sh /torchserve/install-common.sh
COPY torchserve/install-rocm-torchserve.sh /torchserve/install-rocm-torchserve.sh
RUN --mount=type=cache,target=/root/.cache /torchserve/install-rocm-torchserve.sh
RUN torchserve --help
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile.torchserve
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
FROM ubuntu:22.04
ENV DEBIAN_FRONTEND=noninteractive
WORKDIR /root
COPY torchserve/clone-torchserve.sh /torchserve/clone-torchserve.sh
COPY torchserve/install-common.sh /torchserve/install-common.sh
COPY torchserve/install-torchserve.sh /torchserve/install-torchserve.sh
RUN --mount=type=cache,target=/root/.cache /torchserve/install-torchserve.sh
RUN /usr/local/bin/torchserve --help
Expand Down
2 changes: 2 additions & 0 deletions torchserve/clone-torchserve.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
git clone https://github.com/pytorch/serve -b v0.9.0
2 changes: 2 additions & 0 deletions torchserve/install-common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
pip install opencv-python pandas py-cpuinfo scipy seaborn thop
5 changes: 3 additions & 2 deletions torchserve/install-orin-torchserve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ apt-get update && \
pip install "opencv-python<4.8.0.76" && \
echo /usr/local/lib/python3.8/dist-packages/opencv_python.libs > /etc/ld.so.conf.d/opencv.conf && \
ldconfig && \
git clone https://github.com/pytorch/serve -b v0.9.0 && \
$(dirname $0)/clone-torchserve.sh && \
cd serve && \
pip install -r requirements/common.txt && \
pip install -r requirements/common_gpu.txt && \
pip install -r requirements/torch_common.txt && \
pip install . && \
cd .. && \
rm -rf serve
rm -rf serve && \
$(dirname $0)/install-common.sh
6 changes: 3 additions & 3 deletions torchserve/install-rocm-torchserve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ apt-get update && \
apt-get install -y \
git \
python3-pip && \
git clone https://github.com/pytorch/serve -b v0.9.0 && \
$(dirname $0)/clone-torchserve.sh && \
cd serve && \
cp /dev/null requirements/torch_linux.txt && \
python3 ./ts_scripts/install_dependencies.py --environment prod $* && \
pip install . && \
cd .. && \
rm -rf serve

rm -rf serve && \
$(dirname $0)/install-common.sh
6 changes: 3 additions & 3 deletions torchserve/install-torchserve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ apt-get update && \
apt-get install -y \
git \
python3-pip && \
git clone https://github.com/pytorch/serve -b v0.9.0 && \
$(dirname $0)/clone-torchserve.sh && \
cd serve && \
python3 ./ts_scripts/install_dependencies.py --environment prod $* && \
pip install . && \
cd .. && \
rm -rf serve

rm -rf serve && \
$(dirname $0)/install-common.sh

0 comments on commit de8efd8

Please sign in to comment.