Skip to content

Commit 169d961

Browse files
author
Yadan Wei
committed
Fix whisperx build: drop Silero VAD bake (GitHub rate-limit)
The Silero bake ran torch.hub.load('snakers4/silero-vad', ...), which makes a live GitHub call at build time and failed with HTTP 403 rate limit exceeded under CI's shared-IP load. Silero is not needed: whisperx 3.8.6 defaults to vad_method="pyannote" and server.py never selects silero. The default pyannote VAD's segmentation model ships inside the whisperx wheel (whisperx/assets/pytorch_model.bin) and loads from a local file with no network (verified with docker run --network=none), so the default serving path is fully offline. Removing the bake eliminates the container's only build/runtime GitHub dependency with no loss on the default or API-exposed path. HF_HOME/TORCH_HOME are kept for lazy runtime caching of Whisper + per-language wav2vec2 aligners.
1 parent 8b2a5ad commit 169d961

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

docker/whisperx/Dockerfile.amzn2023

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,18 @@ RUN find /opt/venv -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null; \
111111
-exec strip --strip-unneeded {} + 2>/dev/null; \
112112
true
113113

114-
# ---- Bake fixed models ----
115-
# Silero VAD: <10 MB, no auth, fetched via torch.hub. Cache under /opt/models
116-
# so the runtime stage can COPY it directly.
114+
# ---- Model cache dirs ----
115+
# HF_HOME / TORCH_HOME are where Whisper + per-language wav2vec2 aligners cache
116+
# lazily at runtime (design Dim 2: too many languages to bake). TORCH_HOME is
117+
# also where whisperx's default (pyannote) VAD resolves torch.hub._get_torch_home().
118+
# The default pyannote VAD segmentation model ships inside the whisperx wheel
119+
# (whisperx/assets/pytorch_model.bin, loaded from a local file — no network), so
120+
# no VAD model is baked here. Silero VAD is not used: whisperx 3.8.6 defaults to
121+
# vad_method="pyannote" and server.py never selects silero, so we avoid its
122+
# torch.hub GitHub download (rate-limit-prone at build and runtime).
117123
ENV HF_HOME=/opt/models/hf
118124
ENV TORCH_HOME=/opt/models/torch
119-
RUN mkdir -p ${HF_HOME} ${TORCH_HOME} \
120-
&& python -c "import torch; torch.hub.load('snakers4/silero-vad', 'silero_vad', trust_repo=True)"
125+
RUN mkdir -p ${HF_HOME} ${TORCH_HOME}
121126

122127
# pyannote diarization weights: pre-downloaded from S3 by scripts/build.sh into
123128
# the build context, extracted here into a fixed path. No HF token, no network

scripts/docker/whisperx/server.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,9 @@ def _resolve_model(requested: str | None) -> str:
121121
async def lifespan(_: FastAPI):
122122
"""Load fixed models before uvicorn binds so /ping stays shallow but honest.
123123
124-
Design §6 decision 8: `/ping` reachable ⇒ pyannote + Silero are resident.
124+
Design §6 decision 8: `/ping` reachable ⇒ the diarization pipeline and the
125+
default Whisper model are resident. VAD uses whisperx's default (pyannote),
126+
whose segmentation model ships inside the whisperx wheel.
125127
"""
126128
global _DIARIZE_PIPELINE
127129
# Warm the default Whisper model so the first request isn't a cold ~30 s

0 commit comments

Comments
 (0)