MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / __init__

Method __init__

diffsynth/models/sd3_dit.py:244–265  ·  view source on GitHub ↗
(self, dim, num_attention_heads, use_rms_norm=False, dual=False)

Source from the content-addressed store, hash-verified

242
243class JointTransformerBlock(torch.nn.Module):
244 def __init__(self, dim, num_attention_heads, use_rms_norm=False, dual=False):
245 super().__init__()
246 self.norm1_a = AdaLayerNorm(dim, dual=dual)
247 self.norm1_b = AdaLayerNorm(dim)
248
249 self.attn = JointAttention(dim, dim, num_attention_heads, dim // num_attention_heads, use_rms_norm=use_rms_norm)
250 if dual:
251 self.attn2 = SingleAttention(dim, num_attention_heads, dim // num_attention_heads, use_rms_norm=use_rms_norm)
252
253 self.norm2_a = torch.nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6)
254 self.ff_a = torch.nn.Sequential(
255 torch.nn.Linear(dim, dim*4),
256 torch.nn.GELU(approximate="tanh"),
257 torch.nn.Linear(dim*4, dim)
258 )
259
260 self.norm2_b = torch.nn.LayerNorm(dim, elementwise_affine=False, eps=1e-6)
261 self.ff_b = torch.nn.Sequential(
262 torch.nn.Linear(dim, dim*4),
263 torch.nn.GELU(approximate="tanh"),
264 torch.nn.Linear(dim*4, dim)
265 )
266
267
268 def forward(self, hidden_states_a, hidden_states_b, temb):

Callers

nothing calls this directly

Calls 4

AdaLayerNormClass · 0.85
JointAttentionClass · 0.85
SingleAttentionClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected