Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions examples/bench/bench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ static int whisper_bench_full(const whisper_params & params) {
cparams.flash_attn = params.flash_attn;

struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
if (ctx == nullptr) {
fprintf(stderr, "error: failed to initialize whisper context\n");
return 2;
}

{
fprintf(stderr, "\n");
Expand Down
4 changes: 4 additions & 0 deletions examples/command/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,10 @@ int main(int argc, char ** argv) {
cparams.flash_attn = params.flash_attn;

struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
if (ctx == nullptr) {
fprintf(stderr, "error: failed to initialize whisper context\n");
return 2;
}

// print some info about the processing
{
Expand Down
4 changes: 4 additions & 0 deletions examples/stream/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,10 @@ int main(int argc, char ** argv) {
cparams.flash_attn = params.flash_attn;

struct whisper_context * ctx = whisper_init_from_file_with_params(params.model.c_str(), cparams);
if (ctx == nullptr) {
fprintf(stderr, "error: failed to initialize whisper context\n");
return 2;
}

std::vector<float> pcmf32 (n_samples_30s, 0.0f);
std::vector<float> pcmf32_old;
Expand Down
4 changes: 4 additions & 0 deletions examples/vad-speech-segments/speech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,10 @@ int main(int argc, char ** argv) {
struct whisper_vad_context * vctx = whisper_vad_init_from_file_with_params(
cli_params.vad_model.c_str(),
ctx_params);
if (vctx == nullptr) {
fprintf(stderr, "error: failed to initialize whisper context\n");
return 2;
}

// Detect speech in the input audio file.
if (!whisper_vad_detect_speech(vctx, pcmf32.data(), pcmf32.size())) {
Expand Down
Loading