Repository navigation
[#142] Fix macOS transcription hang from lazy model downloads - #143
Merged
Merged
Conversation
speaker-diarization-3.1 loads pyannote/wespeaker-voxceleb-resnet34-LM at instantiation, but it was absent from required_repos(), so the bundled service downloaded it lazily at the diarization step (70%) into an isolated empty HF cache with no timeout — hanging the job. Pre-fetch it during provisioning. Add a provisioning_version gate so already-provisioned installs (flag set but missing the new repo) re-provision instead of silently lacking it. status() and models_ready() both report via the version gate so /api/provisioning, /api/health and the upload gate agree.
Model-load calls at the diarization (70%) and alignment (50%) stages can stall on a slow/interrupted download with no way to fail. Wrap them in a daemon-thread watchdog (_call_with_timeout) so a stalled or wedged stage degrades — no-diarization, or segment-level timestamps — instead of hanging the meeting indefinitely.
Without hf_xet, huggingface_hub falls back to plain HTTP transfers, the slow path behind first-run download stalls. Add it to requirements and collect it in the PyInstaller bundle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #142
Summary
The bundled macOS app hangs mid-transcription (reported: all night stuck at 70%), while the dev/web app on the same machine transcribes fine. Both run on the same CPU with the same code — the difference is the bundle downloading a model at runtime.
provisioning.required_repos()pre-fetched the whisper weights + pyannote segmentation/diarization repos, but notpyannote/wespeaker-voxceleb-resnet34-LM, the speaker-embedding model thatspeaker-diarization-3.1loads when the pipeline is instantiated — exactly atstage=diarizing, progress=70. The bundle uses an isolated, emptyHF_HOME, so it downloaded this model at runtime over plain HTTP (hf_xetabsent → Xet disabled), with no timeout. A slow/stalled download hung the job at 70% indefinitely. The dev/web run reuses a warm~/.cache/huggingfaceand never downloads. The same lazy-download pattern affects the alignment stage (50%) for HF-aligned languages.Approach
pyannote/wespeaker-voxceleb-resnet34-LMtorequired_repos()so first-run provisioning fetches it, not the transcription path.ServiceConfig.provisioning_version+PROVISIONING_VERSION;_run_downloadstamps it, and bothmodels_ready()andstatus()report via the gate so/api/provisioning,/api/health, and the upload gate agree — old-version installs re-provision through the setup wizard._call_with_timeoutwraps the diarization and both alignment model-load sites; a stalled/wedged stage degrades (no-diarization, or segment-level timestamps) instead of hanging.hf_xet— restores accelerated Xet transfers instead of slow plain HTTP.Reviewed by the Argus architect (pass). Not addressed here: full first-run parity for lazily-downloaded alignment models across all languages — tracked as #141.
Note: faster-whisper/CTranslate2 has no MPS backend, so Whisper stays CPU-bound on Mac — this fixes the hang and download stalls, not raw CPU compute cost.
Verification
pytest tests/— 401 passed. New coverage: diarization/alignment watchdog timeout + happy paths, embedding repo inrequired_repos(), version-gate rejection at the upload gate and instatus().ruff check+ruff format --check— clean.