Spaces:
Running
Running
stream : fix --keep_context argument to be used correctly (#354)
Browse files- examples/stream/stream.cpp +4 -4
- whisper.h +1 -1
examples/stream/stream.cpp
CHANGED
|
@@ -434,9 +434,9 @@ int main(int argc, char ** argv) {
|
|
| 434 |
|
| 435 |
const int n_new_line = !use_vad ? params.length_ms / params.step_ms - 1 : 1; // number of steps to print new line
|
| 436 |
|
| 437 |
-
params.no_timestamps
|
| 438 |
-
params.no_context
|
| 439 |
-
params.max_tokens
|
| 440 |
|
| 441 |
// init audio
|
| 442 |
|
|
@@ -486,7 +486,7 @@ int main(int argc, char ** argv) {
|
|
| 486 |
params.no_timestamps ? 0 : 1);
|
| 487 |
|
| 488 |
if (!use_vad) {
|
| 489 |
-
fprintf(stderr, "%s: n_new_line = %d\n", __func__, n_new_line);
|
| 490 |
} else {
|
| 491 |
fprintf(stderr, "%s: using VAD, will transcribe on speech activity\n", __func__);
|
| 492 |
}
|
|
|
|
| 434 |
|
| 435 |
const int n_new_line = !use_vad ? params.length_ms / params.step_ms - 1 : 1; // number of steps to print new line
|
| 436 |
|
| 437 |
+
params.no_timestamps = !use_vad;
|
| 438 |
+
params.no_context |= use_vad;
|
| 439 |
+
params.max_tokens = 0;
|
| 440 |
|
| 441 |
// init audio
|
| 442 |
|
|
|
|
| 486 |
params.no_timestamps ? 0 : 1);
|
| 487 |
|
| 488 |
if (!use_vad) {
|
| 489 |
+
fprintf(stderr, "%s: n_new_line = %d, no_context = %d\n", __func__, n_new_line, params.no_context);
|
| 490 |
} else {
|
| 491 |
fprintf(stderr, "%s: using VAD, will transcribe on speech activity\n", __func__);
|
| 492 |
}
|
whisper.h
CHANGED
|
@@ -245,7 +245,7 @@ extern "C" {
|
|
| 245 |
int duration_ms; // audio duration to process in ms
|
| 246 |
|
| 247 |
bool translate;
|
| 248 |
-
bool no_context; // do not use initial prompt for the decoder
|
| 249 |
bool single_segment; // force single segment output (useful for streaming)
|
| 250 |
bool print_special; // print special tokens (e.g. <SOT>, <EOT>, <BEG>, etc.)
|
| 251 |
bool print_progress; // print progress information
|
|
|
|
| 245 |
int duration_ms; // audio duration to process in ms
|
| 246 |
|
| 247 |
bool translate;
|
| 248 |
+
bool no_context; // do not use past transcription (if any) as initial prompt for the decoder
|
| 249 |
bool single_segment; // force single segment output (useful for streaming)
|
| 250 |
bool print_special; // print special tokens (e.g. <SOT>, <EOT>, <BEG>, etc.)
|
| 251 |
bool print_progress; // print progress information
|