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
Add some way to not instantiate the whole config tree but stop when parameters are missing and create a factory (that needs to receive the missing parameters) instead.
Motivation
I have a config tree with many target objects that I instantiate with hydra. However, sometimes it happens that a class has both: parameters that are config params and parameters that are just known at runtime. So it would be nice if hydra would detect when parameters are missing and return a factory instead.
As can be seen above FactoryReceiver only has to know that it can instantiate an object named instance by providing an a. Instance can be arbitrarily complex.
IMHO that allows for nice parametrizable object composition.
The text was updated successfully, but these errors were encountered:
🚀 Feature Request
Add some way to not instantiate the whole config tree but stop when parameters are missing and create a factory (that needs to receive the missing parameters) instead.
Motivation
I have a config tree with many target objects that I instantiate with hydra. However, sometimes it happens that a class has both: parameters that are config params and parameters that are just known at runtime. So it would be nice if hydra would detect when parameters are missing and return a factory instead.
Pitch
I came up with a hacky solution that requires changes to omegaconf (see hobbeshunter/omegaconf@master...hobbeshunter:omegaconf:non-strict-resolve) and hydra (see hobbeshunter/hydra@main...hobbeshunter:hydra:instantiate-factory).
With a little helper class
a config could look like:
A
FactoryReceiver
could e.g. look likeAs can be seen above
FactoryReceiver
only has to know that it can instantiate an object namedinstance
by providing ana
.Instance
can be arbitrarily complex.IMHO that allows for nice parametrizable object composition.
The text was updated successfully, but these errors were encountered: