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

Method __init__

wan/modules/t5.py:322–354  ·  view source on GitHub ↗
(self,
                 vocab,
                 dim,
                 dim_attn,
                 dim_ffn,
                 num_heads,
                 num_layers,
                 num_buckets,
                 shared_pos=True,
                 dropout=0.1)

Source from the content-addressed store, hash-verified

320class T5Decoder(nn.Module):
321
322 def __init__(self,
323 vocab,
324 dim,
325 dim_attn,
326 dim_ffn,
327 num_heads,
328 num_layers,
329 num_buckets,
330 shared_pos=True,
331 dropout=0.1):
332 super(T5Decoder, self).__init__()
333 self.dim = dim
334 self.dim_attn = dim_attn
335 self.dim_ffn = dim_ffn
336 self.num_heads = num_heads
337 self.num_layers = num_layers
338 self.num_buckets = num_buckets
339 self.shared_pos = shared_pos
340
341 # layers
342 self.token_embedding = vocab if isinstance(vocab, nn.Embedding) \
343 else nn.Embedding(vocab, dim)
344 self.pos_embedding = T5RelativeEmbedding(
345 num_buckets, num_heads, bidirectional=False) if shared_pos else None
346 self.dropout = nn.Dropout(dropout)
347 self.blocks = nn.ModuleList([
348 T5CrossAttention(dim, dim_attn, dim_ffn, num_heads, num_buckets,
349 shared_pos, dropout) for _ in range(num_layers)
350 ])
351 self.norm = T5LayerNorm(dim)
352
353 # initialize weights
354 self.apply(init_weights)
355
356 def forward(self, ids, mask=None, encoder_states=None, encoder_mask=None):
357 b, s = ids.size()

Callers

nothing calls this directly

Calls 4

T5RelativeEmbeddingClass · 0.85
T5CrossAttentionClass · 0.85
T5LayerNormClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected