From: Georgi Gerganov Date: Mon, 23 Jan 2023 18:48:26 +0000 (+0200) Subject: whisper : condition timestamps to be monotonically increasing (#425) X-Git-Tag: upstream/1.7.4~1597 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=b5ddb16ec77f53ffc7b017929f1cfb03a4b018c5;p=pkg%2Fggml%2Fsources%2Fwhisper.cpp whisper : condition timestamps to be monotonically increasing (#425) --- diff --git a/whisper.cpp b/whisper.cpp index d12cc4ae..ef1608d5 100644 --- a/whisper.cpp +++ b/whisper.cpp @@ -2988,6 +2988,16 @@ static void whisper_process_logits( } } + // condition timestamp tokens to be increasing + // ref: https://github.com/openai/whisper/pull/831#issuecomment-1385910556 + if (decoder.has_ts) { + const int tid0 = decoder.seek_delta/2; + + for (int i = vocab.token_beg; i < vocab.token_beg + tid0; ++i) { + logits[i] = -INFINITY; + } + } + // populate the logprobs array (log_softmax) { const float logit_max = *std::max_element(logits.begin(), logits.end());