pt2e
pt2e
¶
PT2E quantization workflow.
PT2EQuantizationWorkflow
¶
Bases: BaseQuantizationWorkflow
PT2E graph quantization workflow.
Initialize with PT2E module targets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
targets
|
list[PT2EQuantizationModuleTarget]
|
module-level PT2E quantization targets. |
required |
Source code in src/versatil/quantization/workflows/pt2e.py
pt2e_backend_names
property
¶
Return serialized PT2E backend names used by all targets.
quantization_mode
property
¶
Return pt2e because this workflow quantizes an exported graph.
load_policy_context
¶
Load the policy checkpoint required by PT2E quantization.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
checkpoint_path
|
str
|
Directory containing the training checkpoint. |
required |
checkpoint_name
|
str
|
Checkpoint filename to load from the directory. |
required |
Returns:
| Type | Description |
|---|---|
PolicyContext
|
Float policy context used for PT2E export, preparation, |
PolicyContext
|
calibration, and conversion. |
Source code in src/versatil/quantization/workflows/pt2e.py
quantize
¶
Export, prepare, optionally calibrate, and convert with PT2E.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
context
|
PolicyContext
|
Loaded float policy context. |
required |
exportable
|
ExportablePolicy
|
Policy wrapper exposing positional tensor inputs for
|
required |
calibration_steps
|
int
|
Maximum number of training batches used for static PT2E calibration. |
required |
Returns:
| Type | Description |
|---|---|
QuantizedContext
|
Float exported model, PT2E-converted model, and example inputs. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If a target path is invalid or targets overlap. |