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, *, schema_type=None)
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 dict or list.schema_typesupplies a typing context for import resolution when the file itself has nomodelopt-schemacomment. It is intentionally not a request to validate the top-level file. Top-level files are validated only when they declaremodelopt-schema; imported snippets are stricter and must always declaremodelopt-schema.- Parameters:
config_path (str | Path | Traversable)
schema_type (Any | None)
- Return type:
dict[str, Any] | list[Any]