Skip to content

Commit 4b1f70c

Browse files
committed
Fix bool return in llama_model_load, remove std::ignore use
1 parent 3425e62 commit 4b1f70c

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

llama.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3700,7 +3700,7 @@ static bool llm_load_tensors(
37003700
return ok;
37013701
}
37023702

3703-
// Returns -1 on error, -2 on cancellation via llama_progress_callback
3703+
// Returns 0 on success, -1 on error, and -2 on cancellation via llama_progress_callback
37043704
static int llama_model_load(const std::string & fname, llama_model & model, const llama_model_params & params) {
37053705
try {
37063706
llama_model_loader ml(fname, params.use_mmap, params.kv_overrides);
@@ -3719,7 +3719,7 @@ static int llama_model_load(const std::string & fname, llama_model & model, cons
37193719

37203720
if (params.vocab_only) {
37213721
LLAMA_LOG_INFO("%s: vocab only - skipping tensors\n", __func__);
3722-
return true;
3722+
return 0;
37233723
}
37243724

37253725
if (!llm_load_tensors(

tests/test-model-load-cancel.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#include "llama.h"
22

33
#include <cstdlib>
4-
#include <tuple>
54

65
int main(void) {
76
llama_backend_init(false);
87
auto params = llama_model_params{};
98
params.use_mmap = false;
109
params.progress_callback = [](float progress, void * ctx){
11-
std::ignore = ctx;
10+
(void) ctx;
1211
return progress > 0.50;
1312
};
14-
auto * model = llama_load_model_from_file("../models/7B/ggml-model-f16.gguf", params);
13+
auto * model = llama_load_model_from_file("models/7B/ggml-model-f16.gguf", params);
1514
llama_backend_free();
1615
return model == nullptr ? EXIT_SUCCESS : EXIT_FAILURE;
1716
}

0 commit comments

Comments
 (0)