]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
check if spectogram length is <100 before doing anything else
author0/0 <redacted>
Tue, 11 Oct 2022 17:49:48 +0000 (11:49 -0600)
committerGeorgi Gerganov <redacted>
Wed, 12 Oct 2022 04:32:42 +0000 (07:32 +0300)
fixes #39

whisper.cpp

index 91bac33bad0a9fe32a5b171db43cadcd433d81c6..a5f79d255cdf4c94d6bedd4e6013ddf41af52a6a 100644 (file)
@@ -2320,6 +2320,13 @@ int whisper_full(
         return -1;
     }
 
+    // if length of spectrogram is less than 1s (100 samples), then return
+    // basically don't process anything that is less than 1s
+    // see issue #39: https://github.com/ggerganov/whisper.cpp/issues/39
+    if (whisper_n_len(ctx) < 100) {
+        return 0;
+    }
+
     // the accumulated text context so far
     auto & prompt_past = ctx->prompt_past;
     if (params.no_context) {