huggingface / huggingface/datasets
load_dataset on a dataset name with no namespace raises HfUriError
- Dominant language
- Python
- Stars
- 22k
- Forks
- 3.4k
- Avg merge
- 5d 7h
- Merged PRs (30d)
- 17
Description
`load_dataset` on a dataset name with no namespace fails at HEAD and on 5.0.1:
```python
>>> from datasets import load_dataset
>>> load_dataset("imdb", split="train[:5]")
...
File "src/datasets/load.py", line 609, in get_module
standalone_yaml_path = cached_path(
File "src/datasets/utils/file_utils.py", line 180, in cached_path
).resolve_path(url_or_filename)
huggingface_hub.errors.HfUriError: Invalid HF URI 'hf://datasets/imdb@e6281661ce1c48d982bc483cf8a173c1bbeb5d31/.huggingface.yaml'. Repository id must be 'namespace/name', got 'imdb'.
```
Same for `squad`, `glue`, `rotten_tomatoes`, `ag_news`, `cnn_dailymail`, `mnist` and `wikitext`.
The Hub still redirects these names, and the earlier part of the load path uses them happily: `api.hf_hub_download(repo_id="imdb", ...)` returns the README and a real commit sha. `HubDatasetModuleFactory.get_module` then builds an `hf://` URI out of the same raw string, and `parse_hf_uri` requires `namespace/name`.
Environment: datasets 5.0.2.dev0 at d336dcb8 and released 5.0.1, huggingface_hub 1.31.0, python 3.11.
Contributor guide
Research direction
Reproduce the failure with load_dataset("imdb", split="train[:5]"). Start in src/datasets/load.py at HubDatasetModuleFactory.get_module and trace the cached_path call in src/datasets/utils/file_utils.py, including parse_hf_uri. Done means unnamespaced dataset names such as imdb load successfully without HfUriError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- huggingface, python
- Domain
- data, machine-learning
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100