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

Class T5LayerNorm

diffsynth/models/wan_video_text_encoder.py:22–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20
21
22class T5LayerNorm(nn.Module):
23
24 def __init__(self, dim, eps=1e-6):
25 super(T5LayerNorm, self).__init__()
26 self.dim = dim
27 self.eps = eps
28 self.weight = nn.Parameter(torch.ones(dim))
29
30 def forward(self, x):
31 x = x * torch.rsqrt(x.float().pow(2).mean(dim=-1, keepdim=True) +
32 self.eps)
33 if self.weight.dtype in [torch.float16, torch.bfloat16]:
34 x = x.type_as(self.weight)
35 return self.weight * x
36
37
38class T5Attention(nn.Module):

Callers 2

__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected