We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
hydra_defaults
builds
Hydra supports specifying defaults on targeted configs:
defaults
from dataclasses import dataclass, field from typing import Any from hydra_zen import launch import hydra from hydra.core.config_store import ConfigStore class MyClass: def __init__(self, **kwargs): self.kwargs = kwargs Default = builds(int) cs = ConfigStore.instance() cs.store(group="x", name="a", node=Default) @dataclass class Conf: _target_: str = "__main__.MyClass" defaults: Any = field(default_factory=lambda: ["_self_", {"x": "a"}]) x: Any = None cs.store(name="my_app", node=Conf) @hydra.main(config_path=None, config_name="my_app") def task_function(cfg): print(instantiate(cfg).kwargs)
Launching the task function sets the default and does not pass defaults to MyClass(...)
MyClass(...)
>>> launch(Conf, task_function); {'x': 0}
Presently, builds can accommodate this via meta-field:
builds(MyClass, x=None, zen_meta=dict(defaults=["_self_", {"x": "a"}]))
But it might be nice to expose this as an explicit argument, hydra_defaults:
builds(MyClass, x=None, hydra_defaults=["_self_", {"x": "a"}])
The "pros" of adding hydra_defaults are:
hydra_convert
The "cons" are:
The text was updated successfully, but these errors were encountered:
make_config
Successfully merging a pull request may close this issue.
Hydra supports specifying
defaults
on targeted configs:Launching the task function sets the default and does not pass
defaults
toMyClass(...)
Presently,
builds
can accommodate this via meta-field:But it might be nice to expose this as an explicit argument,
hydra_defaults
:The "pros" of adding
hydra_defaults
are:hydra_convert
and other hydra features.The "cons" are:
defaults
on a targeted configThe text was updated successfully, but these errors were encountered: