Reputation: 180
I'm using hydra to log hyperparameters of experiments.
@hydra.main(config_name="config", config_path="../conf")
def evaluate_experiment(cfg: DictConfig) -> None:
print(OmegaConf.to_yaml(cfg))
...
Sometimes I want to do a dry run to check something. For this I don't need any saved parameters, so I'm wondering how I can disable the savings to the filesystem completely in this case?
Upvotes: 5
Views: 10196
Reputation: 33646
There is an enhancement request aimed at Hydra 1.1 to support disabling working directory management. Working directory management is doing many things:
There are other related features:
Different features has different ways to disable them:
hydra.run.dir
to .
.hydra.output_subdir
to null.hydra/hydra_logging
and hydra/job_logging
, see this.A complete example might look like:
$ python foo.py hydra.run.dir=. hydra.output_subdir=null hydra/job_logging=disabled hydra/hydra_logging=disabled
Note that as always you can also override those config values through your config file.
Upvotes: 11
Reputation: 191
The answer from Omry Yadan works well if you want to solve this using the CLI. However, you can also add these flags to your config file such that you don't have to type them every time you run your script. If you want to go this route, make sure you add the following items in your root config file:
defaults:
- _self_
- override hydra/hydra_logging: disabled
- override hydra/job_logging: disabled
hydra:
output_subdir: null
run:
dir: .
Upvotes: 19