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

Method __init__

k_diffusion/models/modules.py:370–379  ·  view source on GitHub ↗
(self, d_model, d_head, cond_features, dropout=0.0)

Source from the content-addressed store, hash-verified

368
369class SelfAttentionBlock(nn.Module):
370 def __init__(self, d_model, d_head, cond_features, dropout=0.0):
371 super().__init__()
372 self.d_head = d_head
373 self.n_heads = d_model // d_head
374 self.norm = AdaRMSNorm(d_model, cond_features)
375 self.qkv_proj = apply_wd(Linear(d_model, d_model * 3, bias=False))
376 self.scale = nn.Parameter(torch.full([self.n_heads], 10.0))
377 self.pos_emb = AxialRoPE(d_head // 2, self.n_heads)
378 self.dropout = nn.Dropout(dropout)
379 self.out_proj = apply_wd(zero_init(Linear(d_model, d_model, bias=False)))
380
381 def extra_repr(self):
382 return f"d_head={self.d_head},"

Callers

nothing calls this directly

Calls 6

AdaRMSNormClass · 0.85
apply_wdFunction · 0.85
LinearClass · 0.85
zero_initFunction · 0.85
AxialRoPEClass · 0.70
__init__Method · 0.45

Tested by

no test coverage detected