(self, device)
| 735 | return obj |
| 736 | |
| 737 | def _quantize(self, device): |
| 738 | if self.has_fp16_weights: |
| 739 | return super().to(device) |
| 740 | |
| 741 | # We quantize the weight and store in 8bit row-major |
| 742 | B = self.data.contiguous().to(device=device, dtype=torch.float16) |
| 743 | CB, SCB, _ = bnb.functional.int8_vectorwise_quant(B) |
| 744 | self.data = CB |
| 745 | self.CB = CB |
| 746 | self.SCB = SCB |
| 747 | |
| 748 | return self |
| 749 | |
| 750 | def cpu(self): |
| 751 | return self.to(device="cpu") |