-
Notifications
You must be signed in to change notification settings - Fork 0
Config Usage
This guide demonstrates how to load and parse configuration files using Hydra's configuration management system. Neuraldecoding provides utilities to load, validate, and extract specific sections from hierarchical YAML configurations.
def parse_verify_config(config: DictConfig, section_name: str) -> dictTake in a config dict, validates the config, and return the content of a specific section.
-
config : DictConfig
Config dictionary loaded from Hydra's compose function.
-
section_name : str
The section name to extract from the config file. Supported values are 'decoder' and 'trainer'.
-
dict
The config for the specified section in the config file.
-
ValueError
If the specified section is not found in the config file, if the section has invalid structure, or if an unsupported section name is provided.
To load a configuration file, use Hydra's initialize and compose functions:
from hydra import initialize, compose
with initialize(version_base=None, config_path="../../configs/parsing_test_1"):
cfg = compose("config")
decoder_config = parse_verify_config(cfg, 'decoder')
trainer_config = parse_verify_config(cfg, 'trainer')