]> git.djapps.eu Git - pkg/ggml/sources/whisper.cpp/commitdiff
stream : fix --keep_context argument to be used correctly (#354)
authorGeorgi Gerganov <redacted>
Mon, 16 Jan 2023 17:37:06 +0000 (19:37 +0200)
committerGeorgi Gerganov <redacted>
Mon, 16 Jan 2023 17:37:40 +0000 (19:37 +0200)
examples/stream/stream.cpp
whisper.h

index e1251704f5d91b881ffac4e4f2de2da1d9d0f171..fb0cb3dd06c132d3e83f3222c88c1c9c36a327d6 100644 (file)
@@ -434,9 +434,9 @@ int main(int argc, char ** argv) {
 
     const int n_new_line = !use_vad ? params.length_ms / params.step_ms - 1 : 1; // number of steps to print new line
 
-    params.no_timestamps = !use_vad;
-    params.no_context    = use_vad;
-    params.max_tokens    = 0;
+    params.no_timestamps  = !use_vad;
+    params.no_context    |= use_vad;
+    params.max_tokens     = 0;
 
     // init audio
 
@@ -486,7 +486,7 @@ int main(int argc, char ** argv) {
                 params.no_timestamps ? 0 : 1);
 
         if (!use_vad) {
-            fprintf(stderr, "%s: n_new_line = %d\n", __func__, n_new_line);
+            fprintf(stderr, "%s: n_new_line = %d, no_context = %d\n", __func__, n_new_line, params.no_context);
         } else {
             fprintf(stderr, "%s: using VAD, will transcribe on speech activity\n", __func__);
         }
index 84504b7b23f9d9e70a26397ba23469a5e4382070..59231e9002072d97ee195e9fbcf4539fd632854e 100644 (file)
--- a/whisper.h
+++ b/whisper.h
@@ -245,7 +245,7 @@ extern "C" {
         int duration_ms;        // audio duration to process in ms
 
         bool translate;
-        bool no_context;        // do not use initial prompt for the decoder (if any)
+        bool no_context;        // do not use past transcription (if any) as initial prompt for the decoder
         bool single_segment;    // force single segment output (useful for streaming)
         bool print_special;     // print special tokens (e.g. <SOT>, <EOT>, <BEG>, etc.)
         bool print_progress;    // print progress information