(self, config: Dict, dtype: torch.dtype)
| 101 | class DeQuantizer: |
| 102 | |
| 103 | def __init__(self, config: Dict, dtype: torch.dtype) -> None: |
| 104 | self.config = config |
| 105 | self.dtype = dtype |
| 106 | assert self.config['num_bits'] == 4 or self.config[ |
| 107 | 'num_bits'] == 8, 'Only INT4 and INT8 quantization is supported.' |
| 108 | assert self.config['symmetric'] == False, 'Only asymmetric quantization is supported at this moment.' |
| 109 | |
| 110 | def dequantize(self, tensor: Tensor, quant_scale: Tensor, quant_min: Tensor) -> Tensor: |
| 111 | # Use customized CUDA quantization kernel if possible. |
nothing calls this directly
no outgoing calls
no test coverage detected