From: Georgi Gerganov Date: Mon, 17 Oct 2022 21:53:06 +0000 (+0300) Subject: Fix EOT token handling X-Git-Tag: upstream/1.7.4~1948 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=cf67bfffa0acec5d09d9756d47e4333c57c92e8c;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp Fix EOT token handling If it is the end of the audio, pick all sampled tokens. Otherwise, print error message. --- diff --git a/whisper.cpp b/whisper.cpp index 98852781..ab229887 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -2445,9 +2445,12 @@ int whisper_full( // end of text token if (id == whisper_token_eot(ctx)) { if (result_len == 0) { - // TODO: figure out how to resolve this - fprintf(stderr, "\n%s: failed to generate timestamp token - this should not happen\n\n", __func__); - //result_len = i + 1; + if (seek + seek_delta + 100 >= whisper_n_len(ctx)) { + result_len = i + 1; + } else { + // TODO: figure out how to resolve this + fprintf(stderr, "\n%s: failed to generate timestamp token - this should not happen\n\n", __func__); + } } break; }