v0.12.0:2 - hotfix: pin NGC's torch versions so pip can't break the ABI
WhisperX docker build was crashing at the model-prewarm step: OSError: undefined symbol: torch_library_impl Root cause: the NGC PyTorch base ships custom builds of torch + torchaudio + torchvision matched together for Blackwell (sm_120). When pip installed whisperx, it pulled the latest stock torchaudio wheel as a transitive dep, which was compiled against a different libtorch and won't load against NGC's. Fix: at build time, capture NGC's actual torch/torchaudio/torchvision versions into /tmp/torch-constraints.txt, then `pip install -c` that constraint for all subsequent installs. pip can't swap torch out, so the ABI stays consistent. whisperx and pyannote are happy with torch>=2.0 — NGC's 2.10.0a0 satisfies that easily. The pinned versions print to the build log so you can see them. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -26,10 +26,23 @@ RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends ffmpeg \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Install whisperx + the FastAPI wrapper deps. --break-system-packages because
|
||||
# the NGC PyTorch image has its own managed Python that's flagged "system".
|
||||
# CRITICAL: the NGC base image ships custom builds of torch + torchaudio +
|
||||
# torchvision compiled together for Blackwell (sm_120). If pip pulls a stock
|
||||
# torchaudio wheel as a transitive dep of whisperx/pyannote, the resulting
|
||||
# ABI mismatch crashes at import time:
|
||||
# "undefined symbol: torch_library_impl"
|
||||
# Generate a constraints.txt from whatever versions NGC actually shipped,
|
||||
# then pass it to every pip install so pip cannot swap torch out.
|
||||
RUN python3 -c "import torch, torchaudio, torchvision; \
|
||||
import sys; \
|
||||
sys.stdout.write(f'torch=={torch.__version__}\ntorchaudio=={torchaudio.__version__}\ntorchvision=={torchvision.__version__}\n')" \
|
||||
> /tmp/torch-constraints.txt \
|
||||
&& echo '── pinned torch versions ──' && cat /tmp/torch-constraints.txt
|
||||
|
||||
# Install whisperx + the FastAPI wrapper deps under the torch constraint.
|
||||
COPY requirements.txt /tmp/requirements.txt
|
||||
RUN pip install --break-system-packages --no-cache-dir -r /tmp/requirements.txt
|
||||
RUN pip install --break-system-packages --no-cache-dir \
|
||||
-c /tmp/torch-constraints.txt -r /tmp/requirements.txt
|
||||
|
||||
# Pre-warm the default Whisper + alignment models at build time so first-call
|
||||
# latency on a fresh container is small. (~3 GB cached into the image; if you
|
||||
|
||||
Reference in New Issue
Block a user