Skip to content

Commit 4032ca4

Browse files
authored
llama : add support for Qwen3 MoE tied word embeddings (#13768)
1 parent 515fdbf commit 4032ca4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/llama-model.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2489,7 +2489,11 @@ bool llama_model::load_tensors(llama_model_loader & ml) {
24892489

24902490
// output
24912491
output_norm = create_tensor(tn(LLM_TENSOR_OUTPUT_NORM, "weight"), {n_embd}, 0);
2492-
output = create_tensor(tn(LLM_TENSOR_OUTPUT, "weight"), {n_embd, n_vocab}, 0);
2492+
output = create_tensor(tn(LLM_TENSOR_OUTPUT, "weight"), {n_embd, n_vocab}, TENSOR_NOT_REQUIRED);
2493+
// if output is NULL, init from the input tok embed
2494+
if (output == NULL) {
2495+
output = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}, TENSOR_DUPLICATED);
2496+
}
24932497

24942498
for (int i = 0; i < n_layer; ++i) {
24952499
auto & layer = layers[i];

0 commit comments

Comments
 (0)