0/0 commited on
Commit
065c497
·
1 Parent(s): f0b585e

check if spectogram length is <100 before doing anything else

Browse files
Files changed (1) hide show
  1. whisper.cpp +7 -0
whisper.cpp CHANGED
@@ -2320,6 +2320,13 @@ int whisper_full(
2320
  return -1;
2321
  }
2322
 
 
 
 
 
 
 
 
2323
  // the accumulated text context so far
2324
  auto & prompt_past = ctx->prompt_past;
2325
  if (params.no_context) {
 
2320
  return -1;
2321
  }
2322
 
2323
+ // if length of spectrogram is less than 1s (100 samples), then return
2324
+ // basically don't process anything that is less than 1s
2325
+ // see issue #39: https://github.com/ggerganov/whisper.cpp/issues/39
2326
+ if (whisper_n_len(ctx) < 100) {
2327
+ return 0;
2328
+ }
2329
+
2330
  // the accumulated text context so far
2331
  auto & prompt_past = ctx->prompt_past;
2332
  if (params.no_context) {