Shortcuts

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” (requires torch>=2.3.0)

  • Int8DynActInt4WeightQATQuantizer: “8da4w-qat” (requires torch>=2.4.0)

Parameters:

quantizer (Optional[Callable]) – A callable object that implements the quantize method.

Returns:

The quantization mode.

Return type:

Optional[str]

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources