From 3b5158c1ba3d3787c2af2cf7b9c1017c463b07eb Mon Sep 17 00:00:00 2001 From: Anjielon Date: Tue, 1 Sep 2026 22:47:21 +0200 Subject: [PATCH] =?UTF-8?q?whisper:=20don't=20force=20a=20timestamp=20afte?= =?UTF-8?q?r=2016=20tokens=20=E2=80=94=20it=20truncated=20every=20transcri?= =?UTF-8?q?ption=20(#698)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 #698 --- src/common/whisper/modeling_whisper.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/common/whisper/modeling_whisper.cpp b/src/common/whisper/modeling_whisper.cpp index 7c9362ae..983bedaf 100644 --- a/src/common/whisper/modeling_whisper.cpp +++ b/src/common/whisper/modeling_whisper.cpp @@ -182,7 +182,11 @@ std::pair Whisper::generate(whisper_task_type_t task, os << token_str << std::flush; } - int watching_dog = 16; + // Forcing a timestamp after only 16 content tokens (~4 s of speech) makes + // Whisper close the segment and emit EOT: every transcription was cut at + // ~15 tokens (see issue #698). 448 = decoder max, so the guard only fires + // on a genuinely runaway decode. + int watching_dog = 448; for (int i = 0; i < 448 - 3; i++){ buffer logits = this->whisper_engine->decode_audio(last_idx); if (watching_dog == 0 && allow_force_time_stamp){