pythonfb-hydra

What is the correct way of accessing Hydra's current output directory?


Assuming I prevent Hydra from changing the current working directory, how can I still retrieve the job's output directory (i.e., the folder Hydra created for storing the results of the particular job) from main()?

Ideally, I'd like a method that works regardless of whether it's a regular run or a multi-run. I know I can access the configuration through hydra.core.hydra_config.HydraConfig.get(), but it's unclear whether any of the settings there always map to the output folder. The relevant tutorial page discusses how to set the output folder but not how to retrieve it in the case we didn't change the cwd.


Solution

  • Found it.

    hydra_cfg = hydra.core.hydra_config.HydraConfig.get()
    hydra_cfg['runtime']['output_dir']