Andreas Lubbe commited on
Commit
bb36a6d
·
unverified ·
1 Parent(s): e435fb1

cli : add no_speech_thold (#2663)

Browse files
Files changed (1) hide show
  1. examples/cli/cli.cpp +4 -0
examples/cli/cli.cpp CHANGED
@@ -43,6 +43,7 @@ struct whisper_params {
43
  float word_thold = 0.01f;
44
  float entropy_thold = 2.40f;
45
  float logprob_thold = -1.00f;
 
46
  float grammar_penalty = 100.0f;
47
  float temperature = 0.0f;
48
  float temperature_inc = 0.2f;
@@ -135,6 +136,7 @@ static bool whisper_params_parse(int argc, char ** argv, whisper_params & params
135
  else if (arg == "-wt" || arg == "--word-thold") { params.word_thold = std::stof(argv[++i]); }
136
  else if (arg == "-et" || arg == "--entropy-thold") { params.entropy_thold = std::stof(argv[++i]); }
137
  else if (arg == "-lpt" || arg == "--logprob-thold") { params.logprob_thold = std::stof(argv[++i]); }
 
138
  else if (arg == "-tp" || arg == "--temperature") { params.temperature = std::stof(argv[++i]); }
139
  else if (arg == "-tpi" || arg == "--temperature-inc") { params.temperature_inc = std::stof(argv[++i]); }
140
  else if (arg == "-debug"|| arg == "--debug-mode") { params.debug_mode = true; }
@@ -202,6 +204,7 @@ static void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params
202
  fprintf(stderr, " -wt N, --word-thold N [%-7.2f] word timestamp probability threshold\n", params.word_thold);
203
  fprintf(stderr, " -et N, --entropy-thold N [%-7.2f] entropy threshold for decoder fail\n", params.entropy_thold);
204
  fprintf(stderr, " -lpt N, --logprob-thold N [%-7.2f] log probability threshold for decoder fail\n", params.logprob_thold);
 
205
  fprintf(stderr, " -tp, --temperature N [%-7.2f] The sampling temperature, between 0 and 1\n", params.temperature);
206
  fprintf(stderr, " -tpi, --temperature-inc N [%-7.2f] The increment of temperature, between 0 and 1\n",params.temperature_inc);
207
  fprintf(stderr, " -debug, --debug-mode [%-7s] enable debug mode (eg. dump log_mel)\n", params.debug_mode ? "true" : "false");
@@ -1121,6 +1124,7 @@ int main(int argc, char ** argv) {
1121
 
1122
  wparams.entropy_thold = params.entropy_thold;
1123
  wparams.logprob_thold = params.logprob_thold;
 
1124
 
1125
  wparams.no_timestamps = params.no_timestamps;
1126
 
 
43
  float word_thold = 0.01f;
44
  float entropy_thold = 2.40f;
45
  float logprob_thold = -1.00f;
46
+ float no_speech_thold = 0.6f;
47
  float grammar_penalty = 100.0f;
48
  float temperature = 0.0f;
49
  float temperature_inc = 0.2f;
 
136
  else if (arg == "-wt" || arg == "--word-thold") { params.word_thold = std::stof(argv[++i]); }
137
  else if (arg == "-et" || arg == "--entropy-thold") { params.entropy_thold = std::stof(argv[++i]); }
138
  else if (arg == "-lpt" || arg == "--logprob-thold") { params.logprob_thold = std::stof(argv[++i]); }
139
+ else if (arg == "-nth" || arg == "--no-speech-thold") { params.no_speech_thold = std::stof(argv[++i]); }
140
  else if (arg == "-tp" || arg == "--temperature") { params.temperature = std::stof(argv[++i]); }
141
  else if (arg == "-tpi" || arg == "--temperature-inc") { params.temperature_inc = std::stof(argv[++i]); }
142
  else if (arg == "-debug"|| arg == "--debug-mode") { params.debug_mode = true; }
 
204
  fprintf(stderr, " -wt N, --word-thold N [%-7.2f] word timestamp probability threshold\n", params.word_thold);
205
  fprintf(stderr, " -et N, --entropy-thold N [%-7.2f] entropy threshold for decoder fail\n", params.entropy_thold);
206
  fprintf(stderr, " -lpt N, --logprob-thold N [%-7.2f] log probability threshold for decoder fail\n", params.logprob_thold);
207
+ fprintf(stderr, " -nth N, --no-speech-thold N [%-7.2f] no speech threshold\n", params.no_speech_thold);
208
  fprintf(stderr, " -tp, --temperature N [%-7.2f] The sampling temperature, between 0 and 1\n", params.temperature);
209
  fprintf(stderr, " -tpi, --temperature-inc N [%-7.2f] The increment of temperature, between 0 and 1\n",params.temperature_inc);
210
  fprintf(stderr, " -debug, --debug-mode [%-7s] enable debug mode (eg. dump log_mel)\n", params.debug_mode ? "true" : "false");
 
1124
 
1125
  wparams.entropy_thold = params.entropy_thold;
1126
  wparams.logprob_thold = params.logprob_thold;
1127
+ wparams.no_speech_thold = params.no_speech_thold;
1128
 
1129
  wparams.no_timestamps = params.no_timestamps;
1130