espnet3.utils.config.load_config_with_defaults
Less than 1 minute
espnet3.utils.config.load_config_with_defaults
espnet3.utils.config.load_config_with_defaults(path: str) → OmegaConf
Load an OmegaConf YAML config file with support for recursive _self_ merging based on Hydra-style defaults lists.
This function recursively loads and merges dependent YAML files specified in the defaults key of the given config. It mimics Hydra’s composition mechanism without using Hydra’s runtime, which makes it suitable for standalone YAML handling (e.g., for distributed training or script-based training setups).
Supported formats inside defaults:
- “subconfig” → loads subconfig.yaml
- {“key”: “value”} → loads key/value.yaml
- “self” → appends the current config in-place
Example
config.yaml
defaults:
- model: conformer
- optimizer: adam
- _self_
This will recursively load:
model/conformer.yaml
optimizer/adam.yaml
and merge them with config.yaml itself at the end.
- Parameters:path (str) – Path to the main YAML config file.
- Returns: Fully resolved and merged configuration object.
- Return type: OmegaConf.DictConfig
