Skip to content

Commit 24f40fb

Browse files
committed
inf2: docker image update
- + fix broken dep install (kenlm) Signed-off-by: Raphael Glon <[email protected]>
1 parent 9cb9b71 commit 24f40fb

File tree

1 file changed

+20
-46
lines changed

1 file changed

+20
-46
lines changed

dockerfiles/pytorch/Dockerfile.inf2

Lines changed: 20 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
# 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:22.04 as base
2+
FROM ubuntu:22.04 AS base
33

44
LABEL maintainer="Hugging Face"
55

6-
ARG PYTHON=python3.10
7-
ARG PYTHON_VERSION=3.10.12
8-
ARG MAMBA_VERSION=23.1.0-4
9-
106
ARG NEURONX_COLLECTIVES_LIB_VERSION=2.22.33.0-d2128d1aa
117
ARG NEURONX_RUNTIME_LIB_VERSION=2.22.19.0-5856c0b42
128
ARG NEURONX_TOOLS_VERSION=2.19.0.0
@@ -15,9 +11,9 @@ ARG NEURONX_TOOLS_VERSION=2.19.0.0
1511
ARG OPTIMUM_NEURON_VERSION=0.0.28
1612

1713
# See http://bugs.python.org/issue19846
18-
ENV LANG C.UTF-8
19-
ENV LD_LIBRARY_PATH /opt/aws/neuron/lib:/lib/x86_64-linux-gnu:/opt/conda/lib/:$LD_LIBRARY_PATH
20-
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
2117

2218
RUN apt-get update \
2319
&& apt-get upgrade -y \
@@ -34,62 +30,40 @@ RUN apt-get update \
3430
wget \
3531
unzip \
3632
zlib1g-dev \
37-
gpg-agent \
38-
&& rm -rf /var/lib/apt/lists/* \
39-
&& rm -rf /tmp/tmp* \
40-
&& apt-get clean
33+
gpg-agent
4134

42-
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
4336
RUN wget -qO - https://apt.repos.neuron.amazonaws.com/GPG-PUB-KEY-AMAZON-AWS-NEURON.PUB | apt-key add -
4437

4538
# Install Neuronx tools
4639
RUN apt-get update \
4740
&& apt-get install -y \
4841
aws-neuronx-tools=$NEURONX_TOOLS_VERSION \
4942
aws-neuronx-collectives=$NEURONX_COLLECTIVES_LIB_VERSION \
50-
aws-neuronx-runtime-lib=$NEURONX_RUNTIME_LIB_VERSION \
51-
&& 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/* \
5251
&& rm -rf /tmp/tmp* \
5352
&& apt-get clean
5453

55-
RUN curl -L -o ~/mambaforge.sh https://github.com/conda-forge/miniforge/releases/download/${MAMBA_VERSION}/Mambaforge-${MAMBA_VERSION}-Linux-x86_64.sh \
56-
&& chmod +x ~/mambaforge.sh \
57-
&& ~/mambaforge.sh -b -p /opt/conda \
58-
&& rm ~/mambaforge.sh \
59-
&& /opt/conda/bin/conda update -y conda \
60-
&& /opt/conda/bin/conda install -c conda-forge -y \
61-
python=$PYTHON_VERSION \
62-
pyopenssl \
63-
cython \
64-
mkl-include \
65-
mkl \
66-
botocore \
67-
parso \
68-
scipy \
69-
typing \
70-
# Below 2 are included in miniconda base, but not mamba so need to install
71-
conda-content-trust \
72-
charset-normalizer \
73-
&& /opt/conda/bin/conda update -y conda \
74-
&& /opt/conda/bin/conda clean -ya
75-
76-
RUN conda install -c conda-forge \
77-
h5py \
78-
requests \
79-
&& conda clean -ya \
80-
&& pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org \
81-
&& ln -s /opt/conda/bin/pip /usr/local/bin/pip3 \
82-
&& pip install --no-cache-dir "protobuf>=3.18.3,<4" setuptools==69.5.1 packaging
83-
54+
RUN pip install --no-cache-dir "protobuf>=3.18.3,<4" setuptools==69.5.1 packaging
55+
8456
WORKDIR /
8557

8658
# install Hugging Face libraries and its dependencies
87-
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} \
8860
&& pip install --no-deps --no-cache-dir -U torchvision==0.16.*
8961

62+
# FIXME
63+
RUN pip install --extra-index-url https://pip.repos.neuron.amazonaws.com git+https://github.com/huggingface/optimum-neuron.git@5237fb0ada643ba471f60ed3a5d2eef3b66e8e59
9064

9165
COPY . .
92-
# install wheel and setuptools
66+
9367
RUN pip install --no-cache-dir -U pip ".[st]"
9468

9569
# copy application

0 commit comments

Comments
 (0)