diff --git a/lerobot/common/robot_devices/control_utils.py b/lerobot/common/robot_devices/control_utils.py index a23cf867a..4b074b4f2 100644 --- a/lerobot/common/robot_devices/control_utils.py +++ b/lerobot/common/robot_devices/control_utils.py @@ -348,7 +348,15 @@ def sanity_check_dataset_name(repo_id, policy): _, dataset_name = repo_id.split("/") # either repo_id doesnt start with "eval_" and there is no policy # or repo_id starts with "eval_" and there is a policy - if dataset_name.startswith("eval_") == (policy is None): + + # Check if dataset_name starts with "eval_" but policy is missing + if dataset_name.startswith("eval_") and policy is None: + raise ValueError( + f"Your dataset name begins with 'eval_' ({dataset_name}), but no policy is provided." + ) + + # Check if dataset_name does not start with "eval_" but policy is provided + if not dataset_name.startswith("eval_") and policy is not None: raise ValueError( - f"Your dataset name begins by 'eval_' ({dataset_name}) but no policy is provided ({policy})." + f"Your dataset name does not begin with 'eval_' ({dataset_name}), but a policy is provided ({policy})." )