You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to reuse a single instantiated object in multiple locations in a config.
Motivation
Is your feature request related to a problem? Please describe.
Here is an example in machine learning: I would like model.encoder1 == model.encoder2 so that they can share weights. However, the below config would result in 2 different instances (with different weights).
It seems that with just the default variable interpolation, the config is interpolated before instantiation, resulting in 2 different instances.
Describe alternatives you've considered
Rewriting MyModel: that works in this simple case, but there are complex/more nested cases in which I want to share modules. Rewriting it all would defeat the modularity that is the benefit of using Hydra. Sometimes I will try both cases: shared weights and non-shared weights.
Are you willing to open a pull request? (See CONTRIBUTING)
Maybe, but I'm unfamiliar with the codebase and Hydra internals, so I wouldn't trust myself unless it's an easy fix.
The text was updated successfully, but these errors were encountered:
🚀 Feature Request
I would like to reuse a single instantiated object in multiple locations in a config.
Motivation
Is your feature request related to a problem? Please describe.
Here is an example in machine learning: I would like
model.encoder1 == model.encoder2
so that they can share weights. However, the below config would result in 2 different instances (with different weights).More generally, there are times when I want to configure a deeply nested object where certain nodes in the tree are shared.
Pitch
Describe the solution you'd like
Maybe something along the lines of:
It seems that with just the default variable interpolation, the config is interpolated before instantiation, resulting in 2 different instances.
Describe alternatives you've considered
MyModel
: that works in this simple case, but there are complex/more nested cases in which I want to share modules. Rewriting it all would defeat the modularity that is the benefit of using Hydra. Sometimes I will try both cases: shared weights and non-shared weights.Are you willing to open a pull request? (See CONTRIBUTING)
Maybe, but I'm unfamiliar with the codebase and Hydra internals, so I wouldn't trust myself unless it's an easy fix.
The text was updated successfully, but these errors were encountered: