mirror of
https://github.com/ggerganov/llama.cpp.git
synced 2024-12-27 03:44:35 +00:00
Fix bool return in llama_model_load, remove std::ignore use
This commit is contained in:
parent
3425e62745
commit
4b1f70cb03
@ -3700,7 +3700,7 @@ static bool llm_load_tensors(
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns -1 on error, -2 on cancellation via llama_progress_callback
|
// Returns 0 on success, -1 on error, and -2 on cancellation via llama_progress_callback
|
||||||
static int llama_model_load(const std::string & fname, llama_model & model, const llama_model_params & params) {
|
static int llama_model_load(const std::string & fname, llama_model & model, const llama_model_params & params) {
|
||||||
try {
|
try {
|
||||||
llama_model_loader ml(fname, params.use_mmap, params.kv_overrides);
|
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
|
|||||||
|
|
||||||
if (params.vocab_only) {
|
if (params.vocab_only) {
|
||||||
LLAMA_LOG_INFO("%s: vocab only - skipping tensors\n", __func__);
|
LLAMA_LOG_INFO("%s: vocab only - skipping tensors\n", __func__);
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!llm_load_tensors(
|
if (!llm_load_tensors(
|
||||||
|
@ -1,17 +1,16 @@
|
|||||||
#include "llama.h"
|
#include "llama.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <tuple>
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
llama_backend_init(false);
|
llama_backend_init(false);
|
||||||
auto params = llama_model_params{};
|
auto params = llama_model_params{};
|
||||||
params.use_mmap = false;
|
params.use_mmap = false;
|
||||||
params.progress_callback = [](float progress, void * ctx){
|
params.progress_callback = [](float progress, void * ctx){
|
||||||
std::ignore = ctx;
|
(void) ctx;
|
||||||
return progress > 0.50;
|
return progress > 0.50;
|
||||||
};
|
};
|
||||||
auto * model = llama_load_model_from_file("../models/7B/ggml-model-f16.gguf", params);
|
auto * model = llama_load_model_from_file("models/7B/ggml-model-f16.gguf", params);
|
||||||
llama_backend_free();
|
llama_backend_free();
|
||||||
return model == nullptr ? EXIT_SUCCESS : EXIT_FAILURE;
|
return model == nullptr ? EXIT_SUCCESS : EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user