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
ENH support passing options through config files #325
Conversation
Codecov Report
@@ Coverage Diff @@
## main #325 +/- ##
==========================================
- Coverage 55.58% 55.52% -0.06%
==========================================
Files 42 42
Lines 2416 2433 +17
Branches 446 451 +5
==========================================
+ Hits 1343 1351 +8
- Misses 984 991 +7
- Partials 89 91 +2 |
Great idea! But isn't this syntax more kosher: objectives:
lasso:
fit_intercept: true
reg: 0.5
datasets:
- simulated
- leukemia
solvers:
- celer
- cd
repetitions: 1 or even: objectives:
- model: lasso
fit_intercept: true
reg: 0.5
- model: slope
fit_intercept: true
datasets:
- simulated
- leukemia
solvers:
- celer
- cd
repetitions: 1
Shouldnt CLI options take precedence? Or are you talking about defaults? |
The first syntax is a great idea and related to #193, it could be addressed when we progress on the latter. |
I pushed a solution for the names differing in config file (where we want to use the name of the click options, e.g. To avoid hardcoding the dict, we could rely on click automapping from option to variable name (strip '--', replace '-' by '_') and do the reverse mapping automatically in |
|
I agree with both points. More generally, is there a good reason to have different names for CLI arguments and the function parameters ? Support for pdb, env_name, etc. would be nice but is not necessary. |
I'd like to add an example of config.yml file in the doc, on which page does it belong in your opinion? On the CLI page it doesn't look easy to place it properly (right after the run command?) |
Right after the run command sounds fine to me. |
I agree with Johan, I think after the run command is a good idea |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks very neat! thanks @mathurinm
Could you add at least one test in test_cli.py
? I think mimicking the TestRunCmd::test_benchopt_run
passing only config should be enough.
benchopt/tests/test_benchmarks/dummy_benchmark/datasets/simulated.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
there is just a small leftover --file
in the test.
benchopt/tests/test_benchmarks/dummy_benchmark/datasets/simulated.py
Thanks @mathurinm !!! :) |
proof of concept to start discussion.
Example of config file:
ex.yml
used with:
benchopt run . --file ex.yml
These config files can be committed on repos for examples, shared across collaborators, are easier to maintain/modify/keep track of when the command to launch the benchmark is long
Questions: