mirror of
https://github.com/ggerganov/whisper.cpp.git
synced 2025-04-08 04:08:13 +02:00
stream : add "single_segment" option
Force the entire audio chunk to be transcribed into a single segment
This commit is contained in:
parent
c058aaf22e
commit
d351771a4b
@ -328,6 +328,7 @@ int main(int argc, char ** argv) {
|
|||||||
wparams.print_timestamps = !params.no_timestamps;
|
wparams.print_timestamps = !params.no_timestamps;
|
||||||
wparams.translate = params.translate;
|
wparams.translate = params.translate;
|
||||||
wparams.no_context = params.no_context;
|
wparams.no_context = params.no_context;
|
||||||
|
wparams.single_segment = true;
|
||||||
wparams.language = params.language.c_str();
|
wparams.language = params.language.c_str();
|
||||||
wparams.n_threads = params.n_threads;
|
wparams.n_threads = params.n_threads;
|
||||||
|
|
||||||
|
10
whisper.cpp
10
whisper.cpp
@ -2392,6 +2392,7 @@ struct whisper_full_params whisper_full_default_params(enum whisper_sampling_str
|
|||||||
|
|
||||||
/*.translate =*/ false,
|
/*.translate =*/ false,
|
||||||
/*.no_context =*/ false,
|
/*.no_context =*/ false,
|
||||||
|
/*.single_segment =*/ false,
|
||||||
/*.print_special_tokens =*/ false,
|
/*.print_special_tokens =*/ false,
|
||||||
/*.print_progress =*/ true,
|
/*.print_progress =*/ true,
|
||||||
/*.print_realtime =*/ false,
|
/*.print_realtime =*/ false,
|
||||||
@ -2432,6 +2433,7 @@ struct whisper_full_params whisper_full_default_params(enum whisper_sampling_str
|
|||||||
|
|
||||||
/*.translate =*/ false,
|
/*.translate =*/ false,
|
||||||
/*.no_context =*/ false,
|
/*.no_context =*/ false,
|
||||||
|
/*.single_segment =*/ false,
|
||||||
/*.print_special_tokens =*/ false,
|
/*.print_special_tokens =*/ false,
|
||||||
/*.print_progress =*/ true,
|
/*.print_progress =*/ true,
|
||||||
/*.print_realtime =*/ false,
|
/*.print_realtime =*/ false,
|
||||||
@ -2693,10 +2695,10 @@ int whisper_full(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: TMP TO MAKE STREAM WORK ON RPI4 ===
|
if (params.single_segment) {
|
||||||
result_len = i + 1;
|
result_len = i + 1;
|
||||||
seek_delta = 100*WHISPER_CHUNK_SIZE;
|
seek_delta = 100*WHISPER_CHUNK_SIZE;
|
||||||
// =========================================
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -194,6 +194,7 @@ extern "C" {
|
|||||||
|
|
||||||
bool translate;
|
bool translate;
|
||||||
bool no_context;
|
bool no_context;
|
||||||
|
bool single_segment; // force single segment output (useful for streaming)
|
||||||
bool print_special_tokens;
|
bool print_special_tokens;
|
||||||
bool print_progress;
|
bool print_progress;
|
||||||
bool print_realtime;
|
bool print_realtime;
|
||||||
|
Loading…
Reference in New Issue
Block a user