refactor: replace manual gated activations with native ggml GLU (#2250)

This commit is contained in:
leejet authored and GitHub committed 2026-10-30 01:32:46 +08:00
1 parent 37bc88b5e9
commit e239e4b0fd
13 files changed
+33 -53

No files matched your search

+2 -2
View File
@@ -207,9 +207,9 @@ namespace MiniT2I {
auto w1 = std::dynamic_pointer_cast<Linear>(blocks["w1"]);
auto w3 = std::dynamic_pointer_cast<Linear>(blocks["w3"]);
auto w2 = std::dynamic_pointer_cast<Linear>(blocks["w2"]);
auto gate = ggml_silu(ctx->ggml_ctx, w1->forward(ctx, x));
auto gate = w1->forward(ctx, x);
auto up = w3->forward(ctx, x);
return w2->forward(ctx, ggml_mul(ctx->ggml_ctx, gate, up));
return w2->forward(ctx, ggml_swiglu_split(ctx->ggml_ctx, gate, up));
}
};