@@ -37,8 +37,8 @@ namespace {
37
37
38
38
struct server_params
39
39
{
40
- std::string hostname = " 127 .0.0.1 " ;
41
- std::string public_path = " examples/server/ public" ;
40
+ std::string hostname = " 0 .0.0.0 " ;
41
+ std::string public_path = " public" ;
42
42
int32_t port = 8080 ;
43
43
int32_t read_timeout = 600 ;
44
44
int32_t write_timeout = 600 ;
@@ -74,6 +74,7 @@ namespace {
74
74
bool print_progress = false ;
75
75
bool no_timestamps = false ;
76
76
bool log_score = false ;
77
+ bool use_gpu = true ;
77
78
78
79
std::string language = " en" ;
79
80
std::string prompt = " " ;
@@ -153,6 +154,7 @@ namespace {
153
154
// server params
154
155
fprintf (stderr, " --host HOST, [%-7s] Hostname/ip-adress for the server\n " , sparams.hostname .c_str ());
155
156
fprintf (stderr, " --port PORT, [%-7d] Port number for the server\n " , sparams.port );
157
+ fprintf (stderr, " -ng, --no-gpu [%-7s] disable GPU\n " , params.use_gpu ? " false" : " true" );
156
158
fprintf (stderr, " \n " );
157
159
}
158
160
@@ -197,6 +199,7 @@ namespace {
197
199
else if ( arg == " --port" ) { sparams.port = std::stoi (argv[++i]); }
198
200
else if ( arg == " --host" ) { sparams.hostname = argv[++i]; }
199
201
else if (arg == " -ad" || arg == " --port" ) { params.openvino_encode_device = argv[++i]; }
202
+ else if (arg == " -ng" || arg == " --no-gpu" ) { params.use_gpu = false ; }
200
203
else {
201
204
fprintf (stderr, " error: unknown argument: %s\n " , arg.c_str ());
202
205
whisper_print_usage (argc, argv, params, sparams);
@@ -402,7 +405,9 @@ int main(int argc, char ** argv) {
402
405
}
403
406
404
407
// whisper init
405
- struct whisper_context * ctx = whisper_init_from_file (params.model .c_str ());
408
+ struct whisper_context_params cparams;
409
+ cparams.use_gpu = params.use_gpu ;
410
+ struct whisper_context * ctx = whisper_init_from_file_with_params (params.model .c_str (),cparams);
406
411
407
412
if (ctx == nullptr ) {
408
413
fprintf (stderr, " error: failed to initialize whisper context\n " );
@@ -623,7 +628,10 @@ int main(int argc, char ** argv) {
623
628
whisper_free (ctx);
624
629
625
630
// whisper init
626
- ctx = whisper_init_from_file (model.c_str ());
631
+ // ctx = whisper_init_from_file(model.c_str());
632
+ struct whisper_context_params cparams;
633
+
634
+ ctx = whisper_init_from_file_with_params (params.model .c_str (),cparams);
627
635
628
636
// TODO perhaps load prior model here instead of exit
629
637
if (ctx == nullptr ) {
0 commit comments