1
1
# Build based on https://github.com/aws/deep-learning-containers/blob/master/huggingface/pytorch/inference/docker/2.1/py3/sdk2.18.0/Dockerfile.neuronx
2
- FROM ubuntu:20 .04 as base
2
+ FROM ubuntu:22 .04 AS base
3
3
4
4
LABEL maintainer="Hugging Face"
5
5
6
- ARG PYTHON=python3.10
7
- ARG PYTHON_VERSION=3.10.12
8
- ARG MAMBA_VERSION=23.1.0-4
9
-
10
- # Neuron SDK components version numbers
11
- # ARG NEURONX_FRAMEWORK_VERSION=2.1.2.2.1.0
12
- # ARG NEURONX_DISTRIBUTED_VERSION=0.7.0
13
- # ARG NEURONX_CC_VERSION=2.13.66.0
14
- ARG NEURONX_TRANSFORMERS_VERSION=0.12.313
15
6
ARG NEURONX_COLLECTIVES_LIB_VERSION=2.22.33.0-d2128d1aa
16
7
ARG NEURONX_RUNTIME_LIB_VERSION=2.22.19.0-5856c0b42
17
8
ARG NEURONX_TOOLS_VERSION=2.19.0.0
18
9
19
-
20
10
# HF ARGS
21
11
ARG OPTIMUM_NEURON_VERSION=0.0.28
22
12
23
13
# See http://bugs.python.org/issue19846
24
- ENV LANG C.UTF-8
25
- ENV LD_LIBRARY_PATH /opt/aws/neuron/lib:/lib/x86_64-linux-gnu:/opt/conda/lib/:$LD_LIBRARY_PATH
26
- ENV PATH /opt/conda/bin: /opt/aws/neuron/bin:$PATH
14
+ ENV LANG= C.UTF-8
15
+ ENV LD_LIBRARY_PATH= /opt/aws/neuron/lib:/lib/x86_64-linux-gnu:/opt/conda/lib/:$LD_LIBRARY_PATH
16
+ ENV PATH= /opt/aws/neuron/bin:$PATH
27
17
28
18
RUN apt-get update \
29
19
&& apt-get upgrade -y \
30
20
&& apt-get install -y --no-install-recommends software-properties-common \
31
- && add-apt-repository ppa:openjdk-r/ppa \
32
21
&& apt-get update \
33
22
&& apt-get install -y --no-install-recommends \
34
23
build-essential \
35
24
apt-transport-https \
36
25
ca-certificates \
37
26
cmake \
38
27
curl \
39
- emacs \
40
28
git \
41
29
jq \
42
- libgl1-mesa-glx \
43
- libsm6 \
44
- libxext6 \
45
- libxrender-dev \
46
- openjdk-11-jdk \
47
- vim \
48
30
wget \
49
31
unzip \
50
32
zlib1g-dev \
51
- libcap-dev \
52
- gpg-agent \
53
- && rm -rf /var/lib/apt/lists/* \
54
- && rm -rf /tmp/tmp* \
55
- && apt-get clean
33
+ gpg-agent
56
34
57
- RUN echo "deb https://apt.repos.neuron.amazonaws.com focal main" > /etc/apt/sources.list.d/neuron.list
35
+ RUN echo "deb https://apt.repos.neuron.amazonaws.com jammy main" > /etc/apt/sources.list.d/neuron.list
58
36
RUN wget -qO - https://apt.repos.neuron.amazonaws.com/GPG-PUB-KEY-AMAZON-AWS-NEURON.PUB | apt-key add -
59
37
60
38
# Install Neuronx tools
61
39
RUN apt-get update \
62
40
&& apt-get install -y \
63
41
aws-neuronx-tools=$NEURONX_TOOLS_VERSION \
64
42
aws-neuronx-collectives=$NEURONX_COLLECTIVES_LIB_VERSION \
65
- aws-neuronx-runtime-lib=$NEURONX_RUNTIME_LIB_VERSION \
66
- && rm -rf /var/lib/apt/lists/* \
43
+ aws-neuronx-runtime-lib=$NEURONX_RUNTIME_LIB_VERSION
44
+
45
+ RUN apt-get install -y \
46
+ python3 \
47
+ python3-pip \
48
+ python-is-python3
49
+
50
+ RUN rm -rf /var/lib/apt/lists/* \
67
51
&& rm -rf /tmp/tmp* \
68
52
&& apt-get clean
69
53
70
- # https://github.com/docker-library/openjdk/issues/261 https://github.com/docker-library/openjdk/pull/263/files
71
- RUN keytool -importkeystore -srckeystore /etc/ssl/certs/java/cacerts -destkeystore /etc/ssl/certs/java/cacerts.jks -deststoretype JKS -srcstorepass changeit -deststorepass changeit -noprompt; \
72
- mv /etc/ssl/certs/java/cacerts.jks /etc/ssl/certs/java/cacerts; \
73
- /var/lib/dpkg/info/ca-certificates-java.postinst configure;
74
-
75
- RUN curl -L -o ~/mambaforge.sh https://github.com/conda-forge/miniforge/releases/download/${MAMBA_VERSION}/Mambaforge-${MAMBA_VERSION}-Linux-x86_64.sh \
76
- && chmod +x ~/mambaforge.sh \
77
- && ~/mambaforge.sh -b -p /opt/conda \
78
- && rm ~/mambaforge.sh \
79
- && /opt/conda/bin/conda update -y conda \
80
- && /opt/conda/bin/conda install -c conda-forge -y \
81
- python=$PYTHON_VERSION \
82
- pyopenssl \
83
- cython \
84
- mkl-include \
85
- mkl \
86
- botocore \
87
- parso \
88
- scipy \
89
- typing \
90
- # Below 2 are included in miniconda base, but not mamba so need to install
91
- conda-content-trust \
92
- charset-normalizer \
93
- && /opt/conda/bin/conda update -y conda \
94
- && /opt/conda/bin/conda clean -ya
95
-
96
- RUN conda install -c conda-forge \
97
- scikit-learn \
98
- h5py \
99
- requests \
100
- && conda clean -ya \
101
- && pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org \
102
- && ln -s /opt/conda/bin/pip /usr/local/bin/pip3 \
103
- && pip install --no-cache-dir "protobuf>=3.18.3,<4" setuptools==69.5.1 packaging
104
-
54
+ RUN pip install --no-cache-dir "protobuf>=3.18.3,<4" setuptools==69.5.1 packaging
55
+
105
56
WORKDIR /
106
57
107
58
# install Hugging Face libraries and its dependencies
108
- RUN pip install --extra-index-url https://pip.repos.neuron.amazonaws.com --no-cache-dir optimum-neuron[neuronx]==${OPTIMUM_NEURON_VERSION} \
59
+ RUN pip install --extra-index-url https://pip.repos.neuron.amazonaws.com --no-cache-dir optimum-neuron[neuronx]==${OPTIMUM_NEURON_VERSION} \
109
60
&& pip install --no-deps --no-cache-dir -U torchvision==0.16.*
110
61
62
+ # FIXME
63
+ RUN pip install --extra-index-url https://pip.repos.neuron.amazonaws.com git+https://github.com/huggingface/optimum-neuron.git@5237fb0ada643ba471f60ed3a5d2eef3b66e8e59
111
64
112
65
COPY . .
113
- # install wheel and setuptools
66
+
114
67
RUN pip install --no-cache-dir -U pip ".[st]"
115
68
116
69
# copy application
@@ -119,5 +72,7 @@ COPY src/huggingface_inference_toolkit/webservice_starlette.py webservice_starle
119
72
120
73
# copy entrypoint and change permissions
121
74
COPY --chmod=0755 scripts/entrypoint.sh entrypoint.sh
75
+ COPY --chmod=0755 scripts/inf2_env.py inf2_env.py
76
+ COPY --chmod=0755 scripts/inf2_entrypoint.sh inf2_entrypoint.sh
122
77
123
- ENTRYPOINT ["bash", "-c", "./entrypoint .sh"]
78
+ ENTRYPOINT ["bash", "-c", "./inf2_entrypoint .sh"]
0 commit comments