Skip to content

Commit 1036af5

Browse files
authored
Merge pull request #112 from vajain-rhods/RHOAIENG-24207
Merge RHOAIENG-24207 changes into rhoai-2.20
2 parents a6c9a44 + ee1e99c commit 1036af5

File tree

5 files changed

+81
-10
lines changed

5 files changed

+81
-10
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# This script build the CPU docker image and run the offline inference inside the container.
4+
# It serves a sanity check for compilation and basic model usage.
5+
set -ex
6+
7+
# Setup cleanup
8+
remove_docker_container() { docker rm -f cpu-test || true; docker system prune -f; }
9+
trap remove_docker_container EXIT
10+
remove_docker_container
11+
12+
# Try building the docker image
13+
docker build -t cpu-test -f docker/Dockerfile.s390x .

Dockerfile.ppc64le.ubi

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,16 @@ RUN --mount=type=cache,target=/root/.cache/uv \
145145
FROM base-builder AS cv-builder
146146

147147
ARG MAX_JOBS
148-
ARG OPENCV_VERSION=84
148+
ARG OPENCV_VERSION=86
149+
# patch for version 4.11.0.86
150+
ARG OPENCV_PATCH=97f3f39
149151
ARG ENABLE_HEADLESS=1
150152
RUN --mount=type=cache,target=/root/.cache/uv \
151153
source /opt/rh/gcc-toolset-13/enable && \
152154
git clone --recursive https://github.com/opencv/opencv-python.git -b ${OPENCV_VERSION} && \
153155
cd opencv-python && \
154-
sed -i 's/"setuptools==59.2.0",/"setuptools<70.0",/g' pyproject.toml && \
156+
sed -i -E -e 's/"setuptools.+",/"setuptools",/g' pyproject.toml && \
157+
cd opencv && git cherry-pick --no-commit $OPENCV_PATCH && cd .. && \
155158
python -m build --wheel --installer=uv --outdir /opencvwheels/
156159

157160
# build opencv dependent packages
@@ -182,6 +185,11 @@ ARG GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
182185

183186
# this step installs vllm & tgis adapter and populates uv cache
184187
# with all the transitive dependencies
188+
RUN --mount=type=cache,target=/root/.cache/uv \
189+
source /opt/rh/gcc-toolset-13/enable && \
190+
git clone https://github.com/huggingface/xet-core.git && cd xet-core/hf_xet/ && \
191+
uv pip install maturin && \
192+
uv build --wheel --out-dir /hf_wheels/
185193
RUN --mount=type=cache,target=/root/.cache/uv \
186194
--mount=type=bind,from=torch-builder,source=/torchwheels/,target=/torchwheels/,ro \
187195
--mount=type=bind,from=arrow-builder,source=/arrowwheels/,target=/arrowwheels/,ro \
@@ -190,7 +198,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
190198
source /opt/rh/gcc-toolset-13/enable && \
191199
uv pip install /opencvwheels/*.whl /arrowwheels/*.whl /torchwheels/*.whl && \
192200
sed -i -e 's/.*torch.*//g' /src/pyproject.toml /src/requirements/*.txt && \
193-
uv pip install pandas && \
201+
uv pip install pandas /hf_wheels/*.whl && \
194202
uv pip install -r /src/requirements/common.txt -r /src/requirements/cpu.txt -r /src/requirements/build.txt --no-build-isolation && \
195203
cd /src/ && \
196204
uv build --wheel --out-dir /vllmwheel/ --no-build-isolation && \
@@ -275,8 +283,9 @@ RUN --mount=type=cache,target=/root/.cache/uv \
275283
--mount=type=bind,from=torch-builder,source=/torchwheels/,target=/torchwheels/,ro \
276284
--mount=type=bind,from=arrow-builder,source=/arrowwheels/,target=/arrowwheels/,ro \
277285
--mount=type=bind,from=cv-builder,source=/opencvwheels/,target=/opencvwheels/,ro \
286+
--mount=type=bind,from=vllmcache-builder,source=/hf_wheels/,target=/hf_wheels/,ro \
278287
--mount=type=bind,from=vllmcache-builder,source=/vllmwheel/,target=/vllmwheel/,ro \
279-
HOME=/root uv pip install /opencvwheels/*.whl /arrowwheels/*.whl /torchwheels/*.whl /vllmwheel/*.whl
288+
HOME=/root uv pip install /opencvwheels/*.whl /arrowwheels/*.whl /torchwheels/*.whl /hf_wheels/*.whl /vllmwheel/*.whl
280289

281290
WORKDIR /home/vllm
282291

Dockerfile.s390x.ubi

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,22 @@ RUN --mount=type=cache,target=/root/.cache/uv \
9898
python setup.py bdist_wheel && \
9999
uv pip install dist/*.whl
100100

101+
FROM python-install AS hf-xet-builder
102+
# Install hf-xet
103+
WORKDIR /tmp
104+
ENV CARGO_HOME=/root/.cargo
105+
ENV RUSTUP_HOME=/root/.rustup
106+
ENV PATH="$CARGO_HOME/bin:$RUSTUP_HOME/bin:$PATH"
107+
RUN --mount=type=cache,target=/root/.cache/uv \
108+
--mount=type=bind,from=rust,source=/root/.cargo,target=/root/.cargo,rw \
109+
--mount=type=bind,from=rust,source=/root/.rustup,target=/root/.rustup,rw \
110+
git clone https://github.com/huggingface/xet-core.git && \
111+
cd xet-core/hf_xet/ && \
112+
uv pip install maturin patchelf && \
113+
python -m maturin build --release --out dist && \
114+
mkdir -p /tmp/hf-xet/dist && \
115+
cp dist/*.whl /tmp/hf-xet/dist/
116+
101117
# Final build stage
102118
FROM python-install AS vllm-openai
103119
ARG PYTHON_VERSION
@@ -118,12 +134,15 @@ RUN --mount=type=cache,target=/root/.cache/uv \
118134
--mount=type=bind,from=rust,source=/root/.cargo,target=/root/.cargo,rw \
119135
--mount=type=bind,from=rust,source=/root/.rustup,target=/root/.rustup,rw \
120136
--mount=type=bind,from=pyarrow,source=/tmp/arrow/python/dist,target=/tmp/arrow-wheels \
137+
--mount=type=bind,from=hf-xet-builder,source=/tmp/hf-xet/dist,target=/tmp/hf-xet-wheels/ \
121138
export PATH="/root/.cargo/bin:/root/.rustup/bin:$PATH" \
122139
ARROW_WHL_FILE=$(ls /tmp/arrow-wheels/pyarrow-*.whl | head -n 1) && \
123140
sed -i '/^torch/d' requirements/build.txt && \
124141
sed -i '/^numba/d' requirements/common.txt && \
142+
HF_XET_WHL_FILE=$(ls /tmp/hf-xet-wheels/*.whl | head -n 1) && \
125143
uv pip install -v \
126144
$ARROW_WHL_FILE \
145+
$HF_XET_WHL_FILE \
127146
--extra-index-url https://download.pytorch.org/whl/nightly/cpu \
128147
--index-strategy unsafe-best-match \
129148
-r requirements/build.txt \

docker/Dockerfile.ppc64le

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,16 @@ RUN --mount=type=cache,target=/root/.cache/uv \
126126
FROM base-builder AS cv-builder
127127

128128
ARG MAX_JOBS
129-
ARG OPENCV_VERSION=84
129+
ARG OPENCV_VERSION=86
130+
# patch for version 4.11.0.86
131+
ARG OPENCV_PATCH=97f3f39
130132
ARG ENABLE_HEADLESS=1
131133
RUN --mount=type=cache,target=/root/.cache/uv \
132134
source /opt/rh/gcc-toolset-13/enable && \
133135
git clone --recursive https://github.com/opencv/opencv-python.git -b ${OPENCV_VERSION} && \
134136
cd opencv-python && \
135-
sed -i 's/"setuptools==59.2.0",/"setuptools<70.0",/g' pyproject.toml && \
137+
sed -i -E -e 's/"setuptools.+",/"setuptools",/g' pyproject.toml && \
138+
cd opencv && git cherry-pick --no-commit $OPENCV_PATCH && cd .. && \
136139
python -m build --wheel --installer=uv --outdir /opencvwheels/
137140

138141
###############################################################
@@ -148,9 +151,15 @@ COPY --from=arrow-builder /tmp/control /dev/null
148151
COPY --from=cv-builder /tmp/control /dev/null
149152

150153
ARG VLLM_TARGET_DEVICE=cpu
154+
ARG GRPC_PYTHON_BUILD_SYSTEM_OPENSSL=1
151155

152156
# this step installs vllm and populates uv cache
153157
# with all the transitive dependencies
158+
RUN --mount=type=cache,target=/root/.cache/uv \
159+
source /opt/rh/gcc-toolset-13/enable && \
160+
git clone https://github.com/huggingface/xet-core.git && cd xet-core/hf_xet/ && \
161+
uv pip install maturin && \
162+
uv build --wheel --out-dir /hf_wheels/
154163
RUN --mount=type=cache,target=/root/.cache/uv \
155164
--mount=type=bind,from=torch-builder,source=/torchwheels/,target=/torchwheels/,ro \
156165
--mount=type=bind,from=arrow-builder,source=/arrowwheels/,target=/arrowwheels/,ro \
@@ -159,7 +168,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
159168
source /opt/rh/gcc-toolset-13/enable && \
160169
uv pip install /opencvwheels/*.whl /arrowwheels/*.whl /torchwheels/*.whl && \
161170
sed -i -e 's/.*torch.*//g' /src/pyproject.toml /src/requirements/*.txt && \
162-
uv pip install pandas pythran pybind11 && \
171+
uv pip install pandas pythran pybind11 /hf_wheels/*.whl && \
163172
# sentencepiece.pc is in some pkgconfig inside uv cache
164173
export PKG_CONFIG_PATH=$(find / -type d -name "pkgconfig" 2>/dev/null | tr '\n' ':') && \
165174
uv pip install -r /src/requirements/common.txt -r /src/requirements/cpu.txt -r /src/requirements/build.txt --no-build-isolation && \
@@ -247,8 +256,9 @@ RUN --mount=type=cache,target=/root/.cache/uv \
247256
--mount=type=bind,from=torch-builder,source=/torchwheels/,target=/torchwheels/,ro \
248257
--mount=type=bind,from=arrow-builder,source=/arrowwheels/,target=/arrowwheels/,ro \
249258
--mount=type=bind,from=cv-builder,source=/opencvwheels/,target=/opencvwheels/,ro \
259+
--mount=type=bind,from=vllmcache-builder,source=/hf_wheels/,target=/hf_wheels/,ro \
250260
--mount=type=bind,from=vllmcache-builder,source=/vllmwheel/,target=/vllmwheel/,ro \
251-
HOME=/root uv pip install /opencvwheels/*.whl /arrowwheels/*.whl /torchwheels/*.whl /vllmwheel/*.whl
261+
HOME=/root uv pip install /opencvwheels/*.whl /arrowwheels/*.whl /torchwheels/*.whl /hf_wheels/*.whl /vllmwheel/*.whl
252262

253263
COPY ./ /workspace/vllm
254264
WORKDIR /workspace/vllm

docker/Dockerfile.s390x

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ RUN --mount=type=cache,target=/root/.cache/uv \
5858
cd ../../python && \
5959
export PYARROW_PARALLEL=4 && \
6060
export ARROW_BUILD_TYPE=release && \
61-
uv pip install -r requirements/build.txt && \
61+
uv pip install -r requirements-build.txt && \
6262
python setup.py build_ext --build-type=$ARROW_BUILD_TYPE --bundle-arrow-cpp bdist_wheel
6363

6464
FROM python-install AS numa-build
@@ -96,6 +96,22 @@ RUN --mount=type=cache,target=/root/.cache/uv \
9696
uv pip install -v torch==${TORCH_VERSION} --extra-index-url https://download.pytorch.org/whl/nightly/cpu && \
9797
python setup.py bdist_wheel
9898

99+
FROM python-install AS hf-xet-builder
100+
# Install hf-xet
101+
WORKDIR /tmp
102+
ENV CARGO_HOME=/root/.cargo
103+
ENV RUSTUP_HOME=/root/.rustup
104+
ENV PATH="$CARGO_HOME/bin:$RUSTUP_HOME/bin:$PATH"
105+
RUN --mount=type=cache,target=/root/.cache/uv \
106+
--mount=type=bind,from=rust,source=/root/.cargo,target=/root/.cargo,rw \
107+
--mount=type=bind,from=rust,source=/root/.rustup,target=/root/.rustup,rw \
108+
git clone https://github.com/huggingface/xet-core.git && \
109+
cd xet-core/hf_xet/ && \
110+
uv pip install maturin patchelf && \
111+
python -m maturin build --release --out dist && \
112+
mkdir -p /tmp/hf-xet/dist && \
113+
cp dist/*.whl /tmp/hf-xet/dist/
114+
99115
# Final build stage
100116
FROM python-install AS vllm-cpu
101117
ARG PYTHON_VERSION
@@ -120,12 +136,15 @@ RUN --mount=type=cache,target=/root/.cache/uv \
120136
--mount=type=bind,from=rust,source=/root/.rustup,target=/root/.rustup,rw \
121137
--mount=type=bind,from=pyarrow,source=/tmp/arrow/python/dist,target=/tmp/arrow-wheels \
122138
--mount=type=bind,from=torch-vision,source=/tmp/vision/dist,target=/tmp/vision-wheels/ \
139+
--mount=type=bind,from=hf-xet-builder,source=/tmp/hf-xet/dist,target=/tmp/hf-xet-wheels/ \
123140
sed -i '/^torch/d' requirements/build.txt && \
124141
ARROW_WHL_FILE=$(ls /tmp/arrow-wheels/pyarrow-*.whl | head -n 1) && \
125142
VISION_WHL_FILE=$(ls /tmp/vision-wheels/*.whl | head -n 1) && \
143+
HF_XET_WHL_FILE=$(ls /tmp/hf-xet-wheels/*.whl | head -n 1) && \
126144
uv pip install -v \
127145
$ARROW_WHL_FILE \
128146
$VISION_WHL_FILE \
147+
$HF_XET_WHL_FILE \
129148
--extra-index-url https://download.pytorch.org/whl/nightly/cpu \
130149
--index-strategy unsafe-best-match \
131150
-r requirements/build.txt \
@@ -149,4 +168,5 @@ USER 2000
149168
WORKDIR /home/vllm
150169

151170
# Set the default entrypoint
152-
ENTRYPOINT ["python", "-m", "vllm.entrypoints.openai.api_server"]
171+
ENTRYPOINT ["python", "-m", "vllm.entrypoints.openai.api_server"]
172+

0 commit comments

Comments
 (0)