MCPcopy Create free account
hub / github.com/pytorch/examples / __init__

Method __init__

distributed/FSDP2/model.py:77–84  ·  view source on GitHub ↗
(self, args: ModelArgs)

Source from the content-addressed store, hash-verified

75
76class TransformerBlock(nn.Module):
77 def __init__(self, args: ModelArgs):
78 super().__init__()
79 self.attention_norm = nn.LayerNorm(args.dim)
80 self.attention = Attention(args)
81 self.ffn_norm = nn.LayerNorm(args.dim)
82 self.feed_forward = FeedForward(
83 args.dim, hidden_dim=4 * args.dim, dropout_p=args.dropout_p
84 )
85
86 def forward(self, x):
87 h = x + self.attention(self.attention_norm(x))

Callers

nothing calls this directly

Calls 3

AttentionClass · 0.70
FeedForwardClass · 0.70
__init__Method · 0.45

Tested by

no test coverage detected