(self, input: Tensor)
| 964 | raise NotImplementedError("Saving Embedding4bit module is not implemented") |
| 965 | |
| 966 | def forward(self, input: Tensor) -> Tensor: |
| 967 | fix_4bit_weight_quant_state_from_module(self) |
| 968 | |
| 969 | if self.embedding_dim % self.weight.quant_state.blocksize == 0: |
| 970 | return self._forward_with_partial_dequantize(input) |
| 971 | |
| 972 | dequantized_weight = bnb.functional.dequantize_4bit(self.weight.data, self.weight.quant_state) |
| 973 | |
| 974 | return torch.nn.functional.embedding( |
| 975 | weight=dequantized_weight, |
| 976 | input=input, |
| 977 | ).to(self.dtype) |
| 978 | |
| 979 | |
| 980 | class EmbeddingFP4(Embedding4bit): |
nothing calls this directly
no test coverage detected