ml_collections.config_flags.config_flags.SetValue

ml_collections.config_flags.config_flags.SetValue(config_path: str, config: Any, value: Any)

Sets value of field described by config_path.

Example usage:
>>> config = {'a': {'b', {'c', 10}}}
>>> config_path.set_value('a.b.c', config, 20)
>>> assert config['a']['b']['c'] == 20
Parameters:
  • config_path – Any string that split can process.
  • config – A nested datastructure
  • value – A value to assign to final field.
Raises:
  • IndexError – Integer field not found in nested structure.
  • KeyError – Non-integer field not found in nested structure.
  • ValueError – Empty/invalid config_path after parsing.