@@ -44,26 +44,27 @@ struct server_params
44
44
int32_t port = 8080 ;
45
45
int32_t read_timeout = 600 ;
46
46
int32_t write_timeout = 600 ;
47
-
47
+
48
48
bool ffmpeg_converter = false ;
49
49
};
50
50
51
51
struct whisper_params {
52
- int32_t n_threads = std::min(4 , (int32_t ) std::thread::hardware_concurrency());
53
- int32_t n_processors = 1 ;
54
- int32_t offset_t_ms = 0 ;
55
- int32_t offset_n = 0 ;
56
- int32_t duration_ms = 0 ;
57
- int32_t progress_step = 5 ;
58
- int32_t max_context = -1 ;
59
- int32_t max_len = 0 ;
60
- int32_t best_of = 2 ;
61
- int32_t beam_size = -1 ;
62
-
63
- float word_thold = 0 .01f ;
64
- float entropy_thold = 2 .40f ;
65
- float logprob_thold = -1 .00f ;
66
- float userdef_temp = 0 .20f ;
52
+ int32_t n_threads = std::min(4 , (int32_t ) std::thread::hardware_concurrency());
53
+ int32_t n_processors = 1 ;
54
+ int32_t offset_t_ms = 0 ;
55
+ int32_t offset_n = 0 ;
56
+ int32_t duration_ms = 0 ;
57
+ int32_t progress_step = 5 ;
58
+ int32_t max_context = -1 ;
59
+ int32_t max_len = 0 ;
60
+ int32_t best_of = 2 ;
61
+ int32_t beam_size = -1 ;
62
+
63
+ float word_thold = 0 .01f ;
64
+ float entropy_thold = 2 .40f ;
65
+ float logprob_thold = -1 .00f ;
66
+ float temperature = 0 .00f ;
67
+ float temperature_inc = 0 .20f ;
67
68
68
69
bool speed_up = false ;
69
70
bool debug_mode = false ;
@@ -395,34 +396,37 @@ std::string output_str(struct whisper_context * ctx, const whisper_params & para
395
396
396
397
void get_req_parameters (const Request & req, whisper_params & params)
397
398
{
398
- // user model configu.has_fileion
399
- if (req.has_file (" offset-t" ))
399
+ if (req.has_file (" offset_t" ))
400
400
{
401
- params.offset_t_ms = std::stoi (req.get_file_value (" offset-t " ).content );
401
+ params.offset_t_ms = std::stoi (req.get_file_value (" offset_t " ).content );
402
402
}
403
- if (req.has_file (" offset-n " ))
403
+ if (req.has_file (" offset_n " ))
404
404
{
405
- params.offset_n = std::stoi (req.get_file_value (" offset-n " ).content );
405
+ params.offset_n = std::stoi (req.get_file_value (" offset_n " ).content );
406
406
}
407
407
if (req.has_file (" duration" ))
408
408
{
409
409
params.duration_ms = std::stoi (req.get_file_value (" duration" ).content );
410
410
}
411
- if (req.has_file (" max-context " ))
411
+ if (req.has_file (" max_context " ))
412
412
{
413
- params.max_context = std::stoi (req.get_file_value (" max-context " ).content );
413
+ params.max_context = std::stoi (req.get_file_value (" max_context " ).content );
414
414
}
415
415
if (req.has_file (" prompt" ))
416
416
{
417
417
params.prompt = req.get_file_value (" prompt" ).content ;
418
418
}
419
- if (req.has_file (" response-format " ))
419
+ if (req.has_file (" response_format " ))
420
420
{
421
- params.response_format = req.get_file_value (" response-format " ).content ;
421
+ params.response_format = req.get_file_value (" response_format " ).content ;
422
422
}
423
423
if (req.has_file (" temperature" ))
424
424
{
425
- params.userdef_temp = std::stof (req.get_file_value (" temperature" ).content );
425
+ params.temperature = std::stof (req.get_file_value (" temperature" ).content );
426
+ }
427
+ if (req.has_file (" temperature_inc" ))
428
+ {
429
+ params.temperature_inc = std::stof (req.get_file_value (" temperature_inc" ).content );
426
430
}
427
431
}
428
432
@@ -513,7 +517,7 @@ int main(int argc, char ** argv) {
513
517
temp_file.close ();
514
518
515
519
// if file is not wav, convert to wav
516
-
520
+
517
521
if (sparams.ffmpeg_converter ) {
518
522
std::string error_resp = " {\" error\" :\" Failed to execute ffmpeg command.\" }" ;
519
523
const bool is_converted = convert_to_wav (temp_filename, error_resp);
@@ -602,7 +606,8 @@ int main(int argc, char ** argv) {
602
606
wparams.greedy .best_of = params.best_of ;
603
607
wparams.beam_search .beam_size = params.beam_size ;
604
608
605
- wparams.temperature_inc = params.userdef_temp ;
609
+ wparams.temperature = params.temperature ;
610
+ wparams.temperature_inc = params.temperature_inc ;
606
611
wparams.entropy_thold = params.entropy_thold ;
607
612
wparams.logprob_thold = params.logprob_thold ;
608
613
0 commit comments