mirror of
https://github.com/leejet/stable-diffusion.cpp.git
synced 2026-11-11 03:24:30 +00:00
refactor: replace manual gated activations with native ggml GLU (#2250)
This commit is contained in:
1 parent
37bc88b5e9
commit
e239e4b0fd
13 files changed
+33
-53
No files matched your search
@@ -208,9 +208,9 @@ namespace Krea2 {
|
||||
auto up = std::dynamic_pointer_cast<Linear>(blocks["up"]);
|
||||
auto down = std::dynamic_pointer_cast<Linear>(blocks["down"]);
|
||||
|
||||
auto gated = ggml_silu(ctx->ggml_ctx, gate->forward(ctx, x));
|
||||
auto up_x = up->forward(ctx, x);
|
||||
x = ggml_mul(ctx->ggml_ctx, gated, up_x);
|
||||
auto gate_x = gate->forward(ctx, x);
|
||||
auto up_x = up->forward(ctx, x);
|
||||
x = ggml_swiglu_split(ctx->ggml_ctx, gate_x, up_x);
|
||||
return down->forward(ctx, x);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user