Add HiddenAct::Silu (remove serde alias)
#631
Merged
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.
What does this PR do?
TL;DR Leverage
HiddenAct.forwardand handle SiLU and SwiGLU separatelyThis PR fixes the
forwardmethod in theHiddenActimplementation to use the SiLU activation when the activation is SwiGLU, since SwiGLU is SiLU + down projection to half the size since it's split on the intermediate dimension (as per https://github.com/huggingface/candle/blob/17313a4226a6c6bde444d28b4be4f0f96d155be7/candle-nn/src/ops.rs#L44-L47), and sincecandlebrings an implementation for it, then theserdealias forSiluhas been removed to handle separately both Silu and Swiglu.Additionally, to unify the codebase, this PR leverages the
forwardmethod inHiddenActinstead of the previousmatch self.act.Fixes #629
Before submitting
Who can review?
@kozistr since they recently introduced the
forwardmethod inHiddenActand @Narsil to verify the current patch