How to override hydra.run.dir using Python structured config?
#3076
funnym0nk3y
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Prolog: Please don't pay attention to the LLM-styled text. I used it to summarize everything I have done. I proofread for accuracy.
Hi all,
I’m working on a computer vision project using NanoDet, fully configured with Hydra’s structured configs in Python only — no YAML files involved. Our goal is to override the default
hydra.run.dirso that all outputs — including Hydra’s internal.hydra/directory, logs, and application artifacts like saved images andtimings.log— consistently go into a single stable, timestamped output folder relative to our project root.We want the output path to look like:
where
NANODET_PROJECT_ROOTis an environment variable set to our absolute project root (e.g.,/home/michael/masterarbeit-git/code-git/).✅ Setup
@hydra.main()decorator inexternal/models/nanodet/demos/demo/demo.py.@dataclassstructured configs; no YAML or CLI overrides forhydra.run.dir.hydra.run.dirpurely in Python code, not via CLI or YAML.What we tried
Set environment variable:
Exported
before running the script.
Defined
hydra.run.dirin a Python configrun.py:Added
hydra/runto base config defaults:Our demo entry point:
❌ What happens / fails
hydra.run.dirstill defaults tooutputs/<date>/<time>relative to the current working directory from whichdemo.pyis run..hydra/directory (withconfig.yaml,hydra.yaml) is generated inside these default folders, not our desired stable path.save_dir) correctly go to the intended stable path, but this causes a persistent split:Hydra internal outputs → default folder
App outputs → stable folder
cfg.hydra.run.dirsometimes results inKey 'hydra' is not in struct, indicating the Hydra config is not properly overridden or merged into the structured config.❓ What I’m asking
hydra.run.dirvia Python structured config only, respecting Hydra’s internal config system?hydra.run.dirduring config composition, when using@hydra.main()with structured configs?_defaults_?Thanks so much for any help! If needed, I can share minimal repro code or snippets — just ask!
Beta Was this translation helpful? Give feedback.
All reactions