MCPcopy Create free account
hub / github.com/Francis-Rings/FlashPortrait / T5FeedForward

Class T5FeedForward

wan/models/wan_text_encoder.py:112–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110
111
112class T5FeedForward(nn.Module):
113
114 def __init__(self, dim, dim_ffn, dropout=0.1):
115 super(T5FeedForward, self).__init__()
116 self.dim = dim
117 self.dim_ffn = dim_ffn
118
119 # layers
120 self.gate = nn.Sequential(nn.Linear(dim, dim_ffn, bias=False), GELU())
121 self.fc1 = nn.Linear(dim, dim_ffn, bias=False)
122 self.fc2 = nn.Linear(dim_ffn, dim, bias=False)
123 self.dropout = nn.Dropout(dropout)
124
125 def forward(self, x):
126 x = self.fc1(x) * self.gate(x)
127 x = self.dropout(x)
128 x = self.fc2(x)
129 x = self.dropout(x)
130 return x
131
132
133class T5SelfAttention(nn.Module):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected