get_quantizer_mode¶
- torchtune.utils.get_quantizer_mode(quantizer: Optional[Callable]) Optional[str] [source]¶
Given a quantizer object, returns a string that specifies the type of quantization.
For example, in the case of int4 weight only quantization, we’ll return “4w”. If the quantizer is not recognized as a known quantizer, we’ll return None.
Currently supported:
Int4WeightOnlyQuantizer
: “4w”Int8WeightOnlyQuantizer
: “8w”Int4WeightOnlyGPTQQuantizer
: “4w-gptq”Int8DynActInt4WeightQuantizer
: “8da4w” (requirestorch>=2.3.0
)Int8DynActInt4WeightQATQuantizer
: “8da4w-qat” (requirestorch>=2.4.0
)
- Parameters:
quantizer (Optional[Callable]) – A callable object that implements the quantize method.
- Returns:
The quantization mode.
- Return type:
Optional[str]