Skip to content

Commit 634f911

Browse files
authored
make_dvcyaml: Include metrics section also if live.summary. (#512)
1 parent 8730da0 commit 634f911

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/dvclive/dvc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def make_dvcyaml(live):
8989
dvcyaml = {}
9090
if live._params:
9191
dvcyaml["params"] = [os.path.relpath(live.params_file, live.dir)]
92-
if live._metrics:
92+
if live._metrics or live.summary:
9393
dvcyaml["metrics"] = [os.path.relpath(live.metrics_file, live.dir)]
9494
plots = []
9595
plots_path = Path(live.plots_dir)

tests/test_dvc.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ def test_make_dvcyaml_metrics(tmp_dir):
4949
}
5050

5151

52+
def test_make_dvcyaml_summary(tmp_dir):
53+
live = Live()
54+
live.summary["bar"] = 2
55+
make_dvcyaml(live)
56+
57+
assert load_yaml(live.dvc_file) == {
58+
"metrics": ["metrics.json"],
59+
}
60+
61+
5262
def test_make_dvcyaml_all_plots(tmp_dir):
5363
live = Live()
5464
live.log_param("foo", 1)

0 commit comments

Comments
 (0)