whisper: don't force a timestamp after 16 tokens — truncated every transcription (#698) - #699
Open
Anjielon wants to merge 1 commit into
Open
whisper: don't force a timestamp after 16 tokens — truncated every transcription (#698)#699Anjielon wants to merge 1 commit into
Anjielon wants to merge 1 commit into
Conversation
… transcription (ROCm#698) After 16 content tokens without a timestamp, the decode loop force-sampled a timestamp token; Whisper treats it as end-of-segment and emits EOT, so any continuous speech longer than ~4 s came back cut at ~15 tokens. Reproduced on the 1.0.3 Linux release and on a from-source build (Strix Halo / NPU2, FW 1.1.2.65). Raising the watchdog to the decoder maximum (448) fixes it: 7.3 s Italian clip, 50 -> 115 chars, full sentence, 5.0 s on NPU. Fixes ROCm#698
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.
Fixes #698.
What happens
After 16 content tokens without a timestamp, the decode loop in
Whisper::generate()force-samples a timestamp token (watching_dog). Whisper treats that as end-of-segment and emits EOT, so any continuous speech longer than ~4 s comes back cut at ~15 tokens — on Linux the/v1/audio/transcriptionsendpoint returned the same 50-character prefix for 3.2 s, 5 s and 7.3 s clips alike, regardless ofresponse_format,languageor--ctx-len.Reproduced on the 1.0.3 Linux release and on a from-source build of
main(Ryzen AI MAX+ 395 / NPU2, FW 1.1.2.65, amdxdna 0.6, kernel 7.0.8).The change
Raise the watchdog from 16 to the decoder maximum (448), so the guard only fires on a genuinely runaway decode. One line plus a comment.
Verified on device with the same 7.3 s Italian clip:
Domani alle 9 accendi le luci del soggiorno e ricDomani alle 9 accendi le luci del soggiorno e ricordami di comprare il latte e le uova al supermercato e se lunga.5.0 s per transcription on NPU2, output matches whisper.cpp on GPU for the same clip.
If you'd rather keep a tighter guard, an alternative is to only force a timestamp when the model has produced no content tokens either, or to make the threshold configurable — happy to rework it that way.
🤖 Generated with Claude Code
https://claude.ai/code/session_01FEsCw8PTJjca1mUwu6jMzX