Skip to content

fix(stt): validate empty Qwen3-ASR audio - #931

Open
ainergiz wants to merge 2 commits into
Blaizzy:mainfrom
ainergiz:fix/qwen3-asr-empty-input
Open

fix(stt): validate empty Qwen3-ASR audio#931
ainergiz wants to merge 2 commits into
Blaizzy:mainfrom
ainergiz:fix/qwen3-asr-empty-input

Conversation

@ainergiz

@ainergiz ainergiz commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Closes #928.

Qwen3-ASR accepts invalid audio, reports mlx-audio's minimum-length padding as valid clip duration, and mishandles the model's language None<asr_text> no-speech output. This change validates Qwen3-ASR input before inference, preserves the real duration of short clips, and parses language metadata independently for every chunk.

Changes

  • Reject empty, NaN, and infinite Qwen3-ASR audio before inference.
  • Keep validation in Qwen3-ASR entry points so the shared Fun-ASR chunker retains its existing behavior.
  • Measure duration before min_chunk_duration padding.
  • Use the real duration for ordinary, batched, and streaming segment ends.
  • Parse language None<asr_text> as empty language while preserving any returned text.
  • Accept case and surrounding-whitespace variants of the language marker.
  • Keep requested language immutable and parse auto-detected language per chunk in sequential, batched, and streaming paths.
  • Omit empty no-speech chunks when joining the final transcript.

Scope

This does not add an RMS silence threshold because that could reject quiet speech. Silence detection remains the responsibility of the model or VAD.

Validation

  • Focused Qwen3-ASR and shared-model tests: 62 passed, 1 skipped, 7 subtests passed.
  • Full STT suite: 288 passed, 9 skipped, 25 subtests passed.
  • Black, isort, and git diff --check passed.
  • Real-model checks rejected empty and NaN input before inference.
  • A valid 10 ms clip remained padded for inference but reported a 0.01-second segment end.

@github-actions

Copy link
Copy Markdown

⚠️ The pre-commit checks failed in CI.

Run the following from the repository root, then commit and push any changes:

python -m pip install pre-commit
pre-commit run --all-files

The project's pre-commit configuration includes Black and the other required formatters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Qwen3-ASR mishandles invalid, short, and no-speech audio inputs

1 participant