Skip to content

Commit 12a4a47

Browse files
pwilkinCISCngxson
authored
Fix GLM 4.7 Lite MoE gating func (ggml-org#18980)
* Fix GLM 4.7 MoE gating func * Update src/models/deepseek2.cpp Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com> * Update src/llama-model.cpp Co-authored-by: Xuan-Son Nguyen <thichthat@gmail.com> --------- Co-authored-by: Sigbjørn Skjæret <sigbjorn.skjaeret@scala.com> Co-authored-by: Xuan-Son Nguyen <thichthat@gmail.com>
1 parent 37c35f0 commit 12a4a47

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/llama-model.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,12 @@ void llama_model::load_hparams(llama_model_loader & ml) {
17131713
if (hparams.expert_gating_func == LLAMA_EXPERT_GATING_FUNC_TYPE_NONE) {
17141714
// for compatibility with existing DeepSeek V2 and V2.5 GGUFs
17151715
// that have no expert_gating_func model parameter set
1716-
hparams.expert_gating_func = LLAMA_EXPERT_GATING_FUNC_TYPE_SOFTMAX;
1716+
if ((hparams.n_layer == 47 || hparams.n_layer == 48) && n_vocab == 154880) {
1717+
// GLM 4.7 Lite
1718+
hparams.expert_gating_func = LLAMA_EXPERT_GATING_FUNC_TYPE_SIGMOID;
1719+
} else {
1720+
hparams.expert_gating_func = LLAMA_EXPERT_GATING_FUNC_TYPE_SOFTMAX;
1721+
}
17171722
}
17181723

17191724
if (ml.get_key(LLM_KV_ROPE_SCALING_YARN_LOG_MUL, hparams.rope_yarn_log_mul, 0.0f)) {

0 commit comments

Comments
 (0)