From dbedc9e19c50dca0acdfb402362e2707bee424ae Mon Sep 17 00:00:00 2001 From: Yaniss Date: Sun, 26 Jul 2026 12:43:51 +0200 Subject: [PATCH] laguna: use n_ff_exp_impl for the uniform-MoE FFN size Laguna landed after this branch was cut and reads hparams.n_ff_exp as a scalar. This series turns it into a per-layer array with an n_ff_exp(il) accessor, so the three scalar reads no longer compile. Laguna is a uniform MoE, so point them at the scalar fallback n_ff_exp_impl, same as deepseek2/qwen3moe/gemma4 in this series. No behaviour change. --- src/models/laguna.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/models/laguna.cpp b/src/models/laguna.cpp index fb55ec12f9..9582cb84dc 100644 --- a/src/models/laguna.cpp +++ b/src/models/laguna.cpp @@ -9,7 +9,7 @@ void llama_model_laguna::load_arch_hparams(llama_model_loader & ml) { ml.get_key(LLM_KV_ATTENTION_LAYERNORM_RMS_EPS, hparams.f_norm_rms_eps); ml.get_key(LLM_KV_LEADING_DENSE_BLOCK_COUNT, hparams.n_layer_dense_lead); - ml.get_key(LLM_KV_EXPERT_FEED_FORWARD_LENGTH, hparams.n_ff_exp); + ml.get_key(LLM_KV_EXPERT_FEED_FORWARD_LENGTH, hparams.n_ff_exp_impl); ml.get_key(LLM_KV_EXPERT_GATING_FUNC, hparams.expert_gating_func, false); ml.get_key(LLM_KV_EXPERT_WEIGHTS_SCALE, hparams.expert_weights_scale, false); ml.get_key(LLM_KV_EXPERT_WEIGHTS_NORM, hparams.expert_weights_norm, false); @@ -24,7 +24,7 @@ void llama_model_laguna::load_arch_hparams(llama_model_loader & ml) { // Weightless fixtures (test-llama-archs) omit this key; derive a nonzero // size so the shared expert is still built. Real GGUFs always carry the // exact value (routed and shared FF lengths may differ). - hparams.n_ff_shexp = hparams.n_ff_exp * hparams.n_expert_shared; + hparams.n_ff_shexp = hparams.n_ff_exp_impl * hparams.n_expert_shared; } // Sliding-window attention is OPTIONAL. XS.2 is hybrid (full / SWA / SWA / @@ -75,7 +75,7 @@ void llama_model_laguna::load_arch_tensors(llama_model_loader & ml) { output = create_tensor(tn(LLM_TENSOR_TOKEN_EMBD, "weight"), {n_embd, n_vocab}, TENSOR_DUPLICATED); } - const int64_t n_ff_exp = hparams.n_ff_exp; + const int64_t n_ff_exp = hparams.n_ff_exp_impl; const int64_t n_ff_shexp = hparams.n_ff_shexp; for (int i = 0; i < n_layer; ++i) {