Skip to content

fix(whisperx): keep the transcript when diarization fails, report real errors - #12427

Merged
mudler merged 1 commit into
mudler:masterfrom
walcz-de:fix/whisperx-keep-transcript-on-diarization-error
Oct 2, 2026
Merged

mudler merged 1 commit into
mudler:masterfrom
walcz-de:fix/whisperx-keep-transcript-on-diarization-error

Conversation

@walcz-de

@walcz-de walcz-de commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Description

AudioTranscription in the whisperx backend caught every exception and returned an empty TranscriptResult. A failure in the diarization step therefore discarded a transcript that was already finished. Since /v1/audio/transcriptions treats a missing diarize field as true, every request reaches that step; when the HF token has not accepted the terms of the gated pyannote/speaker-diarization-community-1 pipeline, the download fails with 403 and every transcription came back as an empty text with HTTP 200 (backend log: language detected, alignment done, then GatedRepoError, result empty).

Diarization now degrades: if it fails, the transcript is returned without speaker labels and the reason is logged. Any other failure aborts the call with INTERNAL instead of returning an empty, successful-looking result.

test_transcript_utils.py covers the new diarize_or_keep helper: a refused diarization keeps the transcript and logs the error; a successful one is returned.

Notes for Reviewers

A related inconsistency I did not change: the endpoint enables diarization unless diarize=false is sent (relied on by parakeet-cpp since #12335), while whisperx rejects diarization without HF_TOKEN (#8744de44d). So a whisperx install without a token fails every plain transcription with FailedPrecondition. Making whisperx skip diarization when it was not explicitly requested would need the request to carry whether the field was set; I left that decision to you.

Signed commits

  • Yes, I signed my commits.
  • Documentation updated (docs/content/) for user-facing changes, or not applicable

🤖 Generated with Claude Code

@localai-org-maint-bot

Copy link
Copy Markdown
Collaborator

@mudler code review looks good at d07bf5f80 against master 53cd6c571, subject to the required CI and DCO checks.

The diarization fallback preserves the available transcript, while transcription failures now return a gRPC error. The missing-token precondition remains separate. I added documentation for the fallback and error behavior.

Validation: Static review and git diff --check passed. Python tests could not run because the installed Python executable requires a runtime loader unavailable in this environment.

The documentation commit is pushed to this PR branch. I left its human DCO sign-off to the contributor. No merge performed.

…l errors

AudioTranscription caught every exception and returned an empty
TranscriptResult. A failed diarization step therefore discarded a
transcript that was already finished: with an HF token that has not
accepted the terms of the gated pyannote pipeline, the download fails
with 403 and every transcription came back as an empty text with
HTTP 200.

Diarization now degrades: if it fails, the transcript is returned
without speaker labels and the reason is logged. Any other failure
aborts the call with INTERNAL instead of pretending success with an
empty text.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Stefan Walcz <stefan.walcz@walcz.de>
@walcz-de
walcz-de force-pushed the fix/whisperx-keep-transcript-on-diarization-error branch from d07bf5f to 13307ea Compare October 2, 2026 06:41
@walcz-de

walcz-de commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review and for adding the documentation. That doc commit had no DCO sign-off, so the DCO check stayed red. I folded equivalent documentation (reworded and checked against the code) into the signed-off fix commit and force-pushed the branch. The code and tests are unchanged from the reviewed state. Sorry for leaving the docs out of the original submission.

@mudler
mudler merged commit 985df46 into mudler:master Oct 2, 2026
1 check passed
@mudler-agent mudler-agent added the bug Something isn't working label Oct 2, 2026
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.

4 participants