Skip to content

Commit

Permalink
optuna: Use summary instead of log_metric. (#514)
Browse files Browse the repository at this point in the history
Prevent creation of single-row `.tsv` files.

Each trial creates a single DVC experiment and logs metrics a single time.
  • Loading branch information
daavoo authored Apr 3, 2023
1 parent 634f911 commit c9fe84d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/dvclive/optuna.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ def _log_metrics(self, values, live):

metrics = {name: val for name, val in zip(names, values)}
for k, v in metrics.items():
live.log_metric(k, v)
live.summary[k] = v
2 changes: 2 additions & 0 deletions tests/test_frameworks/test_optuna.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ def test_optuna_(tmp_dir, mocked_dvc_repo):
assert metric_name in metrics
params = load_yaml("dvclive-optuna/params.yaml")
assert "x" in params

assert not (tmp_dir / "dvclive-optuna" / "plots").exists()

0 comments on commit c9fe84d

Please sign in to comment.