MCPcopy Create free account
hub / github.com/kyegomez/BitNet / __init__

Method __init__

bitnet/bit_transformer.py:58–80  ·  view source on GitHub ↗
(
        self, dim: int, heads: int, depth: int, ff_mult: int = 2, *args, **kwargs
    )

Source from the content-addressed store, hash-verified

56 """
57
58 def __init__(
59 self, dim: int, heads: int, depth: int, ff_mult: int = 2, *args, **kwargs
60 ):
61 super().__init__()
62 self.layers = nn.ModuleList([])
63 self.ffn_layers = nn.ModuleList([])
64
65 for _ in range(depth):
66 self.layers.append(BitMGQA(dim, heads, *args, **kwargs))
67
68 self.ffn_layers.append(
69 BitFeedForward(
70 dim,
71 dim,
72 ff_mult,
73 swish=True,
74 post_act_ln=True,
75 dropout=0.1,
76 ),
77 )
78
79 # Norm
80 self.norm = nn.LayerNorm(dim)
81
82 def forward(self, x: Tensor, *args, **kwargs) -> Tensor:
83 skip = x

Callers

nothing calls this directly

Calls 3

BitMGQAClass · 0.90
BitFeedForwardClass · 0.90
__init__Method · 0.45

Tested by

no test coverage detected