Skip to content

Commit 20e1211

Browse files
committed
llama : suggest reduce ctx size when kv init fails
1 parent bf60f27 commit 20e1211

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

ggml/src/ggml-backend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ static ggml_backend_buffer_t ggml_backend_cpu_buffer_type_alloc_buffer(ggml_back
798798
void * data = ggml_aligned_malloc(size);
799799

800800
if (data == NULL) {
801-
GGML_LOG_ERROR("%s: failed to allocate buffer of size %zu\n", __func__, size);
801+
GGML_LOG_ERROR("%s: failed to allocate buffer of size %.2f MiB\n", __func__, size / 1024.0 / 1024.0);
802802
return NULL;
803803
}
804804

src/llama.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19520,6 +19520,7 @@ struct llama_context * llama_new_context_with_model(
1952019520

1952119521
if (!llama_kv_cache_init(ctx->kv_self, ctx, type_k, type_v, kv_size, cparams.offload_kqv)) {
1952219522
LLAMA_LOG_ERROR("%s: llama_kv_cache_init() failed for self-attention cache\n", __func__);
19523+
LLAMA_LOG_ERROR("%s: suggestion: try using a smaller context size (-c command line option or llama_context_params.n_ctx)\n", __func__);
1952319524
llama_free(ctx);
1952419525
return nullptr;
1952519526
}

0 commit comments

Comments
 (0)