Skip to content

[#142] Fix macOS transcription hang from lazy model downloads - #143

Merged
julien731 merged 3 commits into
mainfrom
macos-transcribe-stuck-70
Sep 4, 2026
Merged

julien731 merged 3 commits into
mainfrom
macos-transcribe-stuck-70

Conversation

@julien731

Copy link
Copy Markdown
Member

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 not pyannote/wespeaker-voxceleb-resnet34-LM, the speaker-embedding model that speaker-diarization-3.1 loads when the pipeline is instantiated — exactly at stage=diarizing, progress=70. The bundle uses an isolated, empty HF_HOME, so it downloaded this model at runtime over plain HTTP (hf_xet absent → Xet disabled), with no timeout. A slow/stalled download hung the job at 70% indefinitely. The dev/web run reuses a warm ~/.cache/huggingface and never downloads. The same lazy-download pattern affects the alignment stage (50%) for HF-aligned languages.

Approach

  • Pre-provision the embedding model — add pyannote/wespeaker-voxceleb-resnet34-LM to required_repos() so first-run provisioning fetches it, not the transcription path.
  • Version-gate provisioning — a persisted boolean alone would leave already-provisioned installs (flag set, new repo missing) broken. Added ServiceConfig.provisioning_version + PROVISIONING_VERSION; _run_download stamps it, and both models_ready() and status() report via the gate so /api/provisioning, /api/health, and the upload gate agree — old-version installs re-provision through the setup wizard.
  • Wall-clock watchdog — _call_with_timeout wraps the diarization and both alignment model-load sites; a stalled/wedged stage degrades (no-diarization, or segment-level timestamps) instead of hanging.
  • Bundle 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 in required_repos(), version-gate rejection at the upload gate and in status().
  • ruff check + ruff format --check — clean.

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.
@julien731 julien731 added the bug Something isn't working label Sep 4, 2026
@julien731 julien731 self-assigned this Sep 4, 2026
@julien731
julien731 merged commit ee8254f into main Sep 4, 2026
5 checks passed
@julien731
julien731 deleted the macos-transcribe-stuck-70 branch September 4, 2026 05:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS app transcription hangs at 70% (and 50%) on lazy model download

1 participant