(self, input: Tensor)
| 62 | self.weight.dequantizer = DeQuantizer(config, pre_quant_layer.weight.dtype) |
| 63 | |
| 64 | def forward(self, input: Tensor) -> Tensor: |
| 65 | quantized_weight, quant_scale, quant_min = self.weight.deconcat(self.weight) |
| 66 | temp_dequantized_weight = self.weight.dequantizer.dequantize(quantized_weight.view(torch.uint8), quant_scale, |
| 67 | quant_min) |
| 68 | |
| 69 | # !!! Do not use torch.functional.linear(input, temp_dequantized_weight, self.bias) here as in zero3 torch.functional.linear is |
| 70 | # replaced by LinearFunctionForZeroStage3. Which assume weight is non-temporary. |
| 71 | # If weight is temp buffer there will be memory leak. |
| 72 | return torch._C._nn.linear(input, temp_dequantized_weight, self.bias) |
| 73 | |
| 74 | |
| 75 | class QuantizedEmbedding(nn.Embedding): |
nothing calls this directly
no test coverage detected