Skip to content

Commit c9aeb33

Browse files
committed
stream : fix --keep_context argument to be used correctly (ggml-org#354)
1 parent 4a3f0d3 commit c9aeb33

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

examples/stream/stream.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,9 @@ int main(int argc, char ** argv) {
434434

435435
const int n_new_line = !use_vad ? params.length_ms / params.step_ms - 1 : 1; // number of steps to print new line
436436

437-
params.no_timestamps = !use_vad;
438-
params.no_context = use_vad;
439-
params.max_tokens = 0;
437+
params.no_timestamps = !use_vad;
438+
params.no_context |= use_vad;
439+
params.max_tokens = 0;
440440

441441
// init audio
442442

@@ -486,7 +486,7 @@ int main(int argc, char ** argv) {
486486
params.no_timestamps ? 0 : 1);
487487

488488
if (!use_vad) {
489-
fprintf(stderr, "%s: n_new_line = %d\n", __func__, n_new_line);
489+
fprintf(stderr, "%s: n_new_line = %d, no_context = %d\n", __func__, n_new_line, params.no_context);
490490
} else {
491491
fprintf(stderr, "%s: using VAD, will transcribe on speech activity\n", __func__);
492492
}

whisper.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ extern "C" {
245245
int duration_ms; // audio duration to process in ms
246246

247247
bool translate;
248-
bool no_context; // do not use initial prompt for the decoder (if any)
248+
bool no_context; // do not use past transcription (if any) as initial prompt for the decoder
249249
bool single_segment; // force single segment output (useful for streaming)
250250
bool print_special; // print special tokens (e.g. <SOT>, <EOT>, <BEG>, etc.)
251251
bool print_progress; // print progress information

0 commit comments

Comments
 (0)