espnet3.utils.config_utils.load_yaml
espnet3.utils.config_utils.load_yaml
espnet3.utils.config_utils.load_yaml(path, key=None)
Load a YAML file and optionally return a nested key.
This resolver is intended for pulling a single value from another config, e.g., ${load_yaml:conf/train.yaml,exp_tag}. The path is interpreted relative to the YAML file that contains the resolver expression, not relative to the current working directory.
Example directory structure: : conf/ : training.yaml inference.yaml
Example values: : # conf/training.yaml exp_tag: train_debug output_dir: ./exp/train_debug <br/>
conf/inference.yaml
exp_tag: ${load_yaml:training.yaml,exp_tag} output_dir: $
In this case, training.yaml is resolved relative to conf/inference.yaml, so both values can be loaded without using an absolute path.
NOTE
Resolver paths are usually written without surrounding quotes, such as ${load_yaml:training.yaml,exp_tag}. Quoted paths are also supported when the path contains spaces.
- Parameters:
- path (str or Path) – Path to the YAML file.
- key (str , optional) – Dot-delimited key to select.
- Returns: The selected value or the full config if key is None.
- Return type: Any
