ggerganov commited on
Commit
3d98c5d
·
1 Parent(s): 2e71545

Fix EOT token handling

Browse files

If it is the end of the audio, pick all sampled tokens.
Otherwise, print error message.

Files changed (1) hide show
  1. whisper.cpp +6 -3
whisper.cpp CHANGED
@@ -2445,9 +2445,12 @@ int whisper_full(
2445
  // end of text token
2446
  if (id == whisper_token_eot(ctx)) {
2447
  if (result_len == 0) {
2448
- // TODO: figure out how to resolve this
2449
- fprintf(stderr, "\n%s: failed to generate timestamp token - this should not happen\n\n", __func__);
2450
- //result_len = i + 1;
 
 
 
2451
  }
2452
  break;
2453
  }
 
2445
  // end of text token
2446
  if (id == whisper_token_eot(ctx)) {
2447
  if (result_len == 0) {
2448
+ if (seek + seek_delta + 100 >= whisper_n_len(ctx)) {
2449
+ result_len = i + 1;
2450
+ } else {
2451
+ // TODO: figure out how to resolve this
2452
+ fprintf(stderr, "\n%s: failed to generate timestamp token - this should not happen\n\n", __func__);
2453
+ }
2454
  }
2455
  break;
2456
  }