Spaces:
Running
Running
whisper : fix segment length with params.no_timestamps == true
Browse files- whisper.cpp +3 -3
whisper.cpp
CHANGED
|
@@ -127,7 +127,7 @@ static void whisper_log_callback_default(ggml_log_level level, const char * text
|
|
| 127 |
#define WHISPER_LOG_INFO(...) whisper_log_internal(GGML_LOG_LEVEL_INFO , __VA_ARGS__)
|
| 128 |
|
| 129 |
// define this to enable verbose trace logging - useful for debugging purposes
|
| 130 |
-
|
| 131 |
|
| 132 |
#if defined(WHISPER_DEBUG)
|
| 133 |
#define WHISPER_LOG_DEBUG(...) whisper_log_internal(GGML_LOG_LEVEL_DEBUG, __VA_ARGS__)
|
|
@@ -5469,7 +5469,7 @@ int whisper_full_with_state(
|
|
| 5469 |
(params.max_tokens > 0 && i >= params.max_tokens) || // max tokens per segment reached
|
| 5470 |
(has_ts && seek + seek_delta + 100 >= seek_end) // end of audio reached
|
| 5471 |
) {
|
| 5472 |
-
if (result_len == 0) {
|
| 5473 |
if (seek + seek_delta + 100 >= seek_end) {
|
| 5474 |
result_len = i + 1;
|
| 5475 |
} else {
|
|
@@ -5479,7 +5479,7 @@ int whisper_full_with_state(
|
|
| 5479 |
}
|
| 5480 |
}
|
| 5481 |
|
| 5482 |
-
if (params.single_segment) {
|
| 5483 |
result_len = i + 1;
|
| 5484 |
seek_delta = 100*WHISPER_CHUNK_SIZE;
|
| 5485 |
}
|
|
|
|
| 127 |
#define WHISPER_LOG_INFO(...) whisper_log_internal(GGML_LOG_LEVEL_INFO , __VA_ARGS__)
|
| 128 |
|
| 129 |
// define this to enable verbose trace logging - useful for debugging purposes
|
| 130 |
+
//#define WHISPER_DEBUG
|
| 131 |
|
| 132 |
#if defined(WHISPER_DEBUG)
|
| 133 |
#define WHISPER_LOG_DEBUG(...) whisper_log_internal(GGML_LOG_LEVEL_DEBUG, __VA_ARGS__)
|
|
|
|
| 5469 |
(params.max_tokens > 0 && i >= params.max_tokens) || // max tokens per segment reached
|
| 5470 |
(has_ts && seek + seek_delta + 100 >= seek_end) // end of audio reached
|
| 5471 |
) {
|
| 5472 |
+
if (result_len == 0 && !params.no_timestamps) {
|
| 5473 |
if (seek + seek_delta + 100 >= seek_end) {
|
| 5474 |
result_len = i + 1;
|
| 5475 |
} else {
|
|
|
|
| 5479 |
}
|
| 5480 |
}
|
| 5481 |
|
| 5482 |
+
if (params.single_segment || params.no_timestamps) {
|
| 5483 |
result_len = i + 1;
|
| 5484 |
seek_delta = 100*WHISPER_CHUNK_SIZE;
|
| 5485 |
}
|