exp init: Replace live section with metrics and plots.

Closes #7534
This commit is contained in:
David de la Iglesia Castro
2022-04-21 08:55:49 +02:00
parent 444bf27e6f
commit 5c561572b0
2 changed files with 37 additions and 19 deletions
+7 -5
View File
@@ -239,18 +239,20 @@ def init(
except MissingParamsFile:
pass
checkpoint_out = bool(context.get("live"))
models = context.get("models")
live_path = context.pop("live", None)
live_metrics = f"{live_path}.json" if live_path else None
live_plots = os.path.join(live_path, "scalars") if live_path else None
stage = repo.stage.create(
name=name,
cmd=context["cmd"],
deps=compact([context.get("code"), context.get("data")]),
params=[{params: None}] if params else None,
metrics_no_cache=compact([context.get("metrics")]),
plots_no_cache=compact([context.get("plots")]),
live=context.get("live"),
metrics_no_cache=compact([context.get("metrics"), live_metrics]),
plots_no_cache=compact([context.get("plots"), live_plots]),
force=force,
**{"checkpoints" if checkpoint_out else "outs": compact([models])},
**{"checkpoints" if with_live else "outs": compact([models])},
)
with _disable_logging(), repo.scm_context(autostage=True, quiet=True):
+30 -14
View File
@@ -136,13 +136,16 @@ def test_init_interactive_when_no_path_prompts_need_to_be_asked(
"train": {
"cmd": "cmd",
"deps": ["data", "src"],
"live": {"dvclive": {"html": True, "summary": True}},
"metrics": [{"metrics.json": {"cache": False}}],
# we specify `live` through `overrides`,
# so it creates checkpoint-based output.
"outs": [{"models": {"checkpoint": True}}],
"metrics": [
{"dvclive.json": {"cache": False}},
{"metrics.json": {"cache": False}},
],
"outs": ["models"],
"params": [{"params.yaml": None}],
"plots": [{"plots": {"cache": False}}],
"plots": [
{os.path.join("dvclive", "scalars"): {"cache": False}},
{"plots": {"cache": False}},
],
}
}
}
@@ -357,9 +360,12 @@ def test_init_interactive_live(
"train": {
"cmd": "python script.py",
"deps": ["data", "script.py"],
"live": {"dvclive": {"html": True, "summary": True}},
"metrics": [{"dvclive.json": {"cache": False}}],
"outs": [{"models": {"checkpoint": True}}],
"params": [{"params.yaml": None}],
"plots": [
{os.path.join("dvclive", "scalars"): {"cache": False}}
],
}
}
}
@@ -404,11 +410,16 @@ def test_init_with_type_live_and_models_plots_provided(
"train": {
"cmd": "cmd",
"deps": ["data", "src"],
"live": {"dvclive": {"html": True, "summary": True}},
"metrics": [{"m": {"cache": False}}],
"metrics": [
{"dvclive.json": {"cache": False}},
{"m": {"cache": False}},
],
"outs": [{"models": {"checkpoint": True}}],
"params": [{"params.yaml": None}],
"plots": [{"p": {"cache": False}}],
"plots": [
{os.path.join("dvclive", "scalars"): {"cache": False}},
{"p": {"cache": False}},
],
}
}
}
@@ -439,11 +450,16 @@ def test_init_with_type_default_and_live_provided(
"train": {
"cmd": "cmd",
"deps": ["data", "src"],
"live": {"live": {"html": True, "summary": True}},
"metrics": [{"metrics.json": {"cache": False}}],
"outs": [{"models": {"checkpoint": True}}],
"metrics": [
{"live.json": {"cache": False}},
{"metrics.json": {"cache": False}},
],
"outs": ["models"],
"params": [{"params.yaml": None}],
"plots": [{"plots": {"cache": False}}],
"plots": [
{os.path.join("live", "scalars"): {"cache": False}},
{"plots": {"cache": False}},
],
}
}
}