]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : add support for EXAONE tied word embeddings (#12451)
authorXuan-Son Nguyen <redacted>
Tue, 18 Mar 2025 16:24:33 +0000 (17:24 +0100)
committerGitHub <redacted>
Tue, 18 Mar 2025 16:24:33 +0000 (17:24 +0100)
src/llama-model.cpp

index c571aa69b671c480e39facc238b4bd13fe332989..9171585bd9d915abc2f5cc4070450afe63dc6557 100644 (file)
@@ -3264,7 +3264,12 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
 
                     // output
                     output_norm = create_tensor(tn(LLM_TENSOR_OUTPUT_NORM, "weight"), {n_embd}, 0);
-                    output      = create_tensor(tn(LLM_TENSOR_OUTPUT,      "weight"), {n_embd, n_vocab}, 0);
+                    output      = create_tensor(tn(LLM_TENSOR_OUTPUT,      "weight"), {n_embd, n_vocab}, TENSOR_NOT_REQUIRED);
+
+                    // if output is NULL, init from the input tok embed
+                    if (output == NULL) {
+                        output = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}, TENSOR_DUPLICATED);
+                    }
 
                     for (int i = 0; i < n_layer; ++i) {
                         auto & layer = layers[i];