Add distinction between two unallowed cases in name check "eval_" (#489)
This commit is contained in:
@@ -324,7 +324,15 @@ def sanity_check_dataset_name(repo_id, policy):
|
|||||||
_, dataset_name = repo_id.split("/")
|
_, dataset_name = repo_id.split("/")
|
||||||
# either repo_id doesnt start with "eval_" and there is no policy
|
# either repo_id doesnt start with "eval_" and there is no policy
|
||||||
# or repo_id starts with "eval_" and there is a 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(
|
raise ValueError(
|
||||||
f"Your dataset name begins by 'eval_' ({dataset_name}) but no policy is provided ({policy})."
|
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 does not begin with 'eval_' ({dataset_name}), but a policy is provided ({policy})."
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user