-
-
Notifications
You must be signed in to change notification settings - Fork 634
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
[Feature Request] support use case of composing the same config node in multiple places in the config tree #235
Comments
The current model in Hydra does not support this kind of thing well.
I will keep this open as a reminder to improve support for this use case. |
In the other thread you say "You can interpolate a node, not just a value" which is what I would like (if I understand what you mean). Can you give an example of how to do that ? Because in the code above, |
optimizer is not the string adam, it's the node for adam optimizer that is in optimizer/adam.yaml. |
I am actually not 100% sure how this would work if you start overriding things, but give it a try and let me know. |
I just tried : it overrides the main |
I don't see any usecases for interpolating the node if it's not copied, right ? if so maybe it would be worth copying instead ? |
One use case is to make the values of the node accessible in multiple places, much like the use case value interpolation. Something that can be implemented here is a copy function, but this may be harder than it seems:
I will keep this open to try this later. maybe copy_node? |
This should probably be implemented in OmegaConf. there is a good chance that it's not easily possible to do externally at the moment. |
until this is implemented, a workaround can be implemented as a symlink at the file system level: |
another idea I had which might be easier to implement is to use the defaults to do this by adding a few optional fields (source, dest, and group). for example:
To make it possible to override from the command line, maybe add another optional field for the group name:
This is not as elegant as previous suggestions but it gives quiet a bit of flexibility. |
Another idea to play with:
or in defaults: defaults:
- db@src_db: mysql
- db@dst_db: mysql I kind of like this one. |
I am in a similar situation composing my configurations. My use-case include predefined configuration of an experiment based on the suggestion from #386 (comment) I do not know how to redefine the group
defaults:
model: UNetPix
model:
class: models.UNet.UNetPix
params:
kwarg1: ...
kwarg2: ...
model:
class: models.UNet.UNetTC
params:
kwarg1: ...
kwarg2: ... I would like to add configuration of an experiment deploying the UNetTC instead of UNetPix in such a way I can just call
model: UNetTC # Here I would like to change UNetPix by UNetTC group defined in model/UNetTC.yaml
... # other experiment related configurations Is this currently possible? |
Your question does not seem related, please ask it in the chat or open a new issue. |
I would say it is a particular case related to the "composing the same config node in multiple places". I have opened a new issue #582 (comment) |
🚀 Feature Request
Be able to copy all the elements of one config in an other.
Motivation
In my code I have 2 modules which are trained, meaning that I have 2 optimizers. I would like to modify the parameters of one optimizer, but don't want to copy have all default optimizer values written twice. I.e would like to do that
python main.py module1.optimizer=adam module1.optimizer.lr=0.01 module2.optimizer.lr=0.01
but not have to define aoptimize
twice. Something like that:which would use the adam optimizer as default for module 1 and 2 without having to dupicate it.
The text was updated successfully, but these errors were encountered: