Skip to content

Commit

Permalink
Upgrade pytorch to 1.13.1, including CI integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
davidthomas426 committed Jan 31, 2023
1 parent 5ae7218 commit 7bd66ed
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 2 deletions.
2 changes: 1 addition & 1 deletion buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 0.2

env:
variables:
FRAMEWORK_VERSION: '1.10.2'
FRAMEWORK_VERSION: '1.13.1'
EIA_FRAMEWORK_VERSION: '1.3.1'
CPU_INSTANCE_TYPE: 'ml.c4.xlarge'
GPU_INSTANCE_TYPE: 'ml.p3.8xlarge'
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def read(fname):
'test': ['boto3', 'coverage', 'docker-compose', 'flake8', 'Flask',
'mock', 'pytest', 'pytest-cov', 'pytest-xdist', 'PyYAML',
'sagemaker', 'six', 'requests',
'requests_mock', 'torch==1.12.1', 'torchvision==0.13.1', 'tox']
'requests_mock', 'torch==1.13.1', 'torchvision==0.14.1', 'tox']
},

entry_points={
Expand Down
9 changes: 9 additions & 0 deletions test/container/1.13.1/Dockerfile.dlc.cpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG region
FROM 763104351884.dkr.ecr.$region.amazonaws.com/pytorch-inference:1.13.1-cpu-py39-ubuntu20.04-sagemaker

RUN pip uninstall torchserve -y && \
pip install torchserve-nightly==2022.3.23.post2

COPY dist/sagemaker_pytorch_inference-*.tar.gz /sagemaker_pytorch_inference.tar.gz
RUN pip install --upgrade --no-cache-dir /sagemaker_pytorch_inference.tar.gz && \
rm /sagemaker_pytorch_inference.tar.gz
9 changes: 9 additions & 0 deletions test/container/1.13.1/Dockerfile.dlc.gpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ARG region
FROM 763104351884.dkr.ecr.$region.amazonaws.com/pytorch-inference:1.13.1-gpu-py38-cu117-ubuntu20.04-sagemaker

RUN pip uninstall torchserve -y && \
pip install torchserve-nightly==2022.3.23.post2

COPY dist/sagemaker_pytorch_inference-*.tar.gz /sagemaker_pytorch_inference.tar.gz
RUN pip install --upgrade --no-cache-dir /sagemaker_pytorch_inference.tar.gz && \
rm /sagemaker_pytorch_inference.tar.gz
46 changes: 46 additions & 0 deletions test/container/1.13.1/Dockerfile.pytorch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
FROM pytorch/pytorch:1.13.1-cuda11.6-cudnn8-runtime

LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true
LABEL com.amazonaws.sagemaker.capabilities.multi-models=true

ARG TS_VERSION=0.7.0
ARG TS_ARCHIVER_VERSION=0.7.0

ENV SAGEMAKER_SERVING_MODULE sagemaker_pytorch_serving_container.serving:main
ENV TEMP=/home/model-server/tmp

RUN apt-get update \
&& apt-get install -y --no-install-recommends software-properties-common \
&& add-apt-repository ppa:openjdk-r/ppa \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
libgl1-mesa-glx \
libglib2.0-0 \
libsm6 \
libxext6 \
libxrender-dev \
openjdk-11-jdk-headless \
&& rm -rf /var/lib/apt/lists/*

RUN conda install -c conda-forge opencv \
&& ln -s /opt/conda/bin/pip /usr/local/bin/pip3

RUN pip install torchserve-nightly==2023.1.31 \
&& pip install torch-model-archiver==$TS_ARCHIVER_VERSION

COPY dist/sagemaker_pytorch_inference-*.tar.gz /sagemaker_pytorch_inference.tar.gz
RUN pip install --no-cache-dir /sagemaker_pytorch_inference.tar.gz && \
rm /sagemaker_pytorch_inference.tar.gz

RUN useradd -m model-server \
&& mkdir -p /home/model-server/tmp \
&& chown -R model-server /home/model-server

COPY artifacts/ts-entrypoint.py /usr/local/bin/dockerd-entrypoint.py
COPY artifacts/config.properties /home/model-server

RUN chmod +x /usr/local/bin/dockerd-entrypoint.py

EXPOSE 8080 8081
ENTRYPOINT ["python", "/usr/local/bin/dockerd-entrypoint.py"]
CMD ["torchserve", "--start", "--ts-config", "/home/model-server/config.properties", "--model-store", "/home/model-server/"]

0 comments on commit 7bd66ed

Please sign in to comment.