MCPcopy Create free account
hub / github.com/MeiGen-AI/MultiTalk / SwiGLU

Class SwiGLU

wan/modules/clip.py:94–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92
93
94class SwiGLU(nn.Module):
95
96 def __init__(self, dim, mid_dim):
97 super().__init__()
98 self.dim = dim
99 self.mid_dim = mid_dim
100
101 # layers
102 self.fc1 = nn.Linear(dim, mid_dim)
103 self.fc2 = nn.Linear(dim, mid_dim)
104 self.fc3 = nn.Linear(mid_dim, dim)
105
106 def forward(self, x):
107 x = F.silu(self.fc1(x)) * self.fc2(x)
108 x = self.fc3(x)
109 return x
110
111
112class AttentionBlock(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected