module_target
module_target
¶
Torch Module-level targets for quantization workflows.
QuantizationModuleTarget
¶
Base class for a quantized policy submodule target.
Initialize the target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_path
|
str
|
Dotted path to the target module, or |
required |
Source code in src/versatil/quantization/module_target.py
label
property
¶
Return a readable module label for logs and errors.
Returns:
| Type | Description |
|---|---|
str
|
|
str
|
full-policy target. |
contains_module
¶
Return whether a named module is inside this target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_name
|
str
|
Fully qualified module name from |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether |
bool
|
the target module. The root target contains every module. |
Source code in src/versatil/quantization/module_target.py
overlaps
¶
Return whether two targets can select the same submodule.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
other
|
QuantizationModuleTarget
|
Target to compare against this target. |
required |
Returns:
| Type | Description |
|---|---|
bool
|
Whether either target is root, both targets are the same path, or |
bool
|
one target is nested under the other. |
Source code in src/versatil/quantization/module_target.py
EagerQuantizationModuleTarget
¶
Bases: QuantizationModuleTarget
Target using an eager quantization config.
Initialize an eager quantization target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_path
|
str
|
Dotted path to the target module, or |
required |
quantize_config
|
AOBaseConfig
|
torchao eager quantization config applied to this target. |
required |
Source code in src/versatil/quantization/module_target.py
PT2EQuantizationModuleTarget
¶
Bases: QuantizationModuleTarget
Target using a PyTorch 2 Export backend quantizer config.
Initialize a PT2E quantization target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_path
|
str
|
Dotted path to the target module, or |
required |
pt2e_backend
|
BasePT2EBackend
|
PT2E backend that creates the quantizer for this target. |
required |
Source code in src/versatil/quantization/module_target.py
needs_calibration
property
¶
Return whether this target requires calibration batches.
Returns:
| Type | Description |
|---|---|
bool
|
|
bool
|
backends. |