Skip to content

Commit c963908

Browse files
fix logger not being reset on model load failure
1 parent 97820aa commit c963908

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/llama.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,14 @@ static std::vector<llama_device_memory_data> llama_get_device_memory_data(
7676

7777
llama_model * model = llama_model_load_from_file(path_model, mparams_copy);
7878
if (model == nullptr) {
79+
llama_log_set(ud.original_logger.callback, ud.original_logger.user_data);
7980
throw std::runtime_error("failed to load model");
8081
}
8182

8283
llama_context * ctx = llama_init_from_model(model, *cparams);
8384
if (ctx == nullptr) {
8485
llama_model_free(model);
86+
llama_log_set(ud.original_logger.callback, ud.original_logger.user_data);
8587
throw std::runtime_error("failed to create llama_context from model");
8688
}
8789

0 commit comments

Comments
 (0)