espnet3.utils.stage_configs.bake
Less than 1 minute
espnet3.utils.stage_configs.bake
espnet3.utils.stage_configs.bake(exp_dir: Path, stage: str, resolved: DictConfig, own_keys: Iterable[str]) → Path
Write <exp_dir>/config/<stage>.yaml: stage’s own resolved keys.
Only own_keys of resolved are written - the keys stage’s own config contributed, not the ones it inherited from an earlier stage’s bake - so re-running an unrelated later stage never rewrites what an earlier stage already baked. The write is atomic (temp file, then rename), so a run that fails partway through never leaves a corrupt <stage>.yaml for a later run to inherit.
- Parameters:
- exp_dir – The experiment directory; config/ is created if missing.
- stage – The stage name whose resolved keys are being baked.
- resolved – The fully merged, resolved config stage is about to run with.
- own_keys – The top-level keys of resolved that are stage’s own (as opposed to inherited) - typically the keys of the config loaded for stage before inherit was applied.
- Returns: The written <stage>.yaml path.
- Return type: Path
Examples
>>> import tempfile
>>> from omegaconf import OmegaConf
>>> resolved = OmegaConf.create({"exp_dir": "./exp", "seed": 1})
>>> with tempfile.TemporaryDirectory() as exp_dir:
... path = bake(Path(exp_dir), "train", resolved, ["seed"])
... OmegaConf.load(path)
{'seed': 1}