xnn.common.config.loaders.from_hydra#

xnn.common.config.loaders.from_hydra(dict_config)[source]#

Build a Config from a Hydra / OmegaConf DictConfig.

Converts the DictConfig to a plain container (resolving interpolations) via omegaconf.OmegaConf.to_container(), falling back to dict() if OmegaConf is not installed, then funnels it through from_dict().

Parameters:

dict_config (omegaconf.DictConfig) – The Hydra-provided configuration node.

Returns:

The populated configuration object.

Return type:

Config

Examples

In your Hydra entrypoint:

from omegaconf import OmegaConf

@hydra.main(config_path="configs", config_name="train")
def main(cfg):
    config = from_hydra(cfg)