mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-24 18:26:11 +00:00
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:
@@ -43,6 +43,8 @@ class DatasetConfig:
|
|||||||
eval_split: float = 0.0
|
eval_split: float = 0.0
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
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 self.episodes is not None:
|
||||||
if any(ep < 0 for ep in self.episodes):
|
if any(ep < 0 for ep in self.episodes):
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|||||||
@@ -213,6 +213,9 @@ class TrainPipelineConfig(HubMixin):
|
|||||||
self.optimizer = active_cfg.get_optimizer_preset()
|
self.optimizer = active_cfg.get_optimizer_preset()
|
||||||
self.scheduler = active_cfg.get_scheduler_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:
|
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.")
|
raise ValueError("'repo_id' argument missing. Please specify it to push the model to the hub.")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user