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, resolve: bool = True)
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.
Examples
If a recipe config lives at.
egs3/mini_an4/asr/conf/training.yaml
With config_name="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 returnsNone. - config_name (str) – Config filename under
conf/, such astraining.yaml,inference.yaml, ormetrics.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 underegs3/<recipe>/asr/conf/maps toegs3.TEMPLATE.asr.
- config_path (Path | None) – Path to the user config. If
- Returns: The merged config. Interpolations are resolved after merging when
resolveisTrue. ReturnsNoneifconfig_pathisNone. - Return type: OmegaConf.DictConfig | None
