-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overwriting subconfig retains values from default subconfig #374
Comments
Config merging is the expected behavior and not a bug. Config files are one of the input types applied in the override-order. Only the settings that are present in a config are updated. It would be very confusing for users if what is not in the config gets changed. Currently there is no way to discard values not given in the config. Also, I am not sure it is a good idea. If a value is discarded, then what value would it have? My advice is, be aware of the override order and that only what is given gets modified. If you want to modify all the values, then provide all the values. Better to be explicit than needing to remember some implicit behavior. |
The same feature is requested in #460. This issue is older, but since there is more discussion in that one, I will be closing this one. |
🐛 Bug report
I have a master config that is formed from multiple other sub-configs stored in separate files (one for data, one for architecture etc.). When I specify from the CLI a different version of a sub-config my expectation is that the sub-config gets completely overwritten. Instead, what I got is a merged sub-config between the default and the one provided through the CLI. I believe this is a bug. Otherwise let me know if this intended, and if maybe there is a setting through which we can control the behaviour to overwrite
To reproduce
test.py
main_config.yaml
data_default.yaml
data_new.yaml
python test.py --config main_config.yaml --data data_new.yaml
Expected behavior
I should get an error that says attribute_2 is required but has not been provided.
Instead, i get
Test(data=Data(attribute_1=2, attribute_2=10))
Environment
pip install jsonargparse[signatures,typing-extensions]==4.23.1
The text was updated successfully, but these errors were encountered: