-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix issue 372: resulting tuning config file now preserve comments #373
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,7 +36,11 @@ requires-python = ">3.7.1,<4.0" | |
|
||
dependencies = [ | ||
"edsnlp[ml]>=0.15.0", | ||
"sentencepiece>=0.1.96" | ||
"sentencepiece>=0.1.96", | ||
"optuna>=4.0.0", | ||
"plotly>=5.18.0", | ||
"ruamel.yaml<0.18.0", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be best to avoid adding new dependencies. If I'm not mistaken, using edsnlp.tune now requires:
|
||
"configobj", | ||
] | ||
|
||
[project.optional-dependencies] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[train] | ||
param1 = 1 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,7 +125,10 @@ def test_compute_importances(study): | |
|
||
|
||
@pytest.mark.parametrize("viz", [True, False]) | ||
def test_process_results(study, tmpdir, viz): | ||
@pytest.mark.parametrize( | ||
"config_path", ["tests/tuning/config.yml", "tests/tuning/config.cfg"] | ||
) | ||
def test_process_results(study, tmpdir, viz, config_path): | ||
output_dir = tmpdir.mkdir("output") | ||
config = { | ||
"train": { | ||
|
@@ -144,9 +147,8 @@ def test_process_results(study, tmpdir, viz): | |
"step": 2, | ||
}, | ||
} | ||
|
||
best_params, importances = process_results( | ||
study, output_dir, viz, config, hyperparameters | ||
study, output_dir, viz, config, config_path, hyperparameters | ||
) | ||
|
||
assert isinstance(best_params, dict) | ||
|
@@ -163,7 +165,10 @@ def test_process_results(study, tmpdir, viz): | |
assert "Params" in content | ||
assert "Importances" in content | ||
|
||
config_file = os.path.join(output_dir, "config.yml") | ||
if config_path.endswith("yml") or config_path.endswith("yaml"): | ||
config_file = os.path.join(output_dir, "config.yml") | ||
else: | ||
config_file = os.path.join(output_dir, "config.cfg") | ||
Comment on lines
+168
to
+171
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we check the content of the produced config file ? As written here, the test would pass without the comment preservation, which is what you wanted to ensure in the first place :) |
||
assert os.path.exists(config_file), f"Expected file {config_file} not found" | ||
|
||
if viz: | ||
|
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.
Why the cap ?