-
Notifications
You must be signed in to change notification settings - Fork 520
[HuggingFace Inference] Add new base HuggingFace inference containers #1040
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
vmargs=-XX:+UseContainerSupport -XX:InitialRAMPercentage=8.0 -XX:MaxRAMPercentage=10.0 -XX:-UseLargePages -XX:+UseG1GC -XX:+ExitOnOutOfMemoryError | ||
model_store=/opt/ml/model | ||
load_models=ALL | ||
inference_address=http://0.0.0.0:8080 | ||
management_address=http://0.0.0.0:8081 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"). You | ||
# may not use this file except in compliance with the License. A copy of | ||
# the License is located at | ||
# | ||
# http://aws.amazon.com/apache2.0/ | ||
# | ||
# or in the "license" file accompanying this file. This file is | ||
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF | ||
# ANY KIND, either express or implied. See the License for the specific | ||
# language governing permissions and limitations under the License. | ||
|
||
import shlex | ||
import subprocess | ||
import sys | ||
|
||
if sys.argv[1] == 'serve': | ||
from sagemaker_huggingface_serving_container import serving | ||
serving.main() | ||
else: | ||
subprocess.check_call(shlex.split(' '.join(sys.argv[1:]))) | ||
|
||
# prevent docker exit | ||
subprocess.call(['tail', '-f', '/dev/null']) |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,110 @@ | ||||||||
FROM ubuntu:18.04 | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should use public ecr. Docker hub will throttle pull requests |
||||||||
|
||||||||
LABEL maintainer="Amazon AI" | ||||||||
LABEL dlc_major_version="1" | ||||||||
|
||||||||
# Specify accept-bind-to-port LABEL for inference pipelines to use SAGEMAKER_BIND_TO_PORT | ||||||||
# https://docs.aws.amazon.com/sagemaker/latest/dg/inference-pipeline-real-time.html | ||||||||
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true | ||||||||
# Specify multi-models LABEL to indicate container is capable of loading and serving multiple models concurrently | ||||||||
# https://docs.aws.amazon.com/sagemaker/latest/dg/build-multi-model-build-container.html | ||||||||
LABEL com.amazonaws.sagemaker.capabilities.multi-models=true | ||||||||
|
||||||||
ARG MMS_VERSION=1.1.2 | ||||||||
ARG PYTHON=python3 | ||||||||
ARG PYTHON_VERSION=3.6.13 | ||||||||
ARG OPEN_MPI_VERSION=4.0.1 | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is to get our aws-pytorch wheel working. |
||||||||
|
||||||||
ENV PYTHONDONTWRITEBYTECODE=1 \ | ||||||||
PYTHONUNBUFFERED=1 \ | ||||||||
LD_LIBRARY_PATH="/opt/conda/lib/:${LD_LIBRARY_PATH}:/usr/local/lib" \ | ||||||||
PYTHONIOENCODING=UTF-8 \ | ||||||||
LANG=C.UTF-8 \ | ||||||||
LC_ALL=C.UTF-8 \ | ||||||||
TEMP=/home/model-server/tmp \ | ||||||||
DEBIAN_FRONTEND=noninteractive | ||||||||
|
||||||||
ENV PATH /opt/conda/bin:$PATH | ||||||||
|
||||||||
RUN apt-get update \ | ||||||||
&& apt-get install -y --no-install-recommends \ | ||||||||
ca-certificates \ | ||||||||
build-essential \ | ||||||||
openssl \ | ||||||||
openjdk-8-jdk-headless \ | ||||||||
vim \ | ||||||||
wget \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need git for building/installing HF inference toolkit? If yes, we should add it on top of base container spec. We could later remove it when we publish the toolkits. |
||||||||
curl \ | ||||||||
unzip \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Compared to the initial zlib1g-dev \
libreadline-gplv2-dev \
libncursesw5-dev \
libssl-dev \
libsqlite3-dev \
libgdbm-dev \
libc6-dev \
libbz2-dev \
tk-dev \
libffi-dev \ Are they not needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Functionally these don't seem to be required. Will revisit some (like libffi) later. We technically shouldn't need any dev packages in prod containers. |
||||||||
&& apt-get clean \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also noticed that the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup. This was required for getting GPU version of aws-pytorch wheel run on GPU containers. Will revisit if we can remove this. |
||||||||
&& rm -rf /var/lib/apt/lists/* | ||||||||
|
||||||||
RUN curl -L -o ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ | ||||||||
&& chmod +x ~/miniconda.sh \ | ||||||||
&& ~/miniconda.sh -b -p /opt/conda \ | ||||||||
&& rm ~/miniconda.sh \ | ||||||||
&& /opt/conda/bin/conda update conda \ | ||||||||
&& /opt/conda/bin/conda install -c conda-forge \ | ||||||||
python=$PYTHON_VERSION \ | ||||||||
&& /opt/conda/bin/conda install -y \ | ||||||||
# conda 4.10.0 requires ruamel_yaml to be installed. Currently pinned at latest. | ||||||||
ruamel_yaml==0.15.100 \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The comment suggested that we need this for conda. Considering we are on 4.10.1 we might not need this anyomre. But, we need to verify before removing. |
||||||||
cython==0.29.12 \ | ||||||||
mkl-include==2019.4 \ | ||||||||
mkl==2019.4 \ | ||||||||
botocore \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First of all, is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is also new compared to the initial one you provided. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup. botocore will be required for aws-pytorch wheels. Initially I had added boto3, but it appears that botocore is enough. Currently verifying if this is enough to be functionally correct |
||||||||
&& /opt/conda/bin/conda clean -ya | ||||||||
|
||||||||
RUN pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org \ | ||||||||
&& ln -s /opt/conda/bin/pip /usr/local/bin/pip3 \ | ||||||||
&& pip install packaging==20.4 \ | ||||||||
enum-compat==0.0.3 \ | ||||||||
"cryptography>3.2" | ||||||||
|
||||||||
RUN wget https://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-$OPEN_MPI_VERSION.tar.gz \ | ||||||||
&& gunzip -c openmpi-$OPEN_MPI_VERSION.tar.gz | tar xf - \ | ||||||||
&& cd openmpi-$OPEN_MPI_VERSION \ | ||||||||
&& ./configure --prefix=/home/.openmpi \ | ||||||||
&& make all install \ | ||||||||
&& cd .. \ | ||||||||
&& rm openmpi-$OPEN_MPI_VERSION.tar.gz \ | ||||||||
&& rm -rf openmpi-$OPEN_MPI_VERSION | ||||||||
Comment on lines
+64
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure why we should need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently aws-fx wheel depends on this. We can revisit this once (if?) we remove this dependency in the future. |
||||||||
|
||||||||
# The ENV variables declared below are changed in the previous section | ||||||||
# Grouping these ENV variables in the first section causes | ||||||||
# ompi_info to fail. This is only observed in CPU containers | ||||||||
ENV PATH="$PATH:/home/.openmpi/bin" | ||||||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/.openmpi/lib/" | ||||||||
RUN ompi_info --parsable --all | grep mpi_built_with_cuda_support:value | ||||||||
Comment on lines
+73
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. related to |
||||||||
|
||||||||
WORKDIR / | ||||||||
|
||||||||
RUN pip install --no-cache-dir \ | ||||||||
multi-model-server==$MMS_VERSION \ | ||||||||
sagemaker-inference | ||||||||
|
||||||||
RUN useradd -m model-server \ | ||||||||
&& mkdir -p /home/model-server/tmp \ | ||||||||
&& chown -R model-server /home/model-server | ||||||||
|
||||||||
COPY mms-entrypoint.py /usr/local/bin/dockerd-entrypoint.py | ||||||||
COPY config.properties /home/model-server | ||||||||
Comment on lines
+90
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be adjusted to the right directory for the build context. Not sure what the context of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To build the inference containers, we need to add logic to |
||||||||
|
||||||||
RUN chmod +x /usr/local/bin/dockerd-entrypoint.py | ||||||||
|
||||||||
ADD https://raw.githubusercontent.com/aws/deep-learning-containers/master/src/deep_learning_container.py /usr/local/bin/deep_learning_container.py | ||||||||
|
||||||||
RUN chmod +x /usr/local/bin/deep_learning_container.py | ||||||||
|
||||||||
RUN HOME_DIR=/root \ | ||||||||
&& curl -o ${HOME_DIR}/oss_compliance.zip https://aws-dlinfra-utilities.s3.amazonaws.com/oss_compliance.zip \ | ||||||||
&& unzip ${HOME_DIR}/oss_compliance.zip -d ${HOME_DIR}/ \ | ||||||||
&& cp ${HOME_DIR}/oss_compliance/test/testOSSCompliance /usr/local/bin/testOSSCompliance \ | ||||||||
&& chmod +x /usr/local/bin/testOSSCompliance \ | ||||||||
&& chmod +x ${HOME_DIR}/oss_compliance/generate_oss_compliance.sh \ | ||||||||
&& ${HOME_DIR}/oss_compliance/generate_oss_compliance.sh ${HOME_DIR} ${PYTHON} \ | ||||||||
&& rm -rf ${HOME_DIR}/oss_compliance* | ||||||||
|
||||||||
EXPOSE 8080 8081 | ||||||||
ENTRYPOINT ["python", "/usr/local/bin/dockerd-entrypoint.py"] | ||||||||
CMD ["multi-model-server", "--start", "--mms-config", "/home/model-server/config.properties"] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why you start the
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We will have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we don't need the CMD since these images are for SageMaker only(don't need to support DLC use case). SageMaker overrides anyway - https://docs.aws.amazon.com/sagemaker/latest/dg/your-algorithms-inference-code.html#your-algorithms-inference-code-run-image |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,107 @@ | ||||||||
FROM nvidia/cuda:11.0-cudnn8-runtime-ubuntu18.04 | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is SageMaker Hosting now supporting Cuda 11? I thought it was only Cuda 10.2? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, use ECR public |
||||||||
|
||||||||
LABEL maintainer="Amazon AI" | ||||||||
LABEL dlc_major_version="1" | ||||||||
|
||||||||
# Specify accept-bind-to-port LABEL for inference pipelines to use SAGEMAKER_BIND_TO_PORT | ||||||||
# https://docs.aws.amazon.com/sagemaker/latest/dg/inference-pipeline-real-time.html | ||||||||
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true | ||||||||
# Specify multi-models LABEL to indicate container is capable of loading and serving multiple models concurrently | ||||||||
# https://docs.aws.amazon.com/sagemaker/latest/dg/build-multi-model-build-container.html | ||||||||
LABEL com.amazonaws.sagemaker.capabilities.multi-models=true | ||||||||
|
||||||||
ARG MMS_VERSION=1.1.2 | ||||||||
ARG PYTHON=python3 | ||||||||
ARG PYTHON_VERSION=3.6.13 | ||||||||
ARG OPEN_MPI_VERSION=4.0.1 | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you add |
||||||||
|
||||||||
ENV PYTHONDONTWRITEBYTECODE=1 \ | ||||||||
PYTHONUNBUFFERED=1 \ | ||||||||
LD_LIBRARY_PATH="/opt/conda/lib/:${LD_LIBRARY_PATH}:/usr/local/lib" \ | ||||||||
PYTHONIOENCODING=UTF-8 \ | ||||||||
LANG=C.UTF-8 \ | ||||||||
LC_ALL=C.UTF-8 \ | ||||||||
TEMP=/home/model-server/tmp \ | ||||||||
DEBIAN_FRONTEND=noninteractive | ||||||||
|
||||||||
ENV PATH /opt/conda/bin:$PATH | ||||||||
|
||||||||
RUN apt-get update \ | ||||||||
&& apt-get install -y --no-install-recommends \ | ||||||||
ca-certificates \ | ||||||||
build-essential \ | ||||||||
openssl \ | ||||||||
openjdk-8-jdk-headless \ | ||||||||
vim \ | ||||||||
wget \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
curl \ | ||||||||
unzip \ | ||||||||
libnuma1 \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Compared to the initial zlib1g-dev \
libreadline-gplv2-dev \
libncursesw5-dev \
libssl-dev \
libsqlite3-dev \
libgdbm-dev \
libc6-dev \
libbz2-dev \
tk-dev \
libffi-dev \ Are they not needed? |
||||||||
&& apt-get clean \ | ||||||||
&& rm -rf /var/lib/apt/lists/* | ||||||||
|
||||||||
RUN curl -L -o ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ | ||||||||
&& chmod +x ~/miniconda.sh \ | ||||||||
&& ~/miniconda.sh -b -p /opt/conda \ | ||||||||
&& rm ~/miniconda.sh \ | ||||||||
&& /opt/conda/bin/conda update conda \ | ||||||||
&& /opt/conda/bin/conda install -c conda-forge \ | ||||||||
python=$PYTHON_VERSION \ | ||||||||
&& /opt/conda/bin/conda install -y \ | ||||||||
# conda 4.10.0 requires ruamel_yaml to be installed. Currently pinned at latest. | ||||||||
ruamel_yaml==0.15.100 \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need |
||||||||
cython==0.29.12 \ | ||||||||
botocore \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First of all, is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point, we can pin this to current latest version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need boto? |
||||||||
mkl-include==2019.4 \ | ||||||||
mkl==2019.4 \ | ||||||||
&& /opt/conda/bin/conda clean -ya | ||||||||
|
||||||||
RUN pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org \ | ||||||||
&& ln -s /opt/conda/bin/pip /usr/local/bin/pip3 \ | ||||||||
&& pip install packaging==20.4 \ | ||||||||
enum-compat==0.0.3 \ | ||||||||
"cryptography>3.2" | ||||||||
|
||||||||
RUN wget https://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-$OPEN_MPI_VERSION.tar.gz \ | ||||||||
&& gunzip -c openmpi-$OPEN_MPI_VERSION.tar.gz | tar xf - \ | ||||||||
&& cd openmpi-$OPEN_MPI_VERSION \ | ||||||||
&& ./configure --prefix=/home/.openmpi \ | ||||||||
&& make all install \ | ||||||||
&& cd .. \ | ||||||||
&& rm openmpi-$OPEN_MPI_VERSION.tar.gz \ | ||||||||
&& rm -rf openmpi-$OPEN_MPI_VERSION | ||||||||
|
||||||||
ENV PATH="$PATH:/home/.openmpi/bin" | ||||||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/.openmpi/lib/" | ||||||||
Comment on lines
+65
to
+75
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure why we should need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it might be required as a dlc image. SageMaker probably doesn't need this. |
||||||||
|
||||||||
WORKDIR / | ||||||||
|
||||||||
RUN pip install --no-cache-dir \ | ||||||||
multi-model-server==$MMS_VERSION \ | ||||||||
sagemaker-inference | ||||||||
|
||||||||
RUN useradd -m model-server \ | ||||||||
&& mkdir -p /home/model-server/tmp \ | ||||||||
&& chown -R model-server /home/model-server | ||||||||
|
||||||||
COPY mms-entrypoint.py /usr/local/bin/dockerd-entrypoint.py | ||||||||
COPY config.properties /home/model-server | ||||||||
Comment on lines
+87
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be adjusted to the right directory for the build context. Not sure what the context of |
||||||||
|
||||||||
RUN chmod +x /usr/local/bin/dockerd-entrypoint.py | ||||||||
|
||||||||
ADD https://raw.githubusercontent.com/aws/deep-learning-containers/master/src/deep_learning_container.py /usr/local/bin/deep_learning_container.py | ||||||||
|
||||||||
RUN chmod +x /usr/local/bin/deep_learning_container.py | ||||||||
|
||||||||
RUN HOME_DIR=/root \ | ||||||||
&& curl -o ${HOME_DIR}/oss_compliance.zip https://aws-dlinfra-utilities.s3.amazonaws.com/oss_compliance.zip \ | ||||||||
&& unzip ${HOME_DIR}/oss_compliance.zip -d ${HOME_DIR}/ \ | ||||||||
&& cp ${HOME_DIR}/oss_compliance/test/testOSSCompliance /usr/local/bin/testOSSCompliance \ | ||||||||
&& chmod +x /usr/local/bin/testOSSCompliance \ | ||||||||
&& chmod +x ${HOME_DIR}/oss_compliance/generate_oss_compliance.sh \ | ||||||||
&& ${HOME_DIR}/oss_compliance/generate_oss_compliance.sh ${HOME_DIR} ${PYTHON} \ | ||||||||
&& rm -rf ${HOME_DIR}/oss_compliance* | ||||||||
|
||||||||
EXPOSE 8080 8081 | ||||||||
ENTRYPOINT ["python", "/usr/local/bin/dockerd-entrypoint.py"] | ||||||||
CMD ["multi-model-server", "--start", "--mms-config", "/home/model-server/config.properties"] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why you start the
Suggested change
|
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,110 @@ | ||||||||
FROM ubuntu:18.04 | ||||||||
|
||||||||
LABEL maintainer="Amazon AI" | ||||||||
LABEL dlc_major_version="1" | ||||||||
|
||||||||
# Specify accept-bind-to-port LABEL for inference pipelines to use SAGEMAKER_BIND_TO_PORT | ||||||||
# https://docs.aws.amazon.com/sagemaker/latest/dg/inference-pipeline-real-time.html | ||||||||
LABEL com.amazonaws.sagemaker.capabilities.accept-bind-to-port=true | ||||||||
# Specify multi-models LABEL to indicate container is capable of loading and serving multiple models concurrently | ||||||||
# https://docs.aws.amazon.com/sagemaker/latest/dg/build-multi-model-build-container.html | ||||||||
LABEL com.amazonaws.sagemaker.capabilities.multi-models=true | ||||||||
|
||||||||
ARG MMS_VERSION=1.1.2 | ||||||||
ARG PYTHON=python3 | ||||||||
ARG PYTHON_VERSION=3.7.10 | ||||||||
ARG OPEN_MPI_VERSION=4.0.1 | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you add |
||||||||
|
||||||||
ENV PYTHONDONTWRITEBYTECODE=1 \ | ||||||||
PYTHONUNBUFFERED=1 \ | ||||||||
LD_LIBRARY_PATH="/opt/conda/lib/:${LD_LIBRARY_PATH}:/usr/local/lib" \ | ||||||||
PYTHONIOENCODING=UTF-8 \ | ||||||||
LANG=C.UTF-8 \ | ||||||||
LC_ALL=C.UTF-8 \ | ||||||||
TEMP=/home/model-server/tmp \ | ||||||||
DEBIAN_FRONTEND=noninteractive | ||||||||
|
||||||||
ENV PATH /opt/conda/bin:$PATH | ||||||||
|
||||||||
RUN apt-get update \ | ||||||||
&& apt-get install -y --no-install-recommends \ | ||||||||
ca-certificates \ | ||||||||
build-essential \ | ||||||||
openssl \ | ||||||||
openjdk-8-jdk-headless \ | ||||||||
vim \ | ||||||||
wget \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
curl \ | ||||||||
unzip \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Compared to the initial zlib1g-dev \
libreadline-gplv2-dev \
libncursesw5-dev \
libssl-dev \
libsqlite3-dev \
libgdbm-dev \
libc6-dev \
libbz2-dev \
tk-dev \
libffi-dev \ Are they not needed? |
||||||||
&& apt-get clean \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also noticed that the |
||||||||
&& rm -rf /var/lib/apt/lists/* | ||||||||
|
||||||||
RUN curl -L -o ~/miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh \ | ||||||||
&& chmod +x ~/miniconda.sh \ | ||||||||
&& ~/miniconda.sh -b -p /opt/conda \ | ||||||||
&& rm ~/miniconda.sh \ | ||||||||
&& /opt/conda/bin/conda update conda \ | ||||||||
&& /opt/conda/bin/conda install -c conda-forge \ | ||||||||
python=$PYTHON_VERSION \ | ||||||||
&& /opt/conda/bin/conda install -y \ | ||||||||
# conda 4.10.0 requires ruamel_yaml to be installed. Currently pinned at latest. | ||||||||
ruamel_yaml==0.15.100 \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need |
||||||||
cython==0.29.12 \ | ||||||||
mkl-include==2019.4 \ | ||||||||
mkl==2019.4 \ | ||||||||
botocore \ | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. First of all, is |
||||||||
&& /opt/conda/bin/conda clean -ya | ||||||||
|
||||||||
RUN pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org \ | ||||||||
&& ln -s /opt/conda/bin/pip /usr/local/bin/pip3 \ | ||||||||
&& pip install packaging==20.4 \ | ||||||||
enum-compat==0.0.3 \ | ||||||||
"cryptography>3.2" | ||||||||
|
||||||||
RUN wget https://www.open-mpi.org/software/ompi/v4.0/downloads/openmpi-$OPEN_MPI_VERSION.tar.gz \ | ||||||||
&& gunzip -c openmpi-$OPEN_MPI_VERSION.tar.gz | tar xf - \ | ||||||||
&& cd openmpi-$OPEN_MPI_VERSION \ | ||||||||
&& ./configure --prefix=/home/.openmpi \ | ||||||||
&& make all install \ | ||||||||
&& cd .. \ | ||||||||
&& rm openmpi-$OPEN_MPI_VERSION.tar.gz \ | ||||||||
&& rm -rf openmpi-$OPEN_MPI_VERSION | ||||||||
Comment on lines
+64
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure why we should need |
||||||||
|
||||||||
# The ENV variables declared below are changed in the previous section | ||||||||
# Grouping these ENV variables in the first section causes | ||||||||
# ompi_info to fail. This is only observed in CPU containers | ||||||||
ENV PATH="$PATH:/home/.openmpi/bin" | ||||||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/.openmpi/lib/" | ||||||||
RUN ompi_info --parsable --all | grep mpi_built_with_cuda_support:value | ||||||||
Comment on lines
+73
to
+78
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. related to |
||||||||
|
||||||||
WORKDIR / | ||||||||
|
||||||||
RUN pip install --no-cache-dir \ | ||||||||
multi-model-server==$MMS_VERSION \ | ||||||||
sagemaker-inference | ||||||||
|
||||||||
RUN useradd -m model-server \ | ||||||||
&& mkdir -p /home/model-server/tmp \ | ||||||||
&& chown -R model-server /home/model-server | ||||||||
|
||||||||
COPY mms-entrypoint.py /usr/local/bin/dockerd-entrypoint.py | ||||||||
COPY config.properties /home/model-server | ||||||||
Comment on lines
+90
to
+91
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be adjusted to the right directory for the build context. Not sure what the context of |
||||||||
|
||||||||
RUN chmod +x /usr/local/bin/dockerd-entrypoint.py | ||||||||
|
||||||||
ADD https://raw.githubusercontent.com/aws/deep-learning-containers/master/src/deep_learning_container.py /usr/local/bin/deep_learning_container.py | ||||||||
|
||||||||
RUN chmod +x /usr/local/bin/deep_learning_container.py | ||||||||
|
||||||||
RUN HOME_DIR=/root \ | ||||||||
&& curl -o ${HOME_DIR}/oss_compliance.zip https://aws-dlinfra-utilities.s3.amazonaws.com/oss_compliance.zip \ | ||||||||
&& unzip ${HOME_DIR}/oss_compliance.zip -d ${HOME_DIR}/ \ | ||||||||
&& cp ${HOME_DIR}/oss_compliance/test/testOSSCompliance /usr/local/bin/testOSSCompliance \ | ||||||||
&& chmod +x /usr/local/bin/testOSSCompliance \ | ||||||||
&& chmod +x ${HOME_DIR}/oss_compliance/generate_oss_compliance.sh \ | ||||||||
&& ${HOME_DIR}/oss_compliance/generate_oss_compliance.sh ${HOME_DIR} ${PYTHON} \ | ||||||||
&& rm -rf ${HOME_DIR}/oss_compliance* | ||||||||
|
||||||||
EXPOSE 8080 8081 | ||||||||
ENTRYPOINT ["python", "/usr/local/bin/dockerd-entrypoint.py"] | ||||||||
CMD ["multi-model-server", "--start", "--mms-config", "/home/model-server/config.properties"] | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why you start the
Suggested change
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would this file place in
build_artifacts
instead ofartifacts
to keep it the same across all frameworks.https://github.com/vdantu/deep-learning-containers/tree/hugging_face/pytorch/inference/docker/build_artifacts
Also, can you remove the
__init__.py
fromartifacts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, we can name it either
artifacts
orbuild_artifacts
. artifacts and build_artifacts are both used interchangeably.