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

Method __init__

models/transformer/wan/modules/t5.py:71–84  ·  view source on GitHub ↗
(self, dim, dim_attn, num_heads, dropout=0.1)

Source from the content-addressed store, hash-verified

69class T5Attention(nn.Module):
70
71 def __init__(self, dim, dim_attn, num_heads, dropout=0.1):
72 assert dim_attn % num_heads == 0
73 super(T5Attention, self).__init__()
74 self.dim = dim
75 self.dim_attn = dim_attn
76 self.num_heads = num_heads
77 self.head_dim = dim_attn // num_heads
78
79 # layers
80 self.q = nn.Linear(dim, dim_attn, bias=False)
81 self.k = nn.Linear(dim, dim_attn, bias=False)
82 self.v = nn.Linear(dim, dim_attn, bias=False)
83 self.o = nn.Linear(dim_attn, dim, bias=False)
84 self.dropout = nn.Dropout(dropout)
85
86 def forward(self, x, context=None, mask=None, pos_bias=None):
87 """

Callers

nothing calls this directly

Calls 1

__init__Method · 0.45

Tested by

no test coverage detected