MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / MLP8bit

Class MLP8bit

tests/test_modules.py:25–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24
25class MLP8bit(torch.nn.Module):
26 def __init__(self, dim1, dim2, has_fp16_weights=True, threshold=0.0):
27 super().__init__()
28 self.fc1 = bnb.nn.Linear8bitLt(
29 dim1,
30 dim2,
31 has_fp16_weights=has_fp16_weights,
32 threshold=threshold,
33 )
34 self.fc2 = bnb.nn.Linear8bitLt(
35 dim2,
36 dim1,
37 has_fp16_weights=has_fp16_weights,
38 threshold=threshold,
39 )
40
41 def forward(self, x):
42 x = self.fc1(x)
43 x = self.fc2(x)
44 return x
45
46
47def get_args():

Callers 1

Calls

no outgoing calls

Tested by 1