Dockerfile.neuron 2 KB
Newer Older
1
# default base image
2
# https://gallery.ecr.aws/neuron/pytorch-inference-neuronx
3
ARG BASE_IMAGE="public.ecr.aws/neuron/pytorch-inference-neuronx:2.5.1-neuronx-py310-sdk2.22.0-ubuntu22.04"
4
5
6
7
8
9

FROM $BASE_IMAGE

RUN echo "Base image is $BASE_IMAGE"

# Install some basic utilities
10
11
12
13
14
15
RUN apt-get update && \
    apt-get install -y \
        git \
        python3 \
        python3-pip \
        ffmpeg libsm6 libxext6 libgl1
16
17

### Mount Point ###
18
19
# When launching the container, mount the code directory to /workspace
ARG APP_MOUNT=/workspace
20
VOLUME [ ${APP_MOUNT} ]
21
WORKDIR ${APP_MOUNT}/vllm
22
23

RUN python3 -m pip install --upgrade pip
24
25
26
RUN python3 -m pip install --no-cache-dir fastapi ninja tokenizers pandas tenacity
RUN python3 -m pip install sentencepiece transformers==4.48.0 -U
RUN python3 -m pip install neuronx-cc==2.17.194.0 --extra-index-url=https://pip.repos.neuron.amazonaws.com -U
27
RUN python3 -m pip install pytest
28

29
30
31
# uninstall transformers-neuronx package explicitly to avoid version conflict
RUN python3 -m pip uninstall -y transformers-neuronx

32
33
34
35
COPY . .
ARG GIT_REPO_CHECK=0
RUN --mount=type=bind,source=.git,target=.git \
    if [ "$GIT_REPO_CHECK" != 0 ]; then bash tools/check_repo.sh ; fi
36

37
RUN python3 -m pip install -U \
38
        'cmake>=3.26' ninja packaging 'setuptools-scm>=8' wheel jinja2 \
39
        -r requirements/neuron.txt
40

41
ENV VLLM_TARGET_DEVICE neuron
42
RUN --mount=type=bind,source=.git,target=.git \
43
    pip install --no-build-isolation -v -e .
44

youkaichao's avatar
youkaichao committed
45
46
47
# install development dependencies (for testing)
RUN python3 -m pip install -e tests/vllm_test_utils

48
49
50
51
# install transformers-neuronx package as an optional dependencies (for V0)
# FIXME: `--no-deps` argument is temporarily added to resolve transformers package version conflict
RUN python3 -m pip install transformers-neuronx==0.13.* --extra-index-url=https://pip.repos.neuron.amazonaws.com -U --no-deps

52
53
54
# overwrite entrypoint to run bash script
RUN echo "import subprocess; import sys; subprocess.check_call(sys.argv[1:])" > /usr/local/bin/dockerd-entrypoint.py

55
CMD ["/bin/bash"]