"tests/vscode:/vscode.git/clone" did not exist on "c74c913bfbefc5d7a1302557eb35cdcbecd91f67"
Dockerfile.rocm 3.6 KB
Newer Older
1
2
3
4
# default base image
ARG REMOTE_VLLM="0"
ARG COMMON_WORKDIR=/app
ARG BASE_IMAGE=rocm/vllm-dev:base
5

6
FROM ${BASE_IMAGE} AS base
7

8
9
ARG ARG_PYTORCH_ROCM_ARCH
ENV PYTORCH_ROCM_ARCH=${ARG_PYTORCH_ROCM_ARCH:-${PYTORCH_ROCM_ARCH}}
10
11

# Install some basic utilities
12
RUN apt-get update -q -y && apt-get install -q -y \
13
14
    sqlite3 libsqlite3-dev libfmt-dev libmsgpack-dev libsuitesparse-dev \
    apt-transport-https ca-certificates wget curl
15
# Remove sccache    
16
RUN python3 -m pip install --upgrade pip
17
RUN apt-get purge -y sccache; python3 -m pip uninstall -y sccache; rm -f "$(which sccache)"
18
19
20
21
22
23
24
25
26
27
28
29
30
ARG COMMON_WORKDIR
WORKDIR ${COMMON_WORKDIR}


# -----------------------
# vLLM fetch stages
FROM base AS fetch_vllm_0
ONBUILD COPY ./ vllm/
FROM base AS fetch_vllm_1
ARG VLLM_REPO="https://github.com/vllm-project/vllm.git"
ARG VLLM_BRANCH="main"
ONBUILD RUN git clone ${VLLM_REPO} \
	    && cd vllm \
31
32
	    && git fetch -v --prune -- origin ${VLLM_BRANCH} \
	    && git checkout FETCH_HEAD
33
34
35
36
37
38
39
FROM fetch_vllm_${REMOTE_VLLM} AS fetch_vllm

# -----------------------
# vLLM build stages
FROM fetch_vllm AS build_vllm
# Build vLLM
RUN cd vllm \
40
    && python3 -m pip install -r requirements/rocm.txt \
41
42
43
44
45
    && python3 setup.py clean --all  \
    && python3 setup.py bdist_wheel --dist-dir=dist
FROM scratch AS export_vllm
ARG COMMON_WORKDIR
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/dist/*.whl /
46
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/requirements /requirements
47
48
49
50
51
52
53
54
55
56
57
58
59
60
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/benchmarks /benchmarks
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/tests /tests
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/examples /examples
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm/.buildkite /.buildkite

# -----------------------
# Test vLLM image
FROM base AS test

RUN python3 -m pip install --upgrade pip && rm -rf /var/lib/apt/lists/*

# Install vLLM
RUN --mount=type=bind,from=export_vllm,src=/,target=/install \
    cd /install \
61
    && pip install -U -r requirements/rocm.txt \
62
    && pip install -U -r requirements/rocm-test.txt \
63
64
65
66
67
68
    && pip uninstall -y vllm \
    && pip install *.whl

WORKDIR /vllm-workspace
ARG COMMON_WORKDIR
COPY --from=build_vllm ${COMMON_WORKDIR}/vllm /vllm-workspace
69

70
71
72
73
# install development dependencies (for testing)
RUN cd /vllm-workspace \
    && rm -rf vllm \
    && python3 -m pip install -e tests/vllm_test_utils \
74
75
    && python3 -m pip install lm-eval[api]==0.4.4 \
    && python3 -m pip install pytest-shard
76

77
78
# -----------------------
# Final vLLM image
79
FROM base AS final
80

81
82
83
84
85
86
87
RUN python3 -m pip install --upgrade pip && rm -rf /var/lib/apt/lists/*
# Error related to odd state for numpy 1.20.3 where there is no METADATA etc, but an extra LICENSES_bundled.txt.
# Manually remove it so that later steps of numpy upgrade can continue
RUN case "$(which python3)" in \
        *"/opt/conda/envs/py_3.9"*) \
            rm -rf /opt/conda/envs/py_3.9/lib/python3.9/site-packages/numpy-1.20.3.dist-info/;; \
        *) ;; esac
88

89
RUN python3 -m pip install --upgrade huggingface-hub[cli]
90

91
92
93
# Install vLLM
RUN --mount=type=bind,from=export_vllm,src=/,target=/install \
    cd /install \
94
    && pip install -U -r requirements/rocm.txt \
95
96
97
98
99
100
101
102
    && pip uninstall -y vllm \
    && pip install *.whl

ARG COMMON_WORKDIR

# Copy over the benchmark scripts as well
COPY --from=export_vllm /benchmarks ${COMMON_WORKDIR}/vllm/benchmarks
COPY --from=export_vllm /examples ${COMMON_WORKDIR}/vllm/examples
103

104
ENV RAY_EXPERIMENTAL_NOSET_ROCR_VISIBLE_DEVICES=1
105
ENV TOKENIZERS_PARALLELISM=false
106

107
108
109
# ENV that can improve safe tensor loading, and end-to-end time
ENV SAFETENSORS_FAST_GPU=1

110
111
# Performance environment variable.
ENV HIP_FORCE_DEV_KERNARG=1
youkaichao's avatar
youkaichao committed
112

113
CMD ["/bin/bash"]