[Feature Request] Override loaded config file through a command line flag
See original GitHub issue🚀 Feature Request
I want to pass yaml file instead of parameters like foo.bar=1 ...
to override default configuration:
$ python app.py --yaml foo.yaml
Issue Analytics
- State:
- Created 4 years ago
- Reactions:40
- Comments:22 (10 by maintainers)
Top Results From Across the Web
Feature Toggles (aka Feature Flags) - Martin Fowler
With a Toggle Configuration file you can now re-configure a feature flag by simply changing that file rather than re-building application code itself....
Read more >Set Kubelet parameters via a config file - Kubernetes
Start the Kubelet with the --config flag set to the path of the Kubelet's config file. The Kubelet will then load its config...
Read more >Loading Configuration Files | Junos OS - Juniper Networks
An override operation discards the current candidate configuration and loads the configuration in filename or the configuration that you type at the terminal....
Read more >Command line options - Envoy Proxy
The following are the command line options that Envoy supports. ... If --config-path is also set, the values in this YAML string will...
Read more >Load config from file & environment variables in Golang with ...
It can also read values from environment variables or command-line flags. It gives us the ability to set or override default values.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi there,
I just wanted to +1 for this feature request. My use case is as follows. I have a complex configuration file with lots of details the user will not need to interact with, e.g. optimizers. There are elements, particularly regarding the data and augmentations, that all users will have to customize.
Default
conf/config.yaml
:user_config.yaml
:What I want is to be able to use the following syntax and have Hydra load the default configuration file first, and optionally override with the user’s supplied config file:
python train.py --config user_config.yaml
Ideally, the user could also supply command line arguments which would take precedence over all. I’m not sure if this is too unique to my use case. I want the priority to be
command line args
>user defaults from user_config.yaml
>conf/config.yaml
.Is there a way to do this currently with hydra?
I’m currently using a workaround for a similar case.
Default conf/config.yaml:
Then, in the
train.py
you can override hydra config object withOmegaConf.merge
function whenuser_config
is given.Now, you can use
python train.py user_config=user_config.yaml