Alexey Gudchenko
Alexey Gudchenko

Reputation: 13

What is the path of the `overrides.yaml` visible from Python code with Hydra

Example of the code:

@hydra.main(config_path="./configs", config_name='example_01.yaml')
def main(hparams):
   # ...
   # What is the actual path of the `overrides.yaml`  file ???
   fn = ''
   tracker.log_artifact(fn)

I tried

def main(hparams):
    # ...
    p = Path(os.getcwd())
    print(p, p.exists())
    print([fn for fn in p.glob('**/*')])

    p = Path.cwd() / '.hydra/overrides.yaml'
    print(p.exists())

Output:

./outputs/2020-07-29/19-35-52 True
[ ]
False

But after the script is complete, I see that the files exist in the directory ./outputs/[date]/[time]/.hydra:

config.yaml
hydra.yaml
overrides.yaml

Versions:
python: 3.6.9
hydra-core: 1.0.0rc1

Upvotes: 1

Views: 407

Answers (1)

Omry Yadan
Omry Yadan

Reputation: 33646

This is one of the bugfixes in 1.0.0rc2.

You should upgrade.

You can also access this information directly via the Hydra config:

@hydra.main(config_name="config")
def my_app(_cfg: DictConfig) -> None:
    print(HydraConfig.get().overrides.task)

Upvotes: 1

Related Questions