ml.core.config

Defines the base config and object classes.

The base configuration dataclass provides some small increments over what OmegaConf expects. The :func:conf_field function exists to standardize the metadata that each field should have.

ml.core.config.conf_field(value: Any, *, help: str | None = None, short: str | None = None) Any[source]

Gets a field for a given value.

Parameters:
  • value – The default value for the current field

  • help – An optional metadata field, which may be parsed to a command line argument in some CLIs

  • short – An optional metadata field, which may be parsed to a command line argument in some CLIs

Returns:

The correctly constructed dataclass field

class ml.core.config.BaseConfig(name: str = '???')[source]

Bases: object

Defines the base class for all configs.

name: str = '???'
classmethod get_defaults() dict[str, BaseConfigT][source]

Returns default configurations.

Returns:

A dictionary of default configurations for the current config

classmethod update(config: DictConfig) DictConfig[source]

Runs post-construction config update.

Parameters:

config – The config to update

classmethod resolve(config: BaseConfigT) None[source]

Runs post-construction config resolution.

Parameters:

config – The config to resolve

class ml.core.config.BaseObject(config: BaseConfigT)[source]

Bases: Generic[BaseConfigT]

Defines the base class for all objects.

property raw_config: DictConfig
set_raw_config(raw_config: DictConfig) None[source]