]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : fix kv_cache `n` init (close #1903)
authorGeorgi Gerganov <redacted>
Sat, 17 Jun 2023 16:30:22 +0000 (19:30 +0300)
committerGeorgi Gerganov <redacted>
Sat, 17 Jun 2023 16:31:20 +0000 (19:31 +0300)
.gitignore
examples/CMakeLists.txt
llama.cpp

index e68fd724afe3cca8cca7412848003e1c7a00ab06..e7bfd52e3d63ceb1309f95cc36f261eb52d87cd4 100644 (file)
@@ -34,6 +34,7 @@ models/*
 /perplexity
 /embedding
 /train-text-from-scratch
+/simple
 /benchmark-matmult
 /vdot
 /server
index de005f3e39ae6f9b8de7ea800832ff00adbbb3a1..cf9c4a223133785c74af3b1c3d281c91bcb75336 100644 (file)
@@ -38,6 +38,7 @@ else()
     add_subdirectory(benchmark)
     add_subdirectory(baby-llama)
     add_subdirectory(train-text-from-scratch)
+    add_subdirectory(simple)
     if (LLAMA_METAL)
         add_subdirectory(metal)
     endif()
index a50846f71c9108d65a5f70c75010f019adc8e030..a2916b3e8d9c7f3b891b10572b74137a2e0b4c6a 100644 (file)
--- a/llama.cpp
+++ b/llama.cpp
@@ -886,6 +886,7 @@ static bool kv_cache_init(
     const int64_t n_elements = n_embd*n_mem;
 
     cache.buf.resize(2u*n_elements*ggml_type_size(wtype) + 2u*MB);
+    cache.n = 0;
 
     struct ggml_init_params params;
     params.mem_size   = cache.buf.size;
@@ -904,6 +905,7 @@ static bool kv_cache_init(
     ggml_set_name(cache.k, "cache_k");
     ggml_set_name(cache.v, "cache_v");
 
+    (void) n_gpu_layers;
 #ifdef GGML_USE_CUBLAS
     if (n_gpu_layers > n_layer + 1) {
         ggml_cuda_assign_buffers_no_scratch(cache.v);