Merge 6557c53ccca44e10144925f66eb07fe7d9367b4f into 254f6b986720c92ddf97fbb1a6a6465da8e87e29

This commit is contained in:
Andreas Karatzas 2025-12-25 00:07:23 +00:00 committed by GitHub
commit 1da5a4b411
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 99 additions and 1 deletions

View File

@ -775,7 +775,7 @@ steps:
- vllm/entrypoints/openai/
- vllm/model_executor/models/whisper.py
commands: # LMEval+Transcription WER check
# Transcription WER check is skipped because encoder-decoder models are not supported on ROCm, see https://github.com/vllm-project/vllm/issues/27442
- bash tools/install_torchcodec_rocm.sh || exit 1
- pytest -s entrypoints/openai/correctness/

View File

@ -97,6 +97,14 @@ RUN --mount=type=cache,target=/root/.cache/uv \
uv pip install --system hf_transfer
ENV HF_HUB_ENABLE_HF_TRANSFER=1
# install audio decode package `torchcodec` from source (required due to
# ROCm and torch version mismatch) for tests with datasets package
COPY tools/install_torchcodec_rocm.sh /tmp/install_torchcodec.sh
RUN bash /tmp/install_torchcodec.sh \
&& rm /tmp/install_torchcodec.sh \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy in the v1 package (for python-only install test group)
COPY --from=export_vllm /vllm_v1 /usr/local/lib/python${PYTHON_VERSION}/dist-packages/vllm/v1

View File

@ -0,0 +1,90 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Script to install TorchCodec from source (required for ROCm compatibility)
set -e
TORCHCODEC_REPO="${TORCHCODEC_REPO:-https://github.com/pytorch/torchcodec.git}"
TORCHCODEC_BRANCH="${TORCHCODEC_BRANCH:-main}"
echo "=== TorchCodec Installation Script ==="
# Check if torchcodec is already installed and working
if python3 -c "from torchcodec.decoders import VideoDecoder" 2>/dev/null; then
echo "TorchCodec is already installed and working. Skipping."
exit 0
fi
echo "TorchCodec not found. Installing from source..."
# Install system dependencies (FFmpeg + pkg-config)
install_system_deps() {
if command -v apt-get &> /dev/null; then
echo "Installing system dependencies..."
apt-get update && apt-get install -y --no-install-recommends \
pkg-config \
ffmpeg libavcodec-dev libavformat-dev libavutil-dev \
libswscale-dev libavdevice-dev libavfilter-dev libswresample-dev
else
echo "Warning: apt-get did not work. Please install dependencies manually."
return 1
fi
}
# Check for pkg-config
if ! command -v pkg-config &> /dev/null; then
echo "pkg-config not found. Installing system dependencies..."
install_system_deps
fi
# Check for required FFmpeg libraries
echo "Checking for FFmpeg libraries..."
if ! pkg-config --exists libavcodec libavformat libavutil libswscale libavdevice libavfilter libswresample 2>/dev/null; then
echo "FFmpeg development libraries not found. Installing..."
install_system_deps
fi
# Install Python build dependencies
echo "Installing Python build dependencies..."
pip install pybind11 setuptools wheel
# Set pybind11 cmake path so CMake can find it
export pybind11_DIR=$(python3 -c "import pybind11; print(pybind11.get_cmake_dir())")
export CMAKE_PREFIX_PATH="${pybind11_DIR}:${CMAKE_PREFIX_PATH}"
echo "pybind11_DIR set to: $pybind11_DIR"
# Create temp directory for build
BUILD_DIR=$(mktemp -d -t torchcodec-XXXXXX)
echo "Building in temporary directory: $BUILD_DIR"
cleanup() {
echo "Cleaning up $BUILD_DIR"
rm -rf "$BUILD_DIR"
}
trap cleanup EXIT
# Clone and build
cd "$BUILD_DIR"
echo "Cloning TorchCodec from $TORCHCODEC_REPO (branch: $TORCHCODEC_BRANCH)..."
git clone --depth 1 --branch "$TORCHCODEC_BRANCH" "$TORCHCODEC_REPO" torchcodec
cd torchcodec
# Set build environment for ROCm compatibility
export TORCHCODEC_CMAKE_BUILD_DIR="${PWD}/build"
export TORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR=1
export I_CONFIRM_THIS_IS_NOT_A_LICENSE_VIOLATION=1
echo "Building TorchCodec..."
pip install . --no-build-isolation
# Verify installation
echo "Verifying installation..."
if python3 -c "from torchcodec.decoders import VideoDecoder; print('TorchCodec installed successfully!')"; then
echo "=== TorchCodec installation complete ==="
else
echo "Error: TorchCodec installation failed verification"
exit 1
fi