From 6c7eb77eb101bf60cca4929e4e96bfc01f2eae42 Mon Sep 17 00:00:00 2001 From: Ventz Petkov Date: Fri, 17 Apr 2026 12:16:12 -0400 Subject: [PATCH] fix: slice exp_probs_b tensors in moe-split for GLM-5.1 compatibility GLM-5.1 has per-expert `exp_probs_b.bias` tensors ([n_expert x 1 x 1]) that depend on expert count but were not recognized by is_expert_tensor(). The split reduced expert count (e.g. 256 -> 192) but left exp_probs_b at the original dimension, causing llama-server to reject the shard with: "tensor 'blk.3.exp_probs_b.bias' has wrong shape; expected 192, got 256" Add exp_probs_b to the expert tensor pattern match. Fixes Mesh-LLM/mesh-llm#318 --- tools/moe-split/moe-split.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/moe-split/moe-split.cpp b/tools/moe-split/moe-split.cpp index c950f5695c42..7389b4850a52 100644 --- a/tools/moe-split/moe-split.cpp +++ b/tools/moe-split/moe-split.cpp @@ -212,7 +212,8 @@ static void parse_args(int argc, const char ** argv, moe_split_params & params) static bool is_expert_tensor(const char * name) { return strstr(name, "ffn_gate_exps") != nullptr || strstr(name, "ffn_up_exps") != nullptr - || strstr(name, "ffn_down_exps") != nullptr; + || strstr(name, "ffn_down_exps") != nullptr + || strstr(name, "exp_probs_b") != nullptr; } // Check if tensor is a shared-expert tensor (trunk, not sliced)