8000 Use params when loading models in llava-cli by tejom · Pull Request #3976 · ggml-org/llama.cpp · GitHub
[go: up one dir, main page]

Skip to content

Use params when loading models in llava-cli #3976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 7, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump 8000 to file
Failed to load files.
Loading
Diff view
Diff view
Use params when loading models in llava-cli
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.
  • Loading branch information
tejom committed Nov 7, 2023
commit 39a80fd36875923345683cb488044ea6d7b5ff7e
8 changes: 3 additions & 5 deletions examples/llava/llava-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,18 +242,16 @@ static struct llava_context * llava_init(gpt_params * params) {

llama_backend_init(params->numa);

llama_model_params model_params = llama_model_default_params();
llama_model_params model_params = llama_model_params_from_gpt_params(*params);

llama_model * model = llama_load_model_from_file(params->model.c_str(), model_params);
if (model == NULL) {
fprintf(stderr , "%s: error: unable to load model\n" , __func__);
return NULL;
}

llama_context_params ctx_params = llama_context_default_params();

llama_context_params ctx_params = llama_context_params_from_gpt_params(*params);
ctx_params.n_ctx = params->n_ctx < 2048 ? 2048 : params->n_ctx; // we need a longer context size to process image embeddings
ctx_params.n_threads = params->n_threads;
ctx_params.n_threads_batch = params->n_threads_batch == -1 ? params->n_threads : params->n_threads_batch;

llama_context * ctx_llama = llama_new_context_with_model(model, ctx_params);

Expand Down
0