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

Class T5LayerNorm

wan/modules/t5.py:58–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56
57
58class T5LayerNorm(nn.Module):
59
60 def __init__(self, dim, eps=1e-6):
61 super(T5LayerNorm, self).__init__()
62 self.dim = dim
63 self.eps = eps
64 self.weight = nn.Parameter(torch.ones(dim))
65
66 def forward(self, x):
67 x = x * torch.rsqrt(x.float().pow(2).mean(dim=-1, keepdim=True) +
68 self.eps)
69 if self.weight.dtype in [torch.float16, torch.bfloat16]:
70 x = x.type_as(self.weight)
71 return self.weight * x
72
73
74class T5Attention(nn.Module):

Callers 4

__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85
__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected