Load YAML files in structured folders with OmegaConf

399 views Asked by At
configs
|_________ experiment
|         |--------- test.yaml
|--------- default.yaml

default.yaml has some configuration parameters and then

experiment: test.yaml

test.yaml defines more parameters, such as learning_rate: 0.1.
I would like to load them recursively with OmegaConf. If I do

from omegaconf import DictConfig, OmegaConf
conf = OmegaConf.load("configs/default.yaml")

It doesn't work because conf has key experiment with value test, rather than key learning_rate with value 0.1.
It is possible to read YAML files recursively?

1

There are 1 answers

1
Omry Yadan On BEST ANSWER

OmegaConf is a low level library. It does not support higher level functionality like what you seems to be asking for. If you want to compose configs from multiple files/sources into a single object, I recommend that you use Hydra (@hydra.main() or the Compose API).