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) <noreply@anthropic.com>
This commit is contained in:
@@ -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)")
|
||||
|
||||
Reference in New Issue
Block a user