Skip to content

quantization

quantization

Hydra configuration dataclasses for quantization workflows and backends.

BasePT2EBackendConfig dataclass

BasePT2EBackendConfig(is_dynamic=False, is_qat=False)

Shared settings for PT2E quantization backends.

Attributes:

Name Type Description
is_dynamic bool

Whether activations are quantized dynamically.

is_qat bool

Whether the backend prepares quantization-aware training observers.

X86InductorBackendConfig dataclass

X86InductorBackendConfig(is_dynamic=False, is_qat=False, _target_='versatil.quantization.pt2e.backends.x86_inductor.X86InductorBackend', reduce_range=False)

Bases: BasePT2EBackendConfig

X86 Inductor backend for PT2E quantized operator lowering.

Attributes:

Name Type Description
_target_ str

Import path instantiated by Hydra.

reduce_range bool

Reduce quantization range for older CPUs without VNNI.

XNNPACKPT2EBackendConfig dataclass

XNNPACKPT2EBackendConfig(is_dynamic=False, is_qat=False, _target_='versatil.quantization.pt2e.backends.xnnpack.XNNPACKPT2EBackend', is_per_channel=True)

Bases: BasePT2EBackendConfig

XNNPACK backend for PT2E quantization and ExecuTorch deployment.

Attributes:

Name Type Description
_target_ str

Import path instantiated by Hydra.

is_per_channel bool

Use per-channel symmetric weight quantization.

Int8DynamicQuantizeConfig dataclass

Int8DynamicQuantizeConfig(_target_='torchao.quantization.Int8DynamicActivationInt8WeightConfig')

Dynamic int8 activation + int8 weight quantization (quantize_ API).

Int4WeightOnlyQuantizeConfig dataclass

Int4WeightOnlyQuantizeConfig(_target_='torchao.quantization.Int4WeightOnlyConfig', group_size=128)

Int4 weight-only quantization with groupwise scaling (quantize_ API).

Attributes:

Name Type Description
_target_ str

Import path instantiated by Hydra.

group_size int

Rows sharing one quantization scale.

EagerQuantizationModuleTargetConfig dataclass

EagerQuantizationModuleTargetConfig(_target_='versatil.quantization.module_target.EagerQuantizationModuleTarget', module_path='', quantize_config=MISSING)

Module target for eager torchao quantization.

Attributes:

Name Type Description
_target_ str

Import path instantiated by Hydra.

module_path str

Dotted path to the target module, or "" for root.

quantize_config Any

torchao eager quantization config applied to this target.

PT2EQuantizationModuleTargetConfig dataclass

PT2EQuantizationModuleTargetConfig(_target_='versatil.quantization.module_target.PT2EQuantizationModuleTarget', module_path='', pt2e_backend=X86InductorBackendConfig())

Module target for PT2E quantization.

Attributes:

Name Type Description
_target_ str

Import path instantiated by Hydra.

module_path str

Dotted path to the target module, or "" for root.

pt2e_backend BasePT2EBackendConfig

PT2E backend that creates the quantizer for this target.

PT2EQuantizationWorkflowConfig dataclass

PT2EQuantizationWorkflowConfig(_target_='versatil.quantization.workflows.pt2e.PT2EQuantizationWorkflow', targets=(lambda: [PT2EQuantizationModuleTargetConfig()])())

Graph-level quantization with operator fusion via torch.export.

Attributes:

Name Type Description
_target_ str

Import path instantiated by Hydra.

targets list[Any]

module-level PT2E quantization targets.

EagerQuantizationWorkflowConfig dataclass

EagerQuantizationWorkflowConfig(_target_='versatil.quantization.workflows.eager.EagerQuantizationWorkflow', targets=MISSING, is_qat=False, auto_filter_incompatible_linears=True)

Eager torchao quantization via quantize_().

Attributes:

Name Type Description
_target_ str

Import path instantiated by Hydra.

targets list[Any]

Module-level eager quantization targets.

is_qat bool

Whether this workflow is used for QAT checkpoint training and conversion.

auto_filter_incompatible_linears bool

Whether to skip linears whose in_features are incompatible with the config group size.