]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
llama : add support for Qwen3 MoE tied word embeddings (#13768)
authorPiotr Jasiukajtis <redacted>
Sun, 25 May 2025 08:29:43 +0000 (10:29 +0200)
committerGitHub <redacted>
Sun, 25 May 2025 08:29:43 +0000 (10:29 +0200)
src/llama-model.cpp

index 81b052e1b1a47c6856fe04bcaec36cba21d7176b..e99f5309f99044663d190cacef2cfb1b1864f71d 100644 (file)
@@ -2489,7 +2489,11 @@ 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];