Skip to content

Commit

Permalink
Make CLI convert_to_parquet not raise error if no rights to create sc…
Browse files Browse the repository at this point in the history
…ript branch (#6902)

Do not raise exception if no rights to create script branch
  • Loading branch information
albertvillanova committed Jun 3, 2024
1 parent bb2664c commit 18db6cb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/datasets/commands/convert_to_parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing import Optional

from huggingface_hub import HfApi, create_branch, get_repo_discussions
from huggingface_hub.utils import HfHubHTTPError

from datasets import get_dataset_config_names, get_dataset_default_config_name, load_dataset
from datasets.commands import BaseDatasetsCLICommand
Expand Down Expand Up @@ -89,7 +90,10 @@ def run(self) -> None:
time.sleep(5)
delete_files(dataset_id, revision=pr_revision, token=token)
if not revision:
create_branch(dataset_id, branch="script", repo_type="dataset", token=token, exist_ok=True)
try:
create_branch(dataset_id, branch="script", repo_type="dataset", token=token, exist_ok=True)
except HfHubHTTPError:
pass
print(f"You can find your PR to convert the dataset to Parquet at: {pr_url}")


Expand Down

0 comments on commit 18db6cb

Please sign in to comment.