| 23 | |
| 24 | |
| 25 | class 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 | |
| 47 | def get_args(): |
no outgoing calls