From b6049060dd2341b7816d2bce7dc7451c1665828e Mon Sep 17 00:00:00 2001 From: Rotem Dan Date: Tue, 15 Oct 2024 21:00:21 +0300 Subject: [PATCH] whisper : add dtw preset for large-v3-turbo (#2481) --- examples/main/main.cpp | 1 + include/whisper.h | 1 + src/whisper.cpp | 2 ++ 3 files changed, 4 insertions(+) diff --git a/examples/main/main.cpp b/examples/main/main.cpp index 8847e9d3..d3803eb0 100644 --- a/examples/main/main.cpp +++ b/examples/main/main.cpp @@ -997,6 +997,7 @@ int main(int argc, char ** argv) { if (params.dtw == "large.v1") cparams.dtw_aheads_preset = WHISPER_AHEADS_LARGE_V1; if (params.dtw == "large.v2") cparams.dtw_aheads_preset = WHISPER_AHEADS_LARGE_V2; if (params.dtw == "large.v3") cparams.dtw_aheads_preset = WHISPER_AHEADS_LARGE_V3; + if (params.dtw == "large.v3.turbo") cparams.dtw_aheads_preset = WHISPER_AHEADS_LARGE_V3_TURBO; if (cparams.dtw_aheads_preset == WHISPER_AHEADS_NONE) { fprintf(stderr, "error: unknown DTW preset '%s'\n", params.dtw.c_str()); diff --git a/include/whisper.h b/include/whisper.h index 320cac8c..2ce43702 100644 --- a/include/whisper.h +++ b/include/whisper.h @@ -99,6 +99,7 @@ extern "C" { WHISPER_AHEADS_LARGE_V1, WHISPER_AHEADS_LARGE_V2, WHISPER_AHEADS_LARGE_V3, + WHISPER_AHEADS_LARGE_V3_TURBO, }; typedef struct whisper_ahead { diff --git a/src/whisper.cpp b/src/whisper.cpp index fedd471b..1cde0c94 100644 --- a/src/whisper.cpp +++ b/src/whisper.cpp @@ -381,6 +381,7 @@ static const whisper_ahead g_aheads_medium[] = { {13, 15}, {15, 4}, {15, 15}, static const whisper_ahead g_aheads_large_v1[] = { {9, 19}, {11, 2}, {11, 4}, {11, 17}, {22, 7}, {22, 11}, {22, 17}, {23, 2}, {23, 15} }; static const whisper_ahead g_aheads_large_v2[] = { {10, 12}, {13, 17}, {16, 11}, {16, 12}, {16, 13}, {17, 15}, {17, 16}, {18, 4}, {18, 11}, {18, 19}, {19, 11}, {21, 2}, {21, 3}, {22, 3}, {22, 9}, {22, 12}, {23, 5}, {23, 7}, {23, 13}, {25, 5}, {26, 1}, {26, 12}, {27, 15} }; static const whisper_ahead g_aheads_large_v3[] = { {7, 0}, {10, 17}, {12, 18}, {13, 12}, {16, 1}, {17, 14}, {19, 11}, {21, 4}, {24, 1}, {25, 6} }; +static const whisper_ahead g_aheads_large_v3_turbo[] = { {2, 4}, {2, 11}, {3, 3}, {3, 6}, {3, 11}, {3, 14} }; static const std::map g_aheads { { WHISPER_AHEADS_TINY_EN, { 8, g_aheads_tiny_en } }, @@ -394,6 +395,7 @@ static const std::map g_aheads { { WHISPER_AHEADS_LARGE_V1, { 9, g_aheads_large_v1 } }, { WHISPER_AHEADS_LARGE_V2, { 23, g_aheads_large_v2 } }, { WHISPER_AHEADS_LARGE_V3, { 10, g_aheads_large_v3 } }, + { WHISPER_AHEADS_LARGE_V3_TURBO, { 6, g_aheads_large_v3_turbo } }, }; static std::vector get_alignment_heads_by_layer(const whisper_context_params & cparams, int il, int32_t n_text_layer, int32_t n_head);