Skip to content

Commit 7990721

Browse files
authored
Merge pull request #228 from red-hat-data-services/vllm-fix-s390x
Fix Transformer Version Compatibility for s390x
2 parents bbcfe3a + 048af5e commit 7990721

File tree

1 file changed

+30
-9
lines changed

1 file changed

+30
-9
lines changed

Dockerfile.s390x.ubi

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,25 +166,46 @@ RUN --mount=type=cache,target=/root/.cache/uv \
166166
--mount=type=bind,from=torch-vision,source=/tmp/vision/dist,target=/tmp/vision-wheels/ \
167167
--mount=type=bind,from=hf-xet-builder,source=/tmp/hf-xet/dist,target=/tmp/hf-xet-wheels/ \
168168
--mount=type=bind,from=torch,source=/tmp/pytorch/dist,target=/tmp/torch-wheels/ \
169-
sed -i '/^torch/d' requirements/build.txt && \
170-
ARROW_WHL_FILE=$(ls /tmp/arrow-wheels/pyarrow-*.whl | head -n 1) && \
171-
VISION_WHL_FILE=$(ls /tmp/vision-wheels/*.whl | head -n 1) && \
172-
HF_XET_WHL_FILE=$(ls /tmp/hf-xet-wheels/*.whl | head -n 1) && \
173-
TORCH_WHL_FILE=$(ls /tmp/torch-wheels/*.whl | head -n 1) && \
174-
uv pip install -v \
175-
$ARROW_WHL_FILE \
169+
\
170+
# Remove any tokenizers pin (fix conflict)
171+
sed -i '/tokenizers/d' requirements/common.txt && \
172+
sed -i '/tokenizers/d' requirements/build.txt && \
173+
sed -i '/tokenizers/d' requirements/cpu.txt && \
174+
\
175+
# Remove PyTorch entries in build.txt
176+
sed -i '/^torch/d' requirements/build.txt && \
177+
\
178+
# Set transformers to a compatible version
179+
sed -i 's/^transformers.*/transformers==4.45.2/' requirements/common.txt && \
180+
\
181+
# Extract wheels
182+
ARROW_WHL_FILE=$(ls /tmp/arrow-wheels/pyarrow-*.whl | head -n 1) && \
183+
VISION_WHL_FILE=$(ls /tmp/vision-wheels/*.whl | head -n 1) && \
184+
HF_XET_WHL_FILE=$(ls /tmp/hf-xet-wheels/*.whl | head -n 1) && \
185+
TORCH_WHL_FILE=$(ls /tmp/torch-wheels/*.whl | head -n 1) && \
186+
\
187+
# Pre-install compatible tokenizers (<0.21)
188+
uv pip install -v "tokenizers<0.21" --index-strategy unsafe-best-match && \
189+
\
190+
# Install remaining deps
191+
uv pip install -v \
192+
$ARROW_WHL_FILE \
176193
$VISION_WHL_FILE \
177194
$HF_XET_WHL_FILE \
178195
$TORCH_WHL_FILE \
179196
--index-strategy unsafe-best-match \
180197
-r requirements/build.txt \
181198
-r requirements/cpu.txt
182199

183-
# Build and install vllm
200+
# Build and install vLLM
184201
RUN --mount=type=cache,target=/root/.cache/uv \
185202
SETUPTOOLS_SCM_PRETEND_VERSION="$VLLM_VERSION" \
186203
VLLM_TARGET_DEVICE=cpu python setup.py bdist_wheel && \
187-
uv pip install "$(echo dist/*.whl)[tensorizer]"
204+
uv pip install "$(echo dist/*.whl)[tensorizer]" && \
205+
# Dynamically patch BatchFeature import for transformers >=4.45
206+
VLLM_DIR=$(uv pip show vllm | grep Location | awk '{print $2}') && \
207+
sed -i "s|from transformers.feature_extraction_utils import BatchFeature, PretrainedConfig, ProcessorMixin|from transformers import PretrainedConfig, ProcessorMixin\nfrom transformers.feature_extraction_utils import BatchFeature|" \
208+
$VLLM_DIR/vllm/inputs/registry.py
188209

189210
# setup non-root user for vllm
190211
RUN umask 002 && \

0 commit comments

Comments
 (0)