Skip to content
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

Enable multiple arguments to config_path #25

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jenuk
Copy link

@jenuk jenuk commented Dec 22, 2022

Motivation

For a project I'm working on currently it is helpful to separate the config into two different parts that can then be combined on the fly without creating a merged config.

E.g. having a few configs for the generative part of a gan and the discriminative part, and then being able to mix and match when starting a run without creating a shared config beforehand.

Changes

To allow this I have modified the ArgumentParser class. The config_path is now a list of configs to load instead of a single file. In the command line it can be called with --config_path path1 path2 ... which is then appended to the previous configs given as a default for the parser. The priorities are then ordered left to right, the first config has the least priority and the last config has the most priority. E.g. put a general config with all keys as the first argument or pass it to the Parser and a specific config to overwrite some values at the end.

As previous by default configs passed via the command line overwrite the configs passed as arguments inside the python code. I've also added the option to disable that behavior and extend the list instead.

All changes should be backwards compatible by default and all tests continue to pass.

I have also added some tests to check that multiple configs can be loaded and that the order is indeed as described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant