Convert_to_parquet fails for datasets with multiple configs
NONE
Many users have encountered the same issue, which has caused inconvenience.

https://discuss.huggingface.co/t/convert-to-parquet-fails-for-datasets-with-multiple-configs/86733

2024-07-23T15:10:42Z
https://github.com/huggingface/datasets/issues/7067#issuecomment-2245519566
https://api.github.com/repos/huggingface/datasets/issues/7067
IC_kwDODunzps6F1-jO
https://api.github.com/repos/huggingface/datasets/issues/comments/2245519566/reactions
2024-07-23T15:10:42Z
https://api.github.com/repos/huggingface/datasets/issues/comments/2245519566
https://avatars.githubusercontent.com/u/97585031?v=4
https://api.github.com/users/HuangZhen02/events{/privacy}
https://api.github.com/users/HuangZhen02/followers
https://api.github.com/users/HuangZhen02/following{/other_user}
https://api.github.com/users/HuangZhen02/gists{/gist_id}
https://github.com/HuangZhen02
HuangZhen02
U_kgDOBdEHhw
https://api.github.com/users/HuangZhen02/orgs
https://api.github.com/users/HuangZhen02/received_events
https://api.github.com/users/HuangZhen02/repos
https://api.github.com/users/HuangZhen02/starred{/owner}{/repo}
https://api.github.com/users/HuangZhen02/subscriptions
User
https://api.github.com/users/HuangZhen02
public
MEMBER
Thanks for reporting.

I will make the code more robust.
2024-07-25T07:06:58Z
https://github.com/huggingface/datasets/issues/7067#issuecomment-2249609675
https://api.github.com/repos/huggingface/datasets/issues/7067
IC_kwDODunzps6GFlHL
https://api.github.com/repos/huggingface/datasets/issues/comments/2249609675/reactions
2024-07-25T07:06:58Z
https://api.github.com/repos/huggingface/datasets/issues/comments/2249609675
https://avatars.githubusercontent.com/u/8515462?v=4
https://api.github.com/users/albertvillanova/events{/privacy}
https://api.github.com/users/albertvillanova/followers
https://api.github.com/users/albertvillanova/following{/other_user}
https://api.github.com/users/albertvillanova/gists{/gist_id}
https://github.com/albertvillanova
albertvillanova
MDQ6VXNlcjg1MTU0NjI=
https://api.github.com/users/albertvillanova/orgs
https://api.github.com/users/albertvillanova/received_events
https://api.github.com/users/albertvillanova/repos
https://api.github.com/users/albertvillanova/starred{/owner}{/repo}
https://api.github.com/users/albertvillanova/subscriptions
User
https://api.github.com/users/albertvillanova
public
MEMBER
I have opened an issue in the huggingface-hub repo:
- https://github.com/huggingface/huggingface_hub/issues/2419

I am opening a PR to avoid calling `create_branch` if the branch already exists.
2024-07-25T07:38:36Z
https://github.com/huggingface/datasets/issues/7067#issuecomment-2249663136
https://api.github.com/repos/huggingface/datasets/issues/7067
IC_kwDODunzps6GFyKg
https://api.github.com/repos/huggingface/datasets/issues/comments/2249663136/reactions
2024-07-25T07:38:36Z
https://api.github.com/repos/huggingface/datasets/issues/comments/2249663136
https://avatars.githubusercontent.com/u/8515462?v=4
https://api.github.com/users/albertvillanova/events{/privacy}
https://api.github.com/users/albertvillanova/followers
https://api.github.com/users/albertvillanova/following{/other_user}
https://api.github.com/users/albertvillanova/gists{/gist_id}
https://github.com/albertvillanova
albertvillanova
MDQ6VXNlcjg1MTU0NjI=
https://api.github.com/users/albertvillanova/orgs
https://api.github.com/users/albertvillanova/received_events
https://api.github.com/users/albertvillanova/repos
https://api.github.com/users/albertvillanova/starred{/owner}{/repo}
https://api.github.com/users/albertvillanova/subscriptions
User
https://api.github.com/users/albertvillanova
public
If the dataset has multiple configs, when using the `datasets-cli convert_to_parquet` command to avoid issues with the data viewer caused by loading scripts, the conversion process only successfully converts the data corresponding to the first config. When it starts converting the second config, it throws an error:

```
Traceback (most recent call last):
  File "/opt/anaconda3/envs/dl/bin/datasets-cli", line 8, in <module>
    sys.exit(main())
  File "/opt/anaconda3/envs/dl/lib/python3.10/site-packages/datasets/commands/datasets_cli.py", line 41, in main
    service.run()
  File "/opt/anaconda3/envs/dl/lib/python3.10/site-packages/datasets/commands/convert_to_parquet.py", line 83, in run
    dataset.push_to_hub(
  File "/opt/anaconda3/envs/dl/lib/python3.10/site-packages/datasets/dataset_dict.py", line 1713, in push_to_hub
    api.create_branch(repo_id, branch=revision, token=token, repo_type="dataset", exist_ok=True)
  File "/opt/anaconda3/envs/dl/lib/python3.10/site-packages/huggingface_hub/utils/_validators.py", line 114, in _inner_fn
    return fn(*args, **kwargs)
  File "/opt/anaconda3/envs/dl/lib/python3.10/site-packages/huggingface_hub/hf_api.py", line 5503, in create_branch
    hf_raise_for_status(response)
  File "/opt/anaconda3/envs/dl/lib/python3.10/site-packages/huggingface_hub/utils/_errors.py", line 358, in hf_raise_for_status
    raise BadRequestError(message, response=response) from e
huggingface_hub.utils._errors.BadRequestError:  (Request ID: Root=1-669fc665-7c2e80d75f4337496ee95402;731fcdc7-0950-4eec-99cf-ce047b8d003f)

Bad request:
Invalid reference for a branch: refs/pr/1
```