From 9a7fbff743b7919663910ade32d9bf6dfe7d5b46 Mon Sep 17 00:00:00 2001 From: pikaliov Date: Fri, 24 Apr 2026 22:24:30 +0300 Subject: [PATCH] Fix plot_combined: fallback from 'total' to 'train_loss' Commit e0db8d2 renamed the `total` column in train.csv to `train_loss`. `plot_per_epoch` already handled this via a fallback, but `plot_combined` was still hard-coded to `y="total"` and crashed during training: ValueError: Could not interpret value `total` for `y`. Mirror the same fallback there and guard against the column being absent entirely (first-epoch edge case before any loss is logged). Co-Authored-By: Claude Opus 4.7 (1M context) --- src/training/plot_metrics.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/training/plot_metrics.py b/src/training/plot_metrics.py index c8db1aa..10fdbc4 100644 --- a/src/training/plot_metrics.py +++ b/src/training/plot_metrics.py @@ -162,7 +162,9 @@ def plot_combined(train_df: pd.DataFrame, val_df: pd.DataFrame, out_dir: Path) - # 1. Train + Val loss. ax = axes[0] - sns.lineplot(data=train_df, x="epoch", y="total", ax=ax, marker="o", linewidth=2, color="crimson", label="train") + train_loss_col = "train_loss" if "train_loss" in train_df.columns else "total" + if train_loss_col in train_df.columns: + sns.lineplot(data=train_df, x="epoch", y=train_loss_col, ax=ax, marker="o", linewidth=2, color="crimson", label="train") if "loss" in val_df.columns: sns.lineplot(data=val_df, x="epoch", y="loss", ax=ax, marker="s", linewidth=2, color="royalblue", label="val") ax.set_title("Loss (train vs val)")