Skip to content

Commit d3e96f8

Browse files
tejomolexiyb
authored andcommitted
Use params when loading models in llava-cli (ggml-org#3976)
llava-cli was loading models with default params and ignoring settings from the cli. This switches to a generic function to load the params from the cli options.
1 parent 3c8b503 commit d3e96f8

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

examples/llava/llava-cli.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,18 +242,16 @@ static struct llava_context * llava_init(gpt_params * params) {
242242

243243
llama_backend_init(params->numa);
244244

245-
llama_model_params model_params = llama_model_default_params();
245+
llama_model_params model_params = llama_model_params_from_gpt_params(*params);
246+
246247
llama_model * model = llama_load_model_from_file(params->model.c_str(), model_params);
247248
if (model == NULL) {
248249
fprintf(stderr , "%s: error: unable to load model\n" , __func__);
249250
return NULL;
250251
}
251252

252-
llama_context_params ctx_params = llama_context_default_params();
253-
253+
llama_context_params ctx_params = llama_context_params_from_gpt_params(*params);
254254
ctx_params.n_ctx = params->n_ctx < 2048 ? 2048 : params->n_ctx; // we need a longer context size to process image embeddings
255-
ctx_params.n_threads = params->n_threads;
256-
ctx_params.n_threads_batch = params->n_threads_batch == -1 ? params->n_threads : params->n_threads_batch;
257255

258256
llama_context * ctx_llama = llama_new_context_with_model(model, ctx_params);
259257

0 commit comments

Comments
 (0)