fix(validation): add eval_split range check and eval_steps warning

Validate eval_split is in [0.0, 1.0) to prevent garbage splits from
out-of-range values. Raise when eval_steps > 0 but eval_split is 0.0
since no offline eval will run.
This commit is contained in:
Khalil Meftah
2026-06-22 22:25:08 +02:00
parent 2e53ccf872
commit 84961c5591
2 changed files with 5 additions and 0 deletions
+2
View File
@@ -43,6 +43,8 @@ class DatasetConfig:
eval_split: float = 0.0
def __post_init__(self) -> None:
if not (0.0 <= self.eval_split < 1.0):
raise ValueError(f"eval_split must be in [0.0, 1.0), got {self.eval_split}")
if self.episodes is not None:
if any(ep < 0 for ep in self.episodes):
raise ValueError(
+3
View File
@@ -213,6 +213,9 @@ class TrainPipelineConfig(HubMixin):
self.optimizer = active_cfg.get_optimizer_preset()
self.scheduler = active_cfg.get_scheduler_preset()
if self.eval_steps > 0 and self.dataset.eval_split == 0.0:
raise ValueError("eval_steps > 0 requires dataset.eval_split > 0.0 to hold out eval data.")
if hasattr(active_cfg, "push_to_hub") and active_cfg.push_to_hub and not active_cfg.repo_id:
raise ValueError("'repo_id' argument missing. Please specify it to push the model to the hub.")