config_loader
General-purpose YAML config loading with $import resolution.
This module provides the config loading infrastructure used by both
modelopt.recipe and modelopt.torch.quantization.config. It lives
in modelopt.torch.opt (the lowest dependency layer) to avoid circular
imports.
Functions
Load a YAML config and resolve all |
- load_config(config_path: str | Path | Traversable, *, schema_type: type[_ModeloptConfigT]) _ModeloptConfigT
- load_config(config_path: str | Path | Traversable, *, schema_type: type[list[_ModeloptConfigT]]) list[_ModeloptConfigT]
- load_config(config_path: str | Path | Traversable, *, schema_type: None = None) ModeloptBaseConfig | dict[str, Any] | list[Any]
Load a YAML config and resolve all
$importreferences.This is the primary config loading entry point. It loads the YAML file, resolves any
imports/$importdirectives, and returns the final config.schema_typesupplies a typing context for import resolution when the file itself has nomodelopt-schemacomment. If eitherschema_typeor amodelopt-schemacomment is present, the resolved top-level payload is returned as the Pydantic-normalized value for that schema. Untyped files return the resolved dict or list. Imported snippets are stricter and must always declaremodelopt-schema.