exp init: fix live metrics path

This commit is contained in:
Saugat Pachhai (सौगात)
2022-11-07 12:45:32 +01:00
committed by David de la Iglesia Castro
parent a48a19ce31
commit 2c3956bdb0
+10 -8
View File
@@ -248,11 +248,6 @@ def init(
except MissingParamsFile:
pass
models = context.get("models")
live_path = context.pop("live", None)
live_metrics = f"{live_path}/metrics.json" if live_path else None
live_plots = os.path.join(live_path, "plots") if live_path else None
if type == "checkpoint":
outs_key = "checkpoints"
metrics_key = "metrics_persist_no_cache"
@@ -262,6 +257,13 @@ def init(
metrics_key = "metrics_no_cache"
plots_key = "plots_no_cache"
models = [context.get("models")]
metrics = [context.get("metrics")]
plots = [context.get("plots")]
if live_path := context.pop("live", None):
metrics.append(os.path.join(live_path, "metrics.json"))
plots.append(os.path.join(live_path, "plots"))
stage = repo.stage.create(
name=name,
cmd=context["cmd"],
@@ -269,9 +271,9 @@ def init(
params=[{params: None}] if params else None,
force=force,
**{
outs_key: compact([models]),
metrics_key: compact([context.get("metrics"), live_metrics]),
plots_key: compact([context.get("plots"), live_plots]),
outs_key: compact(models),
metrics_key: compact(metrics),
plots_key: compact(plots),
},
)