how to change config file by using hydra?

122 Views Asked by At

i was trying to use hydra for to manage my config files. But it wont change anything. for ex: this is my code;

from omegaconf import DictConfig, OmegaConf
import hydra

@hydra.main(version_base=None, config_path=".", config_name="config")
def main(config: DictConfig)->None:
    print(OmegaConf.to_yaml(config))
    print(f"Output directory  : {hydra.core.hydra_config.HydraConfig.get().runtime.output_dir}")


if __name__ == '__main__':
    main()

And i am trying adding or changing my config file. Config file in the same folder.

db: 
  driver: mysql
  user: omry
  password: secret

Command :

python main.py db.user=root

Result

db:
  driver: mysql
  user: root
  password: secret

But if i look config.yaml , i cant see it changed. Still same. How can i fix this?

0

There are 0 best solutions below