ConvertArgs
PythonConfiguration for the conversion process.
ConvertArgs()Configuration for the conversion process.
path
Pythonpath: Path = Field(default_factory=lambda : ..., exclude=True, description='Path to yaml configuration')Path to yaml configuration.
model
Pythonmodel: ModelArgs = Field(default_factory=ModelArgs, description='Model configuration')Model configuration.
module
Pythonmodule: ModuleArgs = Field(default_factory=ModuleArgs, description='Module configuration')Module configuration.
test
Pythontest: TestArgs = Field(default_factory=TestArgs, description='Test configuration')Test configuration.
transforms
Pythontransforms: list[TransformSpec] = Field(default_factory=list, description='Transforms configuration')Transforms configuration.
memory
Pythonmemory: MemoryArgs = Field(default_factory=MemoryArgs, description='Memory configuration')Memory configuration.
platform
Pythonplatform: PlatformArgs = Field(default_factory=PlatformArgs, description='Target platform configuration')Target platform configuration.
operators
Pythonoperators: list[OperatorRuleset] = Field(default_factory=list, description='Operator attributes and optimization knob overrides')Operator attribute rules and optimization knob overrides.
documentation
Pythondocumentation: DocumentationArgs = Field(default_factory=DocumentationArgs, description='Documentation configuration')Documentation configuration.
optimization
Pythonoptimization: OptimizationArgs = Field(default_factory=OptimizationArgs, description='Optimization goal, approximation gate and knobs')Optimization goal, approximation gate and knobs.
verbose
Pythonverbose: int = Field(1, ge=0, le=3, description='Verbosity level')Verbosity level (0-3).
force
Pythonforce: bool = Field(False, description='Force conversion even if output exists')keep_work_dir
Pythonkeep_work_dir: bool = Field(False, description='Keep the temporary work directory and log its path')Keep the temporary work directory after the conversion instead of removing it, and log its path.
log_file
Pythonlog_file: Path | None = Field(None, description='Optional log file path')Optional log file path.
operator_rules
PythonReturn the operator attribute rules, without optimization knobs.
operator_rules() -> list[AttributeRuleset]Return the operator attribute rules, without optimization knobs.
Returns
| Type | Description |
|---|---|
list[AttributeRuleset] | list[AttributeRuleset]: The rules to resolve operator attributes from. |
knob_rules
PythonReturn the optimization knob rules, resolved like attributes but on their own channel.
knob_rules(*, include_model_knobs: bool = True) -> list[AttributeRuleset]Return the optimization knob rules, resolved like attributes but on their own channel.
The model-wide knobs (optimization.accumulation) become a leading
"*" rule, so every operators[].optimization override wins over
them with the usual type/id specificity.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
include_model_knobs | bool | True | Lead with the model-wide knob rule. |
Returns
| Type | Description |
|---|---|
list[AttributeRuleset] | list[AttributeRuleset]: Rules whose attributes are knob values. |
model_knob_values
PythonReturn the model-wide value of every knob, auto where unset.
model_knob_values() -> dict[str, str]Return the model-wide value of every knob, auto where unset.
explicit_model_knobs
PythonReturn the knobs set explicitly under optimization, even when set to auto.
explicit_model_knobs() -> frozenset[str]Return the knobs set explicitly under optimization, even when set to auto.
operator_knob_rules
PythonReturn each operators[] rule that overrides knobs, with its position.
operator_knob_rules() -> list[tuple[int, AttributeRuleset]]Return each operators[] rule that overrides knobs, with its position.
Returns
| Type | Description |
|---|---|
list[tuple[int, AttributeRuleset]] | list[tuple[int, AttributeRuleset]]: ``(index in operators, rule)``, |
list[tuple[int, AttributeRuleset]] | where the rule's attributes are its knob overrides. |
from_yaml
PythonLoad a conversion config from a YAML file.
from_yaml(path: str | Path) -> ConvertArgsclassmethod
Load a conversion config from a YAML file.
The canonical programmatic entry point mirroring the CLI’s --path
(without the CLI’s flag-override merge):
config = ConvertArgs.from_yaml(“my-model.yaml”) AotConverter(config=config).convert()
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
path | str | Path | Required | Path to a YAML mapping of conversion options. |
Returns
| Type | Description |
|---|---|
ConvertArgs | The validated configuration; unknown nested keys warn as usual. |
Raises
| Type | Description |
|---|---|
FileNotFoundError | If ``path`` does not exist. |
ValueError | If the file is not a YAML mapping. |