mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
@@ -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):
|
||||
|
||||
@@ -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}},
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user