Skip to content

Commit

Permalink
Small SwiGLU tweak, remove default LN arg in unpacked variant, add pa…
Browse files Browse the repository at this point in the history
…cked alias for GluMLP
  • Loading branch information
rwightman committed May 8, 2023
1 parent cb3f9c2 commit 3fdb31d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion timm/layers/mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def forward(self, x):
return x


SwiGLUPacked = partial(GluMlp, act_layer=nn.SiLU, gate_last=False)


class SwiGLU(nn.Module):
""" SwiGLU
NOTE: GluMLP above can implement SwiGLU, but this impl has split fc1 and
Expand All @@ -108,7 +111,7 @@ def __init__(
hidden_features=None,
out_features=None,
act_layer=nn.SiLU,
norm_layer=nn.LayerNorm,
norm_layer=None,
bias=True,
drop=0.,
):
Expand Down

0 comments on commit 3fdb31d

Please sign in to comment.