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

Class T5FeedForward

wan/modules/t5.py:128–146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126
127
128class T5FeedForward(nn.Module):
129
130 def __init__(self, dim, dim_ffn, dropout=0.1):
131 super(T5FeedForward, self).__init__()
132 self.dim = dim
133 self.dim_ffn = dim_ffn
134
135 # layers
136 self.gate = nn.Sequential(nn.Linear(dim, dim_ffn, bias=False), GELU())
137 self.fc1 = nn.Linear(dim, dim_ffn, bias=False)
138 self.fc2 = nn.Linear(dim_ffn, dim, bias=False)
139 self.dropout = nn.Dropout(dropout)
140
141 def forward(self, x):
142 x = self.fc1(x) * self.gate(x)
143 x = self.dropout(x)
144 x = self.fc2(x)
145 x = self.dropout(x)
146 return x
147
148
149class T5SelfAttention(nn.Module):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected