Skip to content

Commit b5ddb16

Browse files
authored
whisper : condition timestamps to be monotonically increasing (ggerganov#425)
1 parent ae16c21 commit b5ddb16

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

whisper.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -2988,6 +2988,16 @@ static void whisper_process_logits(
29882988
}
29892989
}
29902990

2991+
// condition timestamp tokens to be increasing
2992+
// ref: https://github.com/openai/whisper/pull/831#issuecomment-1385910556
2993+
if (decoder.has_ts) {
2994+
const int tid0 = decoder.seek_delta/2;
2995+
2996+
for (int i = vocab.token_beg; i < vocab.token_beg + tid0; ++i) {
2997+
logits[i] = -INFINITY;
2998+
}
2999+
}
3000+
29913001
// populate the logprobs array (log_softmax)
29923002
{
29933003
const float logit_max = *std::max_element(logits.begin(), logits.end());

0 commit comments

Comments
 (0)