mirror of
https://github.com/ggml-org/whisper.cpp.git
synced 2026-09-30 11:36:38 +02:00
cli : load backends after validating input files (#4069)
* cli : load backends after validating input files Co-authored-by: Cursor <cursoragent@cursor.com> * cli : check model path with input files Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -968,8 +968,6 @@ static void output_lrc(struct whisper_context * ctx, std::ofstream & fout, const
|
||||
static void cb_log_disable(enum ggml_log_level , const char * , void * ) { }
|
||||
|
||||
int main(int argc, char ** argv) {
|
||||
ggml_backend_load_all();
|
||||
|
||||
#if defined(_WIN32)
|
||||
// Set the console output code page to UTF-8, while command line arguments
|
||||
// are still encoded in the system's code page. In this way, we can print
|
||||
@@ -1032,6 +1030,12 @@ int main(int argc, char ** argv) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
if (!is_file_exist(params.model.c_str())) {
|
||||
fprintf(stderr, "error: model file not found '%s'\n", params.model.c_str());
|
||||
whisper_print_usage(argc, argv, params);
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (params.language != "auto" && whisper_lang_id(params.language.c_str()) == -1) {
|
||||
fprintf(stderr, "error: unknown language '%s'\n", params.language.c_str());
|
||||
whisper_print_usage(argc, argv, params);
|
||||
@@ -1048,6 +1052,8 @@ int main(int argc, char ** argv) {
|
||||
whisper_log_set(cb_log_disable, NULL);
|
||||
}
|
||||
|
||||
ggml_backend_load_all();
|
||||
|
||||
// whisper init
|
||||
struct whisper_context_params cparams = whisper_context_default_params();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user