xnn.common.config.loaders.apply_overrides#

xnn.common.config.loaders.apply_overrides(cfg, overrides)[source]#

Apply a.b=c style dotted overrides in place.

Shared by the CLI and Hydra paths so the same override syntax works everywhere. Each value is parsed with ast.literal_eval() and falls back to the raw string if parsing fails. A model key that is not a field of ModelConfig is a model option (model.extra), as in a config file. An entry without =, or one naming a key the config does not have, is ignored with an IgnoredOptionWarning. Config.__post_init__() is re-run afterwards to re-synchronize the cutoffs.

Parameters:
  • cfg (Config) – The configuration to mutate.

  • overrides (list[str]) – Override strings of the form "model.cutoff=6.0".

Returns:

The same cfg instance, with overrides applied.

Return type:

Config