ggerganov commited on
Commit
3443ee7
·
unverified ·
1 Parent(s): e6d6e1d

examples : initialize context params properly (#1852)

Browse files
examples/addon.node/addon.cpp CHANGED
@@ -154,7 +154,7 @@ int run(whisper_params &params, std::vector<std::vector<std::string>> &result) {
154
 
155
  // whisper init
156
 
157
- struct whisper_context_params cparams;
158
  cparams.use_gpu = params.use_gpu;
159
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
160
 
 
154
 
155
  // whisper init
156
 
157
+ struct whisper_context_params cparams = whisper_context_default_params();
158
  cparams.use_gpu = params.use_gpu;
159
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
160
 
examples/bench/bench.cpp CHANGED
@@ -58,7 +58,7 @@ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & para
58
  int whisper_bench_full(const whisper_params & params) {
59
  // whisper init
60
 
61
- struct whisper_context_params cparams;
62
  cparams.use_gpu = params.use_gpu;
63
 
64
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
 
58
  int whisper_bench_full(const whisper_params & params) {
59
  // whisper init
60
 
61
+ struct whisper_context_params cparams = whisper_context_default_params();
62
  cparams.use_gpu = params.use_gpu;
63
 
64
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
examples/command/command.cpp CHANGED
@@ -693,7 +693,7 @@ int main(int argc, char ** argv) {
693
 
694
  // whisper init
695
 
696
- struct whisper_context_params cparams;
697
  cparams.use_gpu = params.use_gpu;
698
 
699
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
 
693
 
694
  // whisper init
695
 
696
+ struct whisper_context_params cparams = whisper_context_default_params();
697
  cparams.use_gpu = params.use_gpu;
698
 
699
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
examples/lsp/lsp.cpp CHANGED
@@ -435,7 +435,7 @@ int main(int argc, char ** argv) {
435
  }
436
 
437
  // whisper init
438
- struct whisper_context_params cparams;
439
  cparams.use_gpu = params.use_gpu;
440
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
441
  // init audio
 
435
  }
436
 
437
  // whisper init
438
+ struct whisper_context_params cparams = whisper_context_default_params();
439
  cparams.use_gpu = params.use_gpu;
440
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
441
  // init audio
examples/main/main.cpp CHANGED
@@ -890,7 +890,7 @@ int main(int argc, char ** argv) {
890
 
891
  // whisper init
892
 
893
- struct whisper_context_params cparams;
894
  cparams.use_gpu = params.use_gpu;
895
 
896
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
 
890
 
891
  // whisper init
892
 
893
+ struct whisper_context_params cparams = whisper_context_default_params();
894
  cparams.use_gpu = params.use_gpu;
895
 
896
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
examples/server/server.cpp CHANGED
@@ -122,8 +122,7 @@ bool is_file_exist(const char *fileName)
122
  return infile.good();
123
  }
124
 
125
- void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & params,
126
- const server_params& sparams) {
127
  fprintf(stderr, "\n");
128
  fprintf(stderr, "usage: %s [options] \n", argv[0]);
129
  fprintf(stderr, "\n");
@@ -525,7 +524,7 @@ int main(int argc, char ** argv) {
525
  check_ffmpeg_availibility();
526
  }
527
  // whisper init
528
- struct whisper_context_params cparams;
529
  cparams.use_gpu = params.use_gpu;
530
 
531
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
 
122
  return infile.good();
123
  }
124
 
125
+ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & params, const server_params& sparams) {
 
126
  fprintf(stderr, "\n");
127
  fprintf(stderr, "usage: %s [options] \n", argv[0]);
128
  fprintf(stderr, "\n");
 
524
  check_ffmpeg_availibility();
525
  }
526
  // whisper init
527
+ struct whisper_context_params cparams = whisper_context_default_params();
528
  cparams.use_gpu = params.use_gpu;
529
 
530
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
examples/stream/stream.cpp CHANGED
@@ -166,7 +166,7 @@ int main(int argc, char ** argv) {
166
  exit(0);
167
  }
168
 
169
- struct whisper_context_params cparams;
170
  cparams.use_gpu = params.use_gpu;
171
 
172
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
 
166
  exit(0);
167
  }
168
 
169
+ struct whisper_context_params cparams = whisper_context_default_params();
170
  cparams.use_gpu = params.use_gpu;
171
 
172
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
examples/talk-llama/talk-llama.cpp CHANGED
@@ -281,7 +281,7 @@ int main(int argc, char ** argv) {
281
 
282
  // whisper init
283
 
284
- struct whisper_context_params cparams;
285
  cparams.use_gpu = params.use_gpu;
286
 
287
  struct whisper_context * ctx_wsp = whisper_init_from_file_with_params(params.model_wsp.c_str(), cparams);
 
281
 
282
  // whisper init
283
 
284
+ struct whisper_context_params cparams = whisper_context_default_params();
285
  cparams.use_gpu = params.use_gpu;
286
 
287
  struct whisper_context * ctx_wsp = whisper_init_from_file_with_params(params.model_wsp.c_str(), cparams);
examples/talk/talk.cpp CHANGED
@@ -184,7 +184,7 @@ int main(int argc, char ** argv) {
184
  }
185
 
186
  // whisper init
187
- struct whisper_context_params cparams;
188
  cparams.use_gpu = params.use_gpu;
189
 
190
  struct whisper_context * ctx_wsp = whisper_init_from_file_with_params(params.model_wsp.c_str(), cparams);
 
184
  }
185
 
186
  // whisper init
187
+ struct whisper_context_params cparams = whisper_context_default_params();
188
  cparams.use_gpu = params.use_gpu;
189
 
190
  struct whisper_context * ctx_wsp = whisper_init_from_file_with_params(params.model_wsp.c_str(), cparams);
examples/wchess/wchess.cmd/wchess.cmd.cpp CHANGED
@@ -182,7 +182,7 @@ int main(int argc, char ** argv) {
182
 
183
  // whisper init
184
 
185
- struct whisper_context_params cparams;
186
  cparams.use_gpu = params.use_gpu;
187
 
188
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
 
182
 
183
  // whisper init
184
 
185
+ struct whisper_context_params cparams = whisper_context_default_params();
186
  cparams.use_gpu = params.use_gpu;
187
 
188
  struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);