MCPcopy Create free account
hub / github.com/Meshcapade/difflocks / MappingFeedForwardBlock

Class MappingFeedForwardBlock

k_diffusion/models/modules.py:564–578  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

562# Mapping network
563
564class MappingFeedForwardBlock(nn.Module):
565 def __init__(self, d_model, d_ff, dropout=0.0):
566 super().__init__()
567 self.norm = RMSNorm(d_model)
568 self.up_proj = apply_wd(LinearGEGLU(d_model, d_ff, bias=False))
569 self.dropout = nn.Dropout(dropout)
570 self.down_proj = apply_wd(zero_init(Linear(d_ff, d_model, bias=False)))
571
572 def forward(self, x):
573 skip = x
574 x = self.norm(x)
575 x = self.up_proj(x)
576 x = self.dropout(x)
577 x = self.down_proj(x)
578 return x + skip
579
580class MappingNetwork(nn.Module):
581 def __init__(self, n_layers, d_model, d_ff, dropout=0.0):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected