-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RFC: Sub-config overhaul #66
Comments
I find the inclusion of loading subconfigs in |
So what do you think about the primary config variant I've proposed? Note that its syntax is different from what we've discussed. |
The separation between parameters and subconfigs seems like a cleaner solution.
|
In general, everytime a sub-config is specified, that means that a cartesian product of all of its inner configs is taking with the outer config. This is always the same behavior. The keywords only specify how the sub-configs themselves are chosen.
An example would then look like this: nitrogen:
... [4 configs]
cyclobutadiene:
... [5 configs]
short_training:
... [1 configs]
long_training:
... [3 configs]
model1:
... [2 configs]
load:
- model1
- grid:
- nitrogen
- cyclobutadiene
- random:
samples: 1
options:
- short_training
- long_training With this we have Maybe we don't even want a random block for selecting sub-configs, since this is not really useful here? The point is that you can now combine multiple grids to get their outer product. E.g. nitrogen:
... [4 configs]
cyclobutadiene:
... [5 configs]
short_training:
... [1 configs]
long_training:
... [3 configs]
model1:
... [2 configs]
load:
- model1
- grid:
- nitrogen
- cyclobutadiene
- grid:
- short_training
- long_training would yield |
Thank you for the clarifications. I would vote in favor of disallowing On another note, I would appreciate a clearer definition of what's allowed there. May imported files contain sub configurations? And how would these be treated? Despite these discussions, I like this style of configuration! |
Those are great points! I agree with both. So the new config style would look like this: nitrogen:
... [4 configs]
cyclobutadiene:
... [5 configs]
model1:
... [2 configs]
load:
- model1
- choice:
- nitrogen
- cyclobutadiene
- choice:
- file: ~/test/short_training.yaml
- simple_file: ~/test/long_training.yaml Sub-configs are hierarchical, and can contain further sub-configs. The syntax is just like in the main config, just indented once. In other words: Everything is perfectly hierarchical and self-similar. The same is true for normal imported files, which are treated exactly the same as sub-configs -- except for the special The Imho, this way of specifying imports also seems fine. So the only remaining question would then be conflicting parameters. Thoughts? |
Regarding the import of files may one only import a single sub config from another file? Something like this: ...
load:
- file: ~/test/trainings.yaml:short
... or do we always include all configurations (the ones one would get for Regarding conflicting parameters, on the one hand, I could see it potentially becoming unclear which parameter overwrites which if we have nested imports. But on the other hand, I would like to keep the functionality to overwrite global parameters but that seems inconsequential. |
I don't see any issue with optionally importing sub-configs from another file, if you find that useful. It's a simple extension. load:
- file: ~/test/models.yaml # Import full config
- file: ~/test/trainings.yaml:short # Import sub-config I think I'm in favor of option 2 I've described earlier. That would still allow overriding global parameters, and proper warnings should make this transparent. |
Overview
This RFC proposes to change how we handle sub-configs in order to make them more flexible. Instead of treating a sub-config as a sub-experiment that is just run as is, this proposal is about using them as definitions that can then be flexibly used in the remaining config.
Example
Considerations
We currently assume that always exactly one sub-config is chosen. This proposal allows users to define themselves how they want to combine sub-configs. Specifying them all in a grid would replicate the behavior we had previously, so this is a natural extension.
A sub-config can itself contain fixed/grid/random blocks and further sub-configs, just like they do now. The outer set of configs is then combined with the inner set of configs (outer product), just like now. I.e. loading a single sub-config can result in multiple configs, if the sub-config contains a grid.
Including separate files
This also naturally extends to loading separate config files into one config. The other config file can be treated exactly the same way as a subconfig. The user would only have to provide a keyword, specifying that this is now an external file. I.e.
Possible variant
While defining sub-configs seems pretty clear (that's exactly how we do it currently), specifying their usage still remains an open question. Instead of creating a new top-level block
load
, we could also integrate loading sub-configs into the fixed/grid/random blocks by introducing a specialload
keyword. However, this is much more difficult, considering the restrictions of yaml (every key has to be unique).I prefer the original suggestion. It also seems to align better with user expectations. With this variant, loading a sub-config in the fixed block could lead to multiple different configs, which might be unexpected.
Open questions
There are 2 open questions:
load
for fixed/grid/random? How do we best specify importing files in these 3 cases? -> No random; use keywordsfixed
andchoice
.The text was updated successfully, but these errors were encountered: