espnet3.bin.atlas.core.utils.apply_dotted_patch
Less than 1 minute
espnet3.bin.atlas.core.utils.apply_dotted_patch
espnet3.bin.atlas.core.utils.apply_dotted_patch(cfg, patch: dict)
Set each dotted key of patch on cfg in place, and return cfg.
A key part that is a number indexes into a list, so dataset.train.0.transform.p reaches into a dataset.train list. A value replaces what is there (a dict is not merged), and missing parents are created. A list index past the end of its list raises.
Example
>>> cfg = OmegaConf.create({"trainer": {"lr": 0.1}})
>>> OmegaConf.to_container(apply_dotted_patch(cfg, {"trainer.lr": 0.2}))
{'trainer': {'lr': 0.2}}