Skip to content

Commit 97c7982

Browse files
ggerganovinfil00p
authored andcommitted
model : fix llama4 graph (ggml-org#13663)
ggml-ci
1 parent cbedf6c commit 97c7982

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/llama-model.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4803,8 +4803,21 @@ struct llm_build_llama_iswa : public llm_graph_context {
48034803
ggml_tensor * ffn_inp = ggml_add(ctx0, cur, inpSA);
48044804
cb(ffn_inp, "ffn_inp", il);
48054805

4806-
{
4807-
// llama4 MoE
4806+
// feed-forward network (non-MoE)
4807+
if (model.layers[il].ffn_gate_inp == nullptr) {
4808+
cur = build_norm(ffn_inp,
4809+
model.layers[il].ffn_norm, NULL,
4810+
LLM_NORM_RMS, il);
4811+
cb(cur, "ffn_norm", il);
4812+
4813+
cur = build_ffn(cur,
4814+
model.layers[il].ffn_up, model.layers[il].ffn_up_b, NULL,
4815+
model.layers[il].ffn_gate, model.layers[il].ffn_gate_b, NULL,
4816+
model.layers[il].ffn_down, model.layers[il].ffn_down_b, NULL,
4817+
NULL,
4818+
LLM_FFN_SILU, LLM_FFN_PAR, il);
4819+
cb(cur, "ffn_out", il);
4820+
} else {
48084821
ggml_tensor * ffn_inp_normed = build_norm(ffn_inp,
48094822
model.layers[il].ffn_norm, NULL,
48104823
LLM_NORM_RMS, il);

0 commit comments

Comments
 (0)