10000 llama.cpp : split llama_context_params into model and context params by slaren · Pull Request #3301 · ggml-org/llama.cpp · GitHub
[go: up one dir, main page]

Skip to content

llama.cpp : split llama_context_params into model and context params #3301

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 17 commits into from
Sep 28, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix metal build
  • Loading branch information
slaren committed Sep 21, 2023
commit 39f4afac204fedf44d4f21836203f42182aa3131
6 changes: 3 additions & 3 deletions llama.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6376,7 +6376,7 @@ struct llama_context * llama_new_context_with_model(
llama_token token = llama_token_bos(ctx); // not actually used by llama_build_graph, but required to choose between token and embedding inputs graph
ggml_cgraph * gf = llama_build_graph(*ctx, &token, NULL, n_tokens, n_past);
#ifdef GGML_USE_METAL
if (params.n_gpu_layers > 0) {
if (model->n_gpu_layers > 0) {
ctx->ctx_metal = ggml_metal_init(1);
if (!ctx->ctx_metal) {
LLAMA_LOG_ERROR("%s: ggml_metal_init() failed\n", __func__);
Expand Down Expand Up @@ -6415,13 +6415,13 @@ struct llama_context * llama_new_context_with_model(
}

#ifdef GGML_USE_METAL
if (params.n_gpu_layers > 0) {
if (model->n_gpu_layers > 0) {
// this allocates all Metal resources and memory buffers

void * data_ptr = NULL;
size_t data_size = 0;

if (params.use_mmap) {
if (ctx->model.mapping) {
data_ptr = ctx->model.mapping->addr;
data_size = ctx->model.mapping->size;
} else {
Expand Down
0