MCPcopy Create free account
hub / github.com/MotrixLab/ViMoGen / T5FeedForward

Class T5FeedForward

models/transformer/wan/modules/t5.py:123–141  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected