Skip to content

Commit

Permalink
Fix EOT token handling
Browse files Browse the repository at this point in the history
If it is the end of the audio, pick all sampled tokens.
Otherwise, print error message.
  • Loading branch information
ggerganov committed Oct 17, 2022
1 parent 91632eb commit cf67bff
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions whisper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit cf67bff

Please sign in to comment.