MCPcopy Create free account
hub / github.com/RightNow-AI/autokernel / __init__

Method __init__

models/gpt2.py:74–79  ·  view source on GitHub ↗
(self, n_embd: int, n_head: int, block_size: int, dropout: float = 0.0)

Source from the content-addressed store, hash-verified

72
73class Block(nn.Module):
74 def __init__(self, n_embd: int, n_head: int, block_size: int, dropout: float = 0.0):
75 super().__init__()
76 self.ln_1 = nn.LayerNorm(n_embd)
77 self.attn = CausalSelfAttention(n_embd, n_head, block_size, dropout)
78 self.ln_2 = nn.LayerNorm(n_embd)
79 self.mlp = MLP(n_embd, dropout)
80
81 def forward(self, x: torch.Tensor) -> torch.Tensor:
82 x = x + self.attn(self.ln_1(x))

Callers

nothing calls this directly

Calls 3

CausalSelfAttentionClass · 0.85
MLPClass · 0.85
__init__Method · 0.45

Tested by

no test coverage detected