espnet3.utils.config_utils.load_and_merge_config
espnet3.utils.config_utils.load_and_merge_config
espnet3.utils.config_utils.load_and_merge_config(config_path: Path | None, config_name: str, default_package: str | None = None)
Load a user config and merge it with packaged default values.
This is the higher-level helper used by recipe code. It first loads the default config through load_default_config(), then loads the user config without resolving interpolations, merges the two, and finally resolves the merged result. This allows user configs to reference values defined in the defaults, while also letting user-provided values override those defaults.
The default source is usually an egs3.TEMPLATE.* package, but any installed recipe package can be used if it provides the same config file under its own conf/ directory.
Example
If a recipe config lives at:
egs3/mini_an4/asr/conf/training.yaml
and config_name is training.yaml, this function can infer default_package=”egs3.TEMPLATE.asr” and merge:
egs3/TEMPLATE/asr/conf/training.yaml
with:
egs3/mini_an4/asr/conf/training.yaml
- Parameters:
- config_path (Path | None) – Path to the user config. If None, this function returns None.
- config_name (str) – Config filename under conf/, such as training.yaml, inference.yaml, or metrics.yaml.
- default_package (str | None) – Python package that contains the default recipe resources. If omitted, it is inferred from config_path. For example, a config under egs3/<recipe>/asr/conf/ maps to egs3.TEMPLATE.asr.
- Returns: The merged config with interpolations resolved after merging, or None if config_path is None.
- Return type: OmegaConf.DictConfig | None
