0

I would like to set a structured config as a default node value for some entry. I am not sure how to accomplish this. I have tried the following:

defaults:
  - trainer: /trainer_lib/trainer/base_trainer"

where /trainer_lib/trainer/base_trainer has been added to the ConfigStore in my script.

The only way I've been able to initialize this correctly is via

defaults:
  - trainer: some_trainer

and in trainer/some_trainer.yaml write as default value /trainer_lib/trainer/base_trainer@_here_.

Is there an approach where I can skip creating trainer/some_trainer.yaml file? Thank you.

Zranz
  • 57
  • 9

1 Answers1

0

Go over the Structured Configs tutorial. In particular the Structured Config Schema page.

Note that Hydra 1.1 (available as a dev release) has more powerful support for this kind of thing. Check the same page in the next version.

Omry Yadan
  • 31,280
  • 18
  • 64
  • 87
  • I have gone over the structured config schema in Hydra 1.1, which is the version I am using. In the docs you linked there is no example with a "key: value", where "value" is a structured node config (e.g., "trainer: /trainer_lib/trainer/base_trainer@_here_"). I hope this clarifies my question. Thanks. – Zranz Feb 08 '21 at 18:54
  • Omry, thank you for your answer, although I think it does not respond specifically to what I am asking. I would like to use a structured config as a value in a "key: value" entry without creating a new folder group. Is that possible? The example you linked does not show that. Thanks. – Zranz Feb 09 '21 at 21:07
  • You can use Structured Configs as configs and you can use them to validate yaml files. Please refer to the Structured Configs tutorial. All the pages until "Structured Config Schema" does not have yaml files at all. – Omry Yadan Feb 09 '21 at 21:11
  • Ok. I wanted the structured configs used to validate yaml files, also to populate the entries of a config group, directly in the parent yaml, without creating a new folder. I guess the syntax that I wanted to use is not supported. Thanks for the last clarification. – Zranz Feb 09 '21 at 21:24
  • Yes. It's a bit hard to understand what you are after but from your description I suspect it's not supported. – Omry Yadan Feb 09 '21 at 22:23