fix: slice exp_probs_b tensors in moe-split for GLM-5.1 compatibility - #6
Merged
Merged
Conversation
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
|
@ventz would you be able to share your full analysis of GLM 5.1 using I'd recommend doing |
Author
|
No problem. Will be traveling for a week but will after that. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes Mesh-LLM/mesh-llm#318
GLM-5.1 has per-expert
exp_probs_b.biastensors with shape[n_expert x 1 x 1]that are expert-count-dependent but not matched byis_expert_tensor(). The split reduces expert count in metadata but these tensors pass through unsliced, causing llama-server to reject the shard with a shape mismatch.Fix
Add
exp_probs_bto the expert tensor name matching inis_expert_tensor().Verification
With the fix, all 79 blocks show correct slicing (
[256 x 1 x 1] → [192 x 1 x 1]). No shape mismatch, shard loads successfully.