A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 10, 21:30 UTC
[ROCm][CI] Add TorchCodec source build for transcription tests (#31323)
Signed-off-by: Andreas Karatzas <akaratza@amd.com>
Andreas Karatzas committed
Dec 28, 2025 at 02:06 UTC
f70368867e0fd5bd0ef466c154aeb2e981fa24a2
3 files changed
+102
-1
.buildkite/test-amd.yaml
+4
-1
@@ -774,8 +774,9 @@ steps:
774
- csrc/
775
- vllm/entrypoints/openai/
776
- vllm/model_executor/models/whisper.py
777
+ - tools/
778
commands: # LMEval+Transcription WER check
778
- # Transcription WER check is skipped because encoder-decoder models are not supported on ROCm, see https://github.com/vllm-project/vllm/issues/27442
779
+ - bash ../tools/install_torchcodec_rocm.sh || exit 1
780
- pytest -s entrypoints/openai/correctness/
781
782
@@ -1604,6 +1605,8 @@ steps:
1605
- .buildkite/scripts/run-prime-rl-test.sh
1606
commands:
1607
- bash .buildkite/scripts/run-prime-rl-test.sh
1608
+
1609
+##### EPLB Accuracy Tests #####
1610
- label: DeepSeek V2-Lite Accuracy
1611
mirror_hardwares: [amdexperimental, amdproduction]
1612
agent_pool: mi325_4
docker/Dockerfile.rocm
+8
@@ -97,6 +97,14 @@ RUN --mount=type=cache,target=/root/.cache/uv \
97
uv pip install --system hf_transfer
98
ENV HF_HUB_ENABLE_HF_TRANSFER=1
99
100
+# install audio decode package `torchcodec` from source (required due to
101
+# ROCm and torch version mismatch) for tests with datasets package
102
+COPY tools/install_torchcodec_rocm.sh /tmp/install_torchcodec.sh
103
+RUN bash /tmp/install_torchcodec.sh \
104
+ && rm /tmp/install_torchcodec.sh \
105
+ && apt-get clean \
106
+ && rm -rf /var/lib/apt/lists/*
107
+
108
# Copy in the v1 package (for python-only install test group)
109
COPY --from=export_vllm /vllm_v1 /usr/local/lib/python${PYTHON_VERSION}/dist-packages/vllm/v1
110
tools/install_torchcodec_rocm.sh
new
+90
@@ -0,0 +1,90 @@
1
+#!/bin/bash
2
+# SPDX-License-Identifier: Apache-2.0
3
+# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
4
+
5
+# Script to install TorchCodec from source (required for ROCm compatibility)
6
+
7
+set -e
8
+
9
+TORCHCODEC_REPO="${TORCHCODEC_REPO:-https://github.com/pytorch/torchcodec.git}"
10
+TORCHCODEC_BRANCH="${TORCHCODEC_BRANCH:-main}"
11
+
12
+echo "=== TorchCodec Installation Script ==="
13
+
14
+# Check if torchcodec is already installed and working
15
+if python3 -c "from torchcodec.decoders import VideoDecoder" 2>/dev/null; then
16
+ echo "TorchCodec is already installed and working. Skipping."
17
+ exit 0
18
+fi
19
+
20
+echo "TorchCodec not found. Installing from source..."
21
+
22
+# Install system dependencies (FFmpeg + pkg-config)
23
+install_system_deps() {
24
+ if command -v apt-get &> /dev/null; then
25
+ echo "Installing system dependencies..."
26
+ apt-get update && apt-get install -y --no-install-recommends \
27
+ pkg-config \
28
+ ffmpeg libavcodec-dev libavformat-dev libavutil-dev \
29
+ libswscale-dev libavdevice-dev libavfilter-dev libswresample-dev
30
+ else
31
+ echo "Warning: apt-get did not work. Please install dependencies manually."
32
+ return 1
33
+ fi
34
+}
35
+
36
+# Check for pkg-config
37
+if ! command -v pkg-config &> /dev/null; then
38
+ echo "pkg-config not found. Installing system dependencies..."
39
+ install_system_deps
40
+fi
41
+
42
+# Check for required FFmpeg libraries
43
+echo "Checking for FFmpeg libraries..."
44
+if ! pkg-config --exists libavcodec libavformat libavutil libswscale libavdevice libavfilter libswresample 2>/dev/null; then
45
+ echo "FFmpeg development libraries not found. Installing..."
46
+ install_system_deps
47
+fi
48
+
49
+# Install Python build dependencies
50
+echo "Installing Python build dependencies..."
51
+pip install pybind11 setuptools wheel
52
+
53
+# Set pybind11 cmake path so CMake can find it
54
+export pybind11_DIR=$(python3 -c "import pybind11; print(pybind11.get_cmake_dir())")
55
+export CMAKE_PREFIX_PATH="${pybind11_DIR}:${CMAKE_PREFIX_PATH}"
56
+echo "pybind11_DIR set to: $pybind11_DIR"
57
+
58
+# Create temp directory for build
59
+BUILD_DIR=$(mktemp -d -t torchcodec-XXXXXX)
60
+echo "Building in temporary directory: $BUILD_DIR"
61
+
62
+cleanup() {
63
+ echo "Cleaning up $BUILD_DIR"
64
+ rm -rf "$BUILD_DIR"
65
+}
66
+trap cleanup EXIT
67
+
68
+# Clone and build
69
+cd "$BUILD_DIR"
70
+echo "Cloning TorchCodec from $TORCHCODEC_REPO (branch: $TORCHCODEC_BRANCH)..."
71
+git clone --depth 1 --branch "$TORCHCODEC_BRANCH" "$TORCHCODEC_REPO" torchcodec
72
+
73
+cd torchcodec
74
+
75
+# Set build environment for ROCm compatibility
76
+export TORCHCODEC_CMAKE_BUILD_DIR="${PWD}/build"
77
+export TORCHCODEC_DISABLE_COMPILE_WARNING_AS_ERROR=1
78
+export I_CONFIRM_THIS_IS_NOT_A_LICENSE_VIOLATION=1
79
+
80
+echo "Building TorchCodec..."
81
+pip install . --no-build-isolation
82
+
83
+# Verify installation
84
+echo "Verifying installation..."
85
+if python3 -c "from torchcodec.decoders import VideoDecoder; print('TorchCodec installed successfully!')"; then
86
+ echo "=== TorchCodec installation complete ==="
87
+else
88
+ echo "Error: TorchCodec installation failed verification"
89
+ exit 1
90
+fi
\ No newline at end of file