Skip to content

Commit

Permalink
whisper : condition timestamps to be monotonically increasing (ggerga…
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov authored Jan 23, 2023
1 parent ae16c21 commit b5ddb16
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit b5ddb16

Please sign in to comment.