question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dir interpolation from hydra into job config is not working

See original GitHub issue

I can set the second_dir from base_dir, but output_subdir can not in this case.

experiment:
  base_dir: ???
  second_dir: ${experiment.base_dir}
hydra:
  output_subdir: ${experiment.base_dir}/.hydra

KeyError: "str interpolation key 'experiment.base_dir' not found"

Is there any way I can change the hydra config based on current .yaml or some alternately way?
Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
eric-mitchellcommented, Sep 1, 2021

For posterity: I needed ${hydra:runtime.cwd} rather than ${hydra.runtime.cwd} in order to get interpolation to work.

1reaction
omrycommented, Sep 2, 2021

By the way, the next version of Hydra will also have a variable: hydra.runtime.cwd which will hold the current working directory you launched your app from, so you will presumable be able to do something crazy like:

hydra.run.dir: ${hydra:runtime.cwd}

Although I did not test it. If you want to try install Hydra from master.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Interpolation in Hydra's defaults list cause and error
1 Answer 1 ... It is not possible to reference a key in the main config using interpolation from the defaults list. From...
Read more >
Job Configuration - Hydra
The job configuration resides in hydra.job. ... Decides whether Hydra changes the current working directory to the output directory for each job.
Read more >
Hydra for tracking machine learning experiments
Variable interpolation is supported but a little bit weird because it supports both internal variables (which we just saw) and system ...
Read more >
Installation — OmegaConf 2.0.6 documentation - Read the Docs
OmegaConf support variable interpolation, Interpolations are evaluated lazily on access. Config node interpolation¶. The interpolated variable can be the dot- ...
Read more >
Complete tutorial on how to use Hydra in Machine Learning ...
We can check the directory structure again, after running python main.py . src ├── config │ └── config.yaml ├── main.py ├── outputs
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found