Skip to content

Commit

Permalink
revert logsumexp implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
bobqianic authored Feb 6, 2024
1 parent 7baa7a6 commit c0277e3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4967,13 +4967,14 @@ static void whisper_process_logits(
float timestamp_logprob = -INFINITY;
{
float logsumexp = 0.0f;
const float logprob_max = *std::max_element(logprobs.begin() + vocab.token_beg, logprobs.end());
for (int i = vocab.token_beg; i < n_logits; ++i) {
if (logprobs[i] > -INFINITY) {
logsumexp += expf(logprobs[i]);
logsumexp += expf(logprobs[i] - logprob_max);
}
}
if (logsumexp > 0.0f) {
timestamp_logprob = logf(logsumexp);
timestamp_logprob = logf(logsumexp) + logprob_max;
}
}

Expand Down

0 comments on commit c0277e3

Please sign in to comment.