MCPcopy Create free account
hub / github.com/MotrixLab/FineMoGen / DecoderLayer

Class DecoderLayer

mogen/models/transformers/diffusion_transformer.py:31–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29
30
31class DecoderLayer(nn.Module):
32
33 def __init__(self, sa_block_cfg=None, ca_block_cfg=None, ffn_cfg=None):
34 super().__init__()
35 self.sa_block = build_attention(sa_block_cfg)
36 self.ca_block = build_attention(ca_block_cfg)
37 self.ffn = FFN(**ffn_cfg)
38
39 def forward(self, **kwargs):
40 if self.sa_block is not None:
41 x = self.sa_block(**kwargs)
42 kwargs.update({'x': x})
43 if self.ca_block is not None:
44 x = self.ca_block(**kwargs)
45 kwargs.update({'x': x})
46 if self.ffn is not None:
47 x = self.ffn(**kwargs)
48 return x
49
50
51class DiffusionTransformer(BaseModule, metaclass=ABCMeta):

Callers 1

build_temporal_blocksMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected