-
Notifications
You must be signed in to change notification settings - Fork 72
PyTorch 1.3.1 #13
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
Merged
Merged
PyTorch 1.3.1 #13
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e8de4ed
added pytorch 1.3.0 inference files
akartsky 11cd077
Updated torchvision to 0.4.1 and added ENV path
akartsky 70bc3e8
added changes for pytorch 1.3.1
akartsky c97988f
changed MMS version to 1.0.8
akartsky ff96c42
updated torchvision to 0.4.2
akartsky 03f91d3
docker best practies changes
akartsky 648e9e1
updated cuda
akartsky 9e5ff2a
fixed typo
akartsky ec3620c
fixed typo
akartsky 6abf671
line break changes
akartsky 03c682a
fixed typo
akartsky 1600529
fixed typo
akartsky 5f1dc15
moved import serving inside if
akartsky f333e2c
fixed typo
akartsky File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
.idea/ | ||
.idea/ | ||
.DS_Store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
FROM ubuntu:16.04 | ||
|
||
LABEL maintainer="Amazon AI" | ||
|
||
ARG PYTHON_VERSION=2.7 | ||
ARG PYTORCH_VERSION=1.3.1 | ||
ARG TORCHVISION_VERSION=0.4.2 | ||
ARG MMS_VERSION=1.0.8 | ||
|
||
# See http://bugs.python.org/issue19846 | ||
ENV LANG C.UTF-8 | ||
ENV LD_LIBRARY_PATH /opt/conda/lib/:$LD_LIBRARY_PATH | ||
ENV PATH /opt/conda/bin:$PATH | ||
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 \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
curl \ | ||
git \ | ||
jq \ | ||
libgl1-mesa-glx \ | ||
libglib2.0-0 \ | ||
libsm6 \ | ||
libxext6 \ | ||
libxrender-dev \ | ||
openjdk-8-jdk-headless \ | ||
vim \ | ||
wget \ | ||
zlib1g-dev | ||
|
||
|
||
RUN curl -o ~/miniconda.sh -O 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 -y \ | ||
python=$PYTHON_VERSION \ | ||
cython==0.29.12 \ | ||
ipython==5.8.0 \ | ||
mkl-include==2019.4 \ | ||
mkl==2019.4 \ | ||
numpy==1.16.4 \ | ||
scipy==1.2.1 \ | ||
typing==3.7.4 \ | ||
&& /opt/conda/bin/conda clean -ya | ||
|
||
RUN conda install -c \ | ||
conda-forge \ | ||
awscli==1.16.210 \ | ||
opencv==4.0.1 \ | ||
&& conda install -y \ | ||
scikit-learn==0.20.3 \ | ||
pandas==0.24.2 \ | ||
pillow==6.1.0 \ | ||
h5py==2.9.0 \ | ||
requests==2.22.0 \ | ||
&& conda install \ | ||
pytorch==$PYTORCH_VERSION \ | ||
torchvision==$TORCHVISION_VERSION cpuonly -c pytorch \ | ||
&& conda clean -ya \ | ||
&& pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org \ | ||
&& pip install mxnet-model-server==$MMS_VERSION | ||
|
||
RUN useradd -m model-server \ | ||
&& mkdir -p /home/model-server/tmp \ | ||
&& chown -R model-server /home/model-server | ||
|
||
COPY docker/$PYTORCH_VERSION/py2/mms-entrypoint.py /usr/local/bin/dockerd-entrypoint.py | ||
COPY docker/$PYTORCH_VERSION/py2/config.properties /home/model-server | ||
COPY src/sagemaker_pytorch_serving_container/deep_learning_container.py /usr/local/bin/deep_learning_container.py | ||
|
||
RUN chmod +x /usr/local/bin/dockerd-entrypoint.py \ | ||
&& chmod +x /usr/local/bin/deep_learning_container.py | ||
|
||
COPY dist/sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl /sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl | ||
RUN pip install --no-cache-dir \ | ||
/sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl \ | ||
&& rm /sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl | ||
|
||
|
||
EXPOSE 8080 8081 | ||
ENTRYPOINT ["python", "/usr/local/bin/dockerd-entrypoint.py"] | ||
CMD ["mxnet-model-server", "--start", "--mms-config", "/home/model-server/config.properties"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
FROM nvidia/cuda:10.1-cudnn7-devel-ubuntu16.04 | ||
# NCCL_VERSION=2.4.7, CUDNN_VERSION=7.6.2.24 | ||
LABEL maintainer="Amazon AI" | ||
|
||
ARG PYTHON_VERSION=2.7 | ||
ARG PYTORCH_VERSION=1.3.1 | ||
ARG TORCHVISION_VERSION=0.4.2 | ||
ARG MMS_VERSION=1.0.8 | ||
|
||
# See http://bugs.python.org/issue19846 | ||
ENV LANG C.UTF-8 | ||
ENV LD_LIBRARY_PATH /opt/conda/lib/:$LD_LIBRARY_PATH | ||
ENV PATH /opt/conda/bin:$PATH | ||
ENV SAGEMAKER_SERVING_MODULE sagemaker_pytorch_serving_container.serving:main | ||
ENV TEMP=/home/model-server/tmp | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y --allow-downgrades --allow-change-held-packages --no-install-recommends \ | ||
build-essential \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
curl \ | ||
git \ | ||
jq \ | ||
libgl1-mesa-glx \ | ||
libglib2.0-0 \ | ||
libgomp1 \ | ||
libibverbs-dev \ | ||
libsm6 \ | ||
libxext6 \ | ||
libxrender-dev \ | ||
openjdk-8-jdk-headless \ | ||
vim \ | ||
wget \ | ||
zlib1g-dev | ||
|
||
# Install OpenSSH, Allow OpenSSH to talk to containers without asking for confirmation | ||
RUN apt-get install -y --no-install-recommends \ | ||
openssh-client openssh-server \ | ||
&& mkdir -p /var/run/sshd \ | ||
&& cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new \ | ||
&& echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new \ | ||
&& mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config | ||
|
||
RUN curl -o ~/miniconda.sh -O 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 -y \ | ||
python=$PYTHON_VERSION \ | ||
cython==0.29.12 \ | ||
ipython==5.8.0 \ | ||
mkl-include==2019.4 \ | ||
mkl==2019.4 \ | ||
numpy==1.16.4 \ | ||
scipy==1.2.1 \ | ||
typing==3.7.4 \ | ||
&& /opt/conda/bin/conda clean -ya | ||
|
||
|
||
RUN conda install -c \ | ||
pytorch magma-cuda100 \ | ||
&& conda install -c \ | ||
conda-forge \ | ||
awscli==1.16.210 \ | ||
opencv==4.0.1 \ | ||
&& conda install -y scikit-learn==0.20.3 \ | ||
h5py==2.9.0 \ | ||
pandas==0.24.2 \ | ||
pillow==6.1.0 \ | ||
requests==2.22.0 \ | ||
&& conda install -c \ | ||
pytorch \ | ||
cudatoolkit=10.0 \ | ||
pytorch==$PYTORCH_VERSION \ | ||
torchvision==$TORCHVISION_VERSION \ | ||
&& conda clean -ya \ | ||
&& /opt/conda/bin/conda config --set ssl_verify False \ | ||
&& pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org \ | ||
&& pip install mxnet-model-server==$MMS_VERSION | ||
|
||
RUN useradd -m model-server \ | ||
&& mkdir -p /home/model-server/tmp \ | ||
&& chown -R model-server /home/model-server | ||
|
||
COPY docker/$PYTORCH_VERSION/py2/mms-entrypoint.py /usr/local/bin/dockerd-entrypoint.py | ||
COPY docker/$PYTORCH_VERSION/py2/config.properties /home/model-server | ||
COPY src/sagemaker_pytorch_serving_container/deep_learning_container.py /usr/local/bin/deep_learning_container.py | ||
|
||
RUN chmod +x /usr/local/bin/dockerd-entrypoint.py \ | ||
&& chmod +x /usr/local/bin/deep_learning_container.py | ||
|
||
# Install OpenSSH for MPI to communicate between containers, Allow OpenSSH to talk to containers without asking for confirmation | ||
RUN apt-get install -y --no-install-recommends \ | ||
openssh-client openssh-server \ | ||
&& mkdir -p /var/run/sshd \ | ||
&& cat /etc/ssh/ssh_config | grep -v StrictHostKeyChecking > /etc/ssh/ssh_config.new \ | ||
&& echo " StrictHostKeyChecking no" >> /etc/ssh/ssh_config.new \ | ||
&& mv /etc/ssh/ssh_config.new /etc/ssh/ssh_config | ||
|
||
# RUN pip install --no-cache-dir 'opencv-python>=4.0,<4.1' | ||
|
||
COPY dist/sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl /sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl | ||
RUN pip install --no-cache-dir \ | ||
/sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl \ | ||
&& rm /sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl | ||
|
||
EXPOSE 8080 8081 | ||
ENTRYPOINT ["python", "/usr/local/bin/dockerd-entrypoint.py"] | ||
CMD ["mxnet-model-server", "--start", "--mms-config", "/home/model-server/config.properties"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
vmargs=-Xmx128m -XX:-UseLargePages -XX:+UseG1GC -XX:MaxMetaspaceSize=32M -XX:MaxDirectMemorySize=10m -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 | ||
# management_address=unix:/tmp/management.sock | ||
# number_of_netty_threads=0 | ||
# netty_client_threads=0 | ||
# default_response_timeout=120 | ||
# default_workers_per_model=0 | ||
# job_queue_size=100 | ||
# async_logging=false | ||
# number_of_gpu=1 | ||
# cors_allowed_origin | ||
# cors_allowed_methods | ||
# cors_allowed_headers | ||
# keystore=src/test/resources/keystore.p12 | ||
# keystore_pass=changeit | ||
# keystore_type=PKCS12 | ||
# private_key_file=src/test/resources/key.pem | ||
# certificate_file=src/test/resources/certs.pem | ||
# max_response_size=6553500 | ||
# max_request_size=6553500 | ||
# blacklist_env_vars= | ||
# decode_input_request=false | ||
# enable_envvars_config=false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import shlex | ||
import subprocess | ||
import sys | ||
import os.path | ||
|
||
if not os.path.exists("/opt/ml/input/config"): | ||
subprocess.call(['python', '/usr/local/bin/deep_learning_container.py', '&>/dev/null', '&']) | ||
|
||
if sys.argv[1] == 'serve': | ||
from sagemaker_pytorch_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']) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
FROM ubuntu:16.04 | ||
|
||
LABEL maintainer="Amazon AI" | ||
|
||
ARG PYTHON_VERSION=3.6.6 | ||
ARG PYTORCH_VERSION=1.3.1 | ||
ARG TORCHVISION_VERSION=0.4.2 | ||
ARG MMS_VERSION=1.0.8 | ||
|
||
# See http://bugs.python.org/issue19846 | ||
ENV LANG C.UTF-8 | ||
ENV LD_LIBRARY_PATH /opt/conda/lib/:$LD_LIBRARY_PATH | ||
ENV PATH /opt/conda/bin:$PATH | ||
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 \ | ||
build-essential \ | ||
ca-certificates \ | ||
cmake \ | ||
curl \ | ||
git \ | ||
jq \ | ||
libgl1-mesa-glx \ | ||
libglib2.0-0 \ | ||
libsm6 \ | ||
libxext6 \ | ||
libxrender-dev \ | ||
openjdk-8-jdk-headless \ | ||
vim \ | ||
wget \ | ||
zlib1g-dev | ||
|
||
RUN curl -o ~/miniconda.sh -O 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 -y \ | ||
python=$PYTHON_VERSION \ | ||
cython==0.29.12 \ | ||
ipython==7.7.0 \ | ||
mkl-include==2019.4 \ | ||
mkl==2019.4 \ | ||
numpy==1.16.4 \ | ||
scipy==1.3.0 \ | ||
typing==3.6.4 \ | ||
&& /opt/conda/bin/conda clean -ya | ||
|
||
RUN conda install -c \ | ||
conda-forge \ | ||
awscli==1.16.210 \ | ||
opencv==4.0.1 \ | ||
&& conda install -y \ | ||
scikit-learn==0.21.2 \ | ||
pandas==0.25.0 \ | ||
pillow==5.4.1 \ | ||
h5py==2.9.0 \ | ||
requests==2.22.0 \ | ||
&& conda install \ | ||
pytorch==$PYTORCH_VERSION \ | ||
torchvision==$TORCHVISION_VERSION cpuonly -c pytorch \ | ||
&& conda clean -ya \ | ||
&& 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 mxnet-model-server==$MMS_VERSION | ||
|
||
RUN useradd -m model-server \ | ||
&& mkdir -p /home/model-server/tmp \ | ||
&& chown -R model-server /home/model-server | ||
|
||
COPY docker/$PYTORCH_VERSION/py3/mms-entrypoint.py /usr/local/bin/dockerd-entrypoint.py | ||
COPY docker/$PYTORCH_VERSION/py3/config.properties /home/model-server | ||
COPY src/sagemaker_pytorch_serving_container/deep_learning_container.py /usr/local/bin/deep_learning_container.py | ||
|
||
RUN chmod +x /usr/local/bin/dockerd-entrypoint.py \ | ||
&& chmod +x /usr/local/bin/deep_learning_container.py | ||
|
||
COPY dist/sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl /sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl | ||
RUN pip install --no-cache-dir \ | ||
/sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl \ | ||
&& rm /sagemaker_pytorch_serving_container-1.2-py2.py3-none-any.whl | ||
|
||
|
||
EXPOSE 8080 8081 | ||
ENTRYPOINT ["python", "/usr/local/bin/dockerd-entrypoint.py"] | ||
CMD ["mxnet-model-server", "--start", "--mms-config", "/home/model-server/config.properties"] |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Same as previous docker files.