]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : fix falcon arch for tied output embeddings (#4978)
authorJohn <redacted>
Thu, 18 Jan 2024 22:12:15 +0000 (23:12 +0100)
committerGitHub <redacted>
Thu, 18 Jan 2024 22:12:15 +0000 (00:12 +0200)
* falcon arch fix for tied output embeddings

* Update llama.cpp

Co-authored-by: Georgi Gerganov <redacted>
* Update llama.cpp

* Update llama.cpp

Co-authored-by: Georgi Gerganov <redacted>
* Update llama.cpp

---------

Co-authored-by: Georgi Gerganov <redacted>
llama.cpp

index f1d00a96c667ca13e1e3d23474e94921b497147f..47b4384a8b88b98ba2b3a75f489d0723b351c97c 100644 (file)
--- a/llama.cpp
+++ b/llama.cpp
@@ -3438,7 +3438,12 @@ static bool llm_load_tensors(
                     {
                         model.output_norm   = ml.create_tensor(ctx_output,       tn(LLM_TENSOR_OUTPUT_NORM, "weight"), {n_embd});
                         model.output_norm_b = ml.create_tensor(ctx_output,       tn(LLM_TENSOR_OUTPUT_NORM, "bias"),   {n_embd});
-                        model.output        = ml.create_tensor(ctx_output_split, tn(LLM_TENSOR_OUTPUT,      "weight"), {n_embd, n_vocab});
+                        if (gguf_find_tensor(ml.ctx_gguf, tn(LLM_TENSOR_OUTPUT, "weight").c_str()) >= 0) {
+                            model.output = ml.create_tensor(ctx_output_split, tn(LLM_TENSOR_OUTPUT,     "weight"), {n_embd, n_vocab});
+                        } else {
+                            model.output = ml.create_tensor(ctx_output_split, tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}); // needs to be on GPU
+                            ml.n_created--; // artificial tensor
+                        }
                     }
 
                     for (int i = 0; i < n_layer; ++i) {