rotemdan commited on
Commit
eae3cdd
·
unverified ·
1 Parent(s): c36e329

whisper : add dtw preset for large-v3-turbo (#2481)

Browse files
Files changed (3) hide show
  1. examples/main/main.cpp +1 -0
  2. include/whisper.h +1 -0
  3. src/whisper.cpp +2 -0
examples/main/main.cpp CHANGED
@@ -997,6 +997,7 @@ int main(int argc, char ** argv) {
997
  if (params.dtw == "large.v1") cparams.dtw_aheads_preset = WHISPER_AHEADS_LARGE_V1;
998
  if (params.dtw == "large.v2") cparams.dtw_aheads_preset = WHISPER_AHEADS_LARGE_V2;
999
  if (params.dtw == "large.v3") cparams.dtw_aheads_preset = WHISPER_AHEADS_LARGE_V3;
 
1000
 
1001
  if (cparams.dtw_aheads_preset == WHISPER_AHEADS_NONE) {
1002
  fprintf(stderr, "error: unknown DTW preset '%s'\n", params.dtw.c_str());
 
997
  if (params.dtw == "large.v1") cparams.dtw_aheads_preset = WHISPER_AHEADS_LARGE_V1;
998
  if (params.dtw == "large.v2") cparams.dtw_aheads_preset = WHISPER_AHEADS_LARGE_V2;
999
  if (params.dtw == "large.v3") cparams.dtw_aheads_preset = WHISPER_AHEADS_LARGE_V3;
1000
+ if (params.dtw == "large.v3.turbo") cparams.dtw_aheads_preset = WHISPER_AHEADS_LARGE_V3_TURBO;
1001
 
1002
  if (cparams.dtw_aheads_preset == WHISPER_AHEADS_NONE) {
1003
  fprintf(stderr, "error: unknown DTW preset '%s'\n", params.dtw.c_str());
include/whisper.h CHANGED
@@ -99,6 +99,7 @@ extern "C" {
99
  WHISPER_AHEADS_LARGE_V1,
100
  WHISPER_AHEADS_LARGE_V2,
101
  WHISPER_AHEADS_LARGE_V3,
 
102
  };
103
 
104
  typedef struct whisper_ahead {
 
99
  WHISPER_AHEADS_LARGE_V1,
100
  WHISPER_AHEADS_LARGE_V2,
101
  WHISPER_AHEADS_LARGE_V3,
102
+ WHISPER_AHEADS_LARGE_V3_TURBO,
103
  };
104
 
105
  typedef struct whisper_ahead {
src/whisper.cpp CHANGED
@@ -381,6 +381,7 @@ static const whisper_ahead g_aheads_medium[] = { {13, 15}, {15, 4}, {15, 15},
381
  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} };
382
  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} };
383
  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} };
 
384
 
385
  static const std::map<whisper_alignment_heads_preset, whisper_aheads> g_aheads {
386
  { WHISPER_AHEADS_TINY_EN, { 8, g_aheads_tiny_en } },
@@ -394,6 +395,7 @@ static const std::map<whisper_alignment_heads_preset, whisper_aheads> g_aheads {
394
  { WHISPER_AHEADS_LARGE_V1, { 9, g_aheads_large_v1 } },
395
  { WHISPER_AHEADS_LARGE_V2, { 23, g_aheads_large_v2 } },
396
  { WHISPER_AHEADS_LARGE_V3, { 10, g_aheads_large_v3 } },
 
397
  };
398
 
399
  static std::vector<uint32_t> get_alignment_heads_by_layer(const whisper_context_params & cparams, int il, int32_t n_text_layer, int32_t n_head);
 
381
  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} };
382
  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} };
383
  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} };
384
+ static const whisper_ahead g_aheads_large_v3_turbo[] = { {2, 4}, {2, 11}, {3, 3}, {3, 6}, {3, 11}, {3, 14} };
385
 
386
  static const std::map<whisper_alignment_heads_preset, whisper_aheads> g_aheads {
387
  { WHISPER_AHEADS_TINY_EN, { 8, g_aheads_tiny_en } },
 
395
  { WHISPER_AHEADS_LARGE_V1, { 9, g_aheads_large_v1 } },
396
  { WHISPER_AHEADS_LARGE_V2, { 23, g_aheads_large_v2 } },
397
  { WHISPER_AHEADS_LARGE_V3, { 10, g_aheads_large_v3 } },
398
+ { WHISPER_AHEADS_LARGE_V3_TURBO, { 6, g_aheads_large_v3_turbo } },
399
  };
400
 
401
  static std::vector<uint32_t> get_alignment_heads_by_layer(const whisper_context_params & cparams, int il, int32_t n_text_layer, int32_t n_head);