Skip to content

Commit

Permalink
examples : initialize context params properly (ggerganov#1852)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggerganov authored and iThalay committed Sep 23, 2024
1 parent 8e72865 commit 7edcf3e
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/addon.node/addon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ int run(whisper_params &params, std::vector<std::vector<std::string>> &result) {

// whisper init

struct whisper_context_params cparams;
struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;
struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);

Expand Down
2 changes: 1 addition & 1 deletion examples/bench/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & para
int whisper_bench_full(const whisper_params & params) {
// whisper init

struct whisper_context_params cparams;
struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;

struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
Expand Down
2 changes: 1 addition & 1 deletion examples/command/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -693,7 +693,7 @@ int main(int argc, char ** argv) {

// whisper init

struct whisper_context_params cparams;
struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;

struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
Expand Down
2 changes: 1 addition & 1 deletion examples/lsp/lsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ int main(int argc, char ** argv) {
}

// whisper init
struct whisper_context_params cparams;
struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;
struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
// init audio
Expand Down
2 changes: 1 addition & 1 deletion examples/main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ int main(int argc, char ** argv) {

// whisper init

struct whisper_context_params cparams;
struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;

struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
Expand Down
5 changes: 2 additions & 3 deletions examples/server/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,7 @@ bool is_file_exist(const char *fileName)
return infile.good();
}

void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & params,
const server_params& sparams) {
void whisper_print_usage(int /*argc*/, char ** argv, const whisper_params & params, const server_params& sparams) {
fprintf(stderr, "\n");
fprintf(stderr, "usage: %s [options] \n", argv[0]);
fprintf(stderr, "\n");
Expand Down Expand Up @@ -525,7 +524,7 @@ int main(int argc, char ** argv) {
check_ffmpeg_availibility();
}
// whisper init
struct whisper_context_params cparams;
struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;

struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
Expand Down
2 changes: 1 addition & 1 deletion examples/stream/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ int main(int argc, char ** argv) {
exit(0);
}

struct whisper_context_params cparams;
struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;

struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
Expand Down
2 changes: 1 addition & 1 deletion examples/talk-llama/talk-llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ int main(int argc, char ** argv) {

// whisper init

struct whisper_context_params cparams;
struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;

struct whisper_context * ctx_wsp = whisper_init_from_file_with_params(params.model_wsp.c_str(), cparams);
Expand Down
2 changes: 1 addition & 1 deletion examples/talk/talk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ int main(int argc, char ** argv) {
}

// whisper init
struct whisper_context_params cparams;
struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;

struct whisper_context * ctx_wsp = whisper_init_from_file_with_params(params.model_wsp.c_str(), cparams);
Expand Down
2 changes: 1 addition & 1 deletion examples/wchess/wchess.cmd/wchess.cmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ int main(int argc, char ** argv) {

// whisper init

struct whisper_context_params cparams;
struct whisper_context_params cparams = whisper_context_default_params();
cparams.use_gpu = params.use_gpu;

struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
Expand Down

0 comments on commit 7edcf3e

Please sign in to comment.