Use structured configs to override Hydra config #781
-
BackgroundHydra launchers only get activated in multirun mode. I want to submit to a remote instance (SageMaker, Ray, k8s, etc) while avoiding the need to remember to specify ExampleAttempt to make a new from hydra.conf import HydraConf
from hydra.types import RunMode
from hydra_zen import store, zen
@store(name="config")
def add(x: int = 1, y: int = 1) -> None:
print(x + y)
if __name__ == '__main__':
store(
HydraConf(mode=RunMode.MULTIRUN), # Inherit all the other default Hydra settings
group="hydra",
name="multirun",
package="_global_", # Needed to avoid conflict with default hydra node in defaults list
)
store.add_to_hydra_store()
zen(add).hydra_main(config_path=None, config_name="config", version_base="1.1") Actual Behavior
Expected Behavior
NotesI realize @store(
name="config",
hydra_defaults=[
"_self_",
{"override hydra": "multirun"},
],
) Then There are other use cases for |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hrmm.. I think being able to swap out the full hydra config from the CLI is tricky here. Afaict Hydra looks specifically for the store entry: I have been finding a lot of success for my own use cases with scaffolding above the Hydra CLI. Specifically I overwrite |
Beta Was this translation helpful? Give feedback.
Hrmm.. I think being able to swap out the full hydra config from the CLI is tricky here. Afaict Hydra looks specifically for the store entry:
group=hydra, name=config
, which is how the simple customize hydra config how-to works.I have been finding a lot of success for my own use cases with scaffolding above the Hydra CLI. Specifically I overwrite
zen.hydra_main
and transform thesys.argv
list before it gets sent to the underlyinghydra_main
call. I also do things like "if you specify a launcher, I will automatically add--multirun
for you", and it is just so much easier to work with this logic than wrestle with complexities like the above. For this reason, I also don't have much insight …