fb-hydraomegaconf

Is it possible to import just a single configuration parameter, not all in Hydra?


constants_config.yaml

site:  fb
another_site: google

my_config.yaml

my_site: ${constants_config.yaml]

Resulting my_config.yaml

my_site: fb

I just want to get a single constant, not the whole constants_config.yaml (which is done by using default)


Solution

  • Not possible directly. You can do it with interpolation into a constants node. Something like:

    constants.yaml:

    constants:
      site:  fb
      another_site: google
    

    main.yaml:

    defaults:
      - constants
    
    my_site: ${constants.site}
    

    The composed config should look something like:

    constants:
      site:  fb
      another_site: google
    
    my_site: ${constants.site}