id
int64
599M
3.48B
number
int64
1
7.8k
title
stringlengths
1
290
state
stringclasses
2 values
comments
listlengths
0
30
created_at
timestamp[s]date
2020-04-14 10:18:02
2025-10-05 06:37:50
updated_at
timestamp[s]date
2020-04-27 16:04:17
2025-10-05 10:32:43
closed_at
timestamp[s]date
2020-04-14 12:01:40
2025-10-01 13:56:03
βŒ€
body
stringlengths
0
228k
βŒ€
user
stringlengths
3
26
html_url
stringlengths
46
51
pull_request
dict
is_pull_request
bool
2 classes
3,484,470,782
7,798
Audio dataset is not decoding on 4.1.1
open
[ "Previously (datasets<=3.6.0), audio columns were decoded automatically when accessing a row. Now, for performance reasons, audio decoding is lazy by default: you just see the file path unless you explicitly cast the column to Audio.\n\nHere’s the fix (following the current [datasets audio docs](https://huggingface.co/docs/datasets/en/audio_load)\n):\n\n```\nfrom datasets import load_dataset, Audio\n\ndataset = load_dataset(\"MrDragonFox/Elise\", split=\"train\")\n\n# Explicitly decode the audio column\ndataset = dataset.cast_column(\"audio\", Audio(sampling_rate=16_000))\n\nprint(dataset[0][\"audio\"])\n# {'path': '...', 'array': array([...], dtype=float32), 'sampling_rate': 16000}\n```" ]
2025-10-05T06:37:50
2025-10-05T10:32:43
null
### Describe the bug The audio column remain as non-decoded objects even when accessing them. ```python dataset = load_dataset("MrDragonFox/Elise", split = "train") dataset[0] # see that it doesn't show 'array' etc... ``` Works fine with `datasets==3.6.0` Followed the docs in - https://huggingface.co/docs/datasets/en/audio_load ### Steps to reproduce the bug ```python dataset = load_dataset("MrDragonFox/Elise", split = "train") dataset[0] # see that it doesn't show 'array' etc... ``` ### Expected behavior It should decode when accessing the elemenet ### Environment info 4.1.1 ubuntu 22.04 Related - https://github.com/huggingface/datasets/issues/7707
thewh1teagle
https://github.com/huggingface/datasets/issues/7798
null
false
3,473,011,621
7,797
Datasets: Add WMT21 & WMT22 loaders (basic TSV loaders, sample data, tests)
open
[]
2025-10-01T10:46:01
2025-10-01T16:38:49
null
- Implemented TSV-based dataset loaders: - WMT21Dataset (local_datasets/wmt21/wmt21_dataset.py) - WMT22Dataset (local_datasets/wmt22/wmt22_dataset.py) These classes load source-target pairs from .tsv files for train, validation, and test splits. - Created sample dummy data for both datasets: - dummy_data/train.tsv, dummy_data/validation.tsv, dummy_data/test.tsv - Includes a few realistic example lines to allow CI and local tests to pass without downloading full datasets. - Added automated tests for robust validation: - tests/test_wmt21.py and tests/test_wmt22.py - Checks that all splits load correctly, empty lines are ignored, and the number of examples matches the number of lines in the .tsv files. - Edge cases handled: empty lines, malformed lines, extra tabs. - Added README.md files for both datasets: - Provides dataset structure, usage instructions, and placeholders for citation & license information. - Ensures that other developers and reviewers can understand dataset usage immediately. - Ensured easy local testing: - Load datasets programmatically using WMT21Dataset / WMT22Dataset. - Verified train/validation/test splits are correctly returned as Python dictionaries of Dataset objects. -Provides initial support for WMT21 and WMT22 NLP/translation experiments. -Allows contributors and reviewers to test dataset loading locally or in CI without downloading large datasets. -Serves as a template to extend to other WMT datasets in the future. Testing instructions: ``` # Activate your environment pytest tests/test_wmt21.py -v pytest tests/test_wmt22.py -v ``` ``` from local_datasets.wmt21.wmt21_dataset import WMT21Dataset from local_datasets.wmt22.wmt22_dataset import WMT22Dataset # WMT21 wmt21 = WMT21Dataset("local_datasets/wmt21/dummy_data") ds21 = wmt21.load() print(ds21["train"][0]) print(ds21["validation"][0]) print(ds21["test"][0]) # WMT22 wmt22 = WMT22Dataset("local_datasets/wmt22/dummy_data") ds22 = wmt22.load() print(ds22["train"][0]) print(ds22["validation"][0]) print(ds22["test"][0]) ```
tanisha-samant
https://github.com/huggingface/datasets/pull/7797
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7797", "html_url": "https://github.com/huggingface/datasets/pull/7797", "diff_url": "https://github.com/huggingface/datasets/pull/7797.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7797.patch", "merged_at": null }
true
3,470,616,799
7,796
Docs: fix typo, improve readability, add code comments
open
[]
2025-09-30T18:34:16
2025-09-30T18:34:16
null
What I did: - Fixed a small typo in README to improve clarity - Fixed repeated word "frameworks frameworks" - Split long paragraphs into shorter sentences for readability - Added # Example comments before code blocks for clarity Why: - Helps new users avoid confusion How I tested: - Checked locally in Markdown preview
tanisha-samant
https://github.com/huggingface/datasets/pull/7796
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7796", "html_url": "https://github.com/huggingface/datasets/pull/7796", "diff_url": "https://github.com/huggingface/datasets/pull/7796.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7796.patch", "merged_at": null }
true
3,463,990,654
7,795
Add pyarrow's binary view to features
open
[ "@lhoestq πŸ™ " ]
2025-09-29T09:12:55
2025-09-29T09:14:34
null
Basically https://github.com/huggingface/datasets/pull/7718 just for binary view instead of string view
delta003
https://github.com/huggingface/datasets/pull/7795
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7795", "html_url": "https://github.com/huggingface/datasets/pull/7795", "diff_url": "https://github.com/huggingface/datasets/pull/7795.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7795.patch", "merged_at": null }
true
3,460,793,966
7,794
Fix nested data conversions error in parquet loading (fixes #7793)
open
[ "Unfortunately, I'm running into this error:\r\n```\r\n~/scratch Β» uv run python test_hf.py \r\nResolving data files: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 42/42 [00:00<00:00, 149.18it/s]\r\nResolving data files: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 102/102 [00:00<00:00, 317608.77it/s]\r\nDownloading data: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 102/102 [00:00<00:00, 337.74files/s]\r\nGenerating public split: 77%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 5506/7179 [00:19<00:10, 156.43 examples/s]Using fallback for nested data in file '/Users/neev/.cache/huggingface/hub/datasets--metr-evals--malt-public/snapshots/86f8dcf09084458117b16a8f83256097d27fe35b/irrelevant_detail/public-00081-of-00102.parquet': Nested data conversions not implemented for chunked array outputs\r\nGenerating public split: 77%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 5506/7179 [00:21<00:06, 256.72 examples/s]\r\nTraceback (most recent call last):\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/packaged_modules/parquet/parquet.py\", line 134, in _generate_tables\r\n for batch_idx, record_batch in enumerate(\r\n ~~~~~~~~~^\r\n parquet_fragment.to_batches(\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n ...<5 lines>...\r\n )\r\n ^\r\n ):\r\n ^\r\n File \"pyarrow/_dataset.pyx\", line 3904, in _iterator\r\n File \"pyarrow/_dataset.pyx\", line 3494, in pyarrow._dataset.TaggedRecordBatchIterator.__next__\r\n File \"pyarrow/error.pxi\", line 155, in pyarrow.lib.pyarrow_internal_check_status\r\n File \"pyarrow/error.pxi\", line 92, in pyarrow.lib.check_status\r\npyarrow.lib.ArrowNotImplementedError: Nested data conversions not implemented for chunked array outputs\r\n\r\nDuring handling of the above exception, another exception occurred:\r\n\r\nTraceback (most recent call last):\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py\", line 1815, in _prepare_split_single\r\n for _, table in generator:\r\n ^^^^^^^^^\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/packaged_modules/parquet/parquet.py\", line 152, in _generate_tables\r\n full_table = parquet_fragment.to_table(\r\n columns=self.config.columns,\r\n filter=filter_expr,\r\n )\r\n File \"pyarrow/_dataset.pyx\", line 1743, in pyarrow._dataset.Fragment.to_table\r\n File \"pyarrow/_dataset.pyx\", line 3939, in pyarrow._dataset.Scanner.to_table\r\n File \"pyarrow/error.pxi\", line 155, in pyarrow.lib.pyarrow_internal_check_status\r\n File \"pyarrow/error.pxi\", line 92, in pyarrow.lib.check_status\r\npyarrow.lib.ArrowNotImplementedError: Nested data conversions not implemented for chunked array outputs\r\n\r\nThe above exception was the direct cause of the following exception:\r\n\r\nTraceback (most recent call last):\r\n File \"/Users/neev/scratch/test_hf.py\", line 3, in <module>\r\n ds = datasets.load_dataset(path=\"metr-evals/malt-public\", name=\"irrelevant_detail\")\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/load.py\", line 1412, in load_dataset\r\n builder_instance.download_and_prepare(\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\r\n download_config=download_config,\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n ...<3 lines>...\r\n storage_options=storage_options,\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n )\r\n ^\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py\", line 894, in download_and_prepare\r\n self._download_and_prepare(\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~^\r\n dl_manager=dl_manager,\r\n ^^^^^^^^^^^^^^^^^^^^^^\r\n ...<2 lines>...\r\n **download_and_prepare_kwargs,\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n )\r\n ^\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py\", line 970, in _download_and_prepare\r\n self._prepare_split(split_generator, **prepare_split_kwargs)\r\n ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py\", line 1702, in _prepare_split\r\n for job_id, done, content in self._prepare_split_single(\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~^\r\n gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n ):\r\n ^\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py\", line 1858, in _prepare_split_single\r\n raise DatasetGenerationError(\"An error occurred while generating the dataset\") from e\r\ndatasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset\r\n```", "Also the gated dataset has automatic approval so you should feel free to sign in and test if you'd like!", "hi @neevparikh I've updated the fix based on your feedback. The new approach uses row group reading as a fallback when both to_batches() and to_table() fail. I've successfully tested it with an actual file from your dataset and it loads correctly. Could you test the updated version?\r\n\r\n", "Now we're failing with this error:\r\n\r\n```Resolving data files: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 42/42 [00:00<00:00, 79.30it/s]\r\nResolving data files: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 102/102 [00:00<00:00, 646252.28it/s]\r\nDownloading data: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 102/102 [00:00<00:00, 781.32files/s]\r\nGenerating public split: 77%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–Œ | 5506/7179 [00:23<00:10, 156.37 examples/s]Using fallback for nested data in file '/Users/neev/.cache/huggingface/hub/datasets--metr-evals--malt-public/snapshots/86f8dcf09084458117b16a8f83256097d27fe35b/irrelevant_detail/public-00081-of-00102.parquet': Nested data conversions not implemented for chunked array outputs\r\nSkipping row group 0 due to nested data issues: Nested data conversions not implemented for chunked array outputs\r\nCould not read any row groups from file '/Users/neev/.cache/huggingface/hub/datasets--metr-evals--malt-public/snapshots/86f8dcf09084458117b16a8f83256097d27fe35b/irrelevant_detail/public-00081-of-00102.parquet'\r\nGenerating public split: 99%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ– | 7099/7179 [00:38<00:00, 182.59 examples/s]\r\nTraceback (most recent call last):\r\n File \"/Users/neev/scratch/test_hf.py\", line 3, in <module>\r\n ds = datasets.load_dataset(\r\n path=\"metr-evals/malt-public\",\r\n name=\"irrelevant_detail\",\r\n )\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/load.py\", line 1412, in load_dataset\r\n builder_instance.download_and_prepare(\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\r\n download_config=download_config,\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n ...<3 lines>...\r\n storage_options=storage_options,\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n )\r\n ^\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py\", line 894, in download_and_prepare\r\n self._download_and_prepare(\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~^\r\n dl_manager=dl_manager,\r\n ^^^^^^^^^^^^^^^^^^^^^^\r\n ...<2 lines>...\r\n **download_and_prepare_kwargs,\r\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n )\r\n ^\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py\", line 988, in _download_and_prepare\r\n verify_splits(self.info.splits, split_dict)\r\n ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n File \"/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/utils/info_utils.py\", line 77, in verify_splits\r\n raise NonMatchingSplitsSizesError(str(bad_splits))\r\ndatasets.exceptions.NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='public', num_bytes=25417866585, num_examples=7179, shard_lengths=None, dataset_name=None), 'recorded': SplitInfo(name='public', num_bytes=22946940147, num_examples=7099, shard_lengths=[300, 240, 180, 300, 600, 779, 359, 358, 239, 80, 80, 239, 79, 80, 159, 239, 399, 239, 398, 159, 159, 80, 80, 398, 80, 637, 80, 79], dataset_name='malt-public')}]```", "it seems to me that we dropped the ones we couldn't read?", "@Aishwarya0811 let me know if there's helpful things here I can do?" ]
2025-09-27T22:04:13
2025-10-01T16:56:20
null
Fixes #7793 ## Problem Loading datasets with deeply nested structures (like `metr-evals/malt-public`) fails with: ArrowNotImplementedError: Nested data conversions not implemented for chunked array outputs This occurs when parquet files contain nested data (lists, structs, maps) that exceed PyArrow's 16MB chunk limit. ## Root Cause PyArrow's C++ implementation explicitly rejects nested data conversions when data is split across multiple chunks. The limitation exists in the `WrapIntoListArray` function where repetition levels cannot be reconstructed across chunk boundaries. ## Solution - **Fallback mechanism**: Catches the specific PyArrow error and switches to non-chunked reading - **Selective optimization**: Only combines chunks for problematic nested columns to minimize memory impact - **Manual batching**: Maintains batching behavior even in fallback mode - **Backward compatibility**: Zero impact on existing datasets ## Implementation Details - Added `_is_nested_type()` helper to detect nested PyArrow types - Added `_handle_nested_chunked_conversion()` for selective chunk combining - Modified `_generate_tables()` to catch and handle the specific error - Preserves all existing error handling and logging ## Testing - [x] No regressions: Normal parquet datasets continue working - [x] Code follows existing patterns in the datasets codebase - [x] tested by original reporter (gated dataset access needed) **Note**: This fix is based on thorough research of PyArrow limitations and similar issues in the ecosystem. While we cannot test with the original dataset due to access restrictions, the implementation follows established patterns for handling this PyArrow limitation. ## Request for Testing @neevparikh Could you please test this fix with your original failing dataset? The implementation should resolve the nested data conversion error you encountered.
Aishwarya0811
https://github.com/huggingface/datasets/pull/7794
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7794", "html_url": "https://github.com/huggingface/datasets/pull/7794", "diff_url": "https://github.com/huggingface/datasets/pull/7794.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7794.patch", "merged_at": null }
true
3,459,496,971
7,793
Cannot load dataset, fails with nested data conversions not implemented for chunked array outputs
open
[ "Hey @neevparikh,\nThanks for reporting this! I can reproduce the issue and have identified the root cause.\nProblem: The metr-evals/malt-public dataset contains deeply nested conversation data that exceeds PyArrow's 16MB chunk limit. When PyArrow tries to read it in chunks, it hits a fundamental limitation: \"Nested data conversions not implemented for chunked array outputs\".\nRoot Cause: Your dataset has large nested arrays (conversation trees with 4k-87k elements) that get automatically chunked by PyArrow, but the nested data conversion logic can't handle repetition levels across chunk boundaries\n I'm preparing a PR that adds a fallback mechanism to the parquet reader. When this specific error occurs, it will:\n\nDetect the nested data issue\nCombine chunks selectively for problematic columns\nContinue processing normally\n\nThis maintains backward compatibility while fixing the issue for nested datasets like yours.\nWorkaround (if you need immediate access): Try loading with smaller batch sizes:\npythonds = datasets.load_dataset(\"metr-evals/malt-public\", name=\"irrelevant_detail\", \n download_config=datasets.DownloadConfig(\n parquet_batch_size=1000\n ))" ]
2025-09-27T01:03:12
2025-09-27T21:35:31
null
### Describe the bug Hi! When I load this dataset, it fails with a pyarrow error. I'm using datasets 4.1.1, though I also see this with datasets 4.1.2 To reproduce: ``` import datasets ds = datasets.load_dataset(path="metr-evals/malt-public", name="irrelevant_detail") ``` Error: ``` Traceback (most recent call last): File "/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py", line 1815, in _prepare_split_single for _, table in generator: ^^^^^^^^^ File "/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/packaged_modules/parquet/parquet.py", line 93, in _generate_tables for batch_idx, record_batch in enumerate( ~~~~~~~~~^ parquet_fragment.to_batches( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<5 lines>... ) ^ ): ^ File "pyarrow/_dataset.pyx", line 3904, in _iterator File "pyarrow/_dataset.pyx", line 3494, in pyarrow._dataset.TaggedRecordBatchIterator.__next__ File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status pyarrow.lib.ArrowNotImplementedError: Nested data conversions not implemented for chunked array outputs The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/neev/scratch/test_hf.py", line 3, in <module> ds = datasets.load_dataset(path="metr-evals/malt-public", name="irrelevant_detail") File "/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/load.py", line 1412, in load_dataset builder_instance.download_and_prepare( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ download_config=download_config, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<3 lines>... storage_options=storage_options, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py", line 894, in download_and_prepare self._download_and_prepare( ~~~~~~~~~~~~~~~~~~~~~~~~~~^ dl_manager=dl_manager, ^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... **download_and_prepare_kwargs, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py", line 970, in _download_and_prepare self._prepare_split(split_generator, **prepare_split_kwargs) ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py", line 1702, in _prepare_split for job_id, done, content in self._prepare_split_single( ~~~~~~~~~~~~~~~~~~~~~~~~~~^ gen_kwargs=gen_kwargs, job_id=job_id, **_prepare_split_args ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ): ^ File "/Users/neev/scratch/.venv/lib/python3.13/site-packages/datasets/builder.py", line 1858, in _prepare_split_single raise DatasetGenerationError("An error occurred while generating the dataset") from e datasets.exceptions.DatasetGenerationError: An error occurred while generating the dataset ``` ### Steps to reproduce the bug To reproduce: ``` import datasets ds = datasets.load_dataset(path="metr-evals/malt-public", name="irrelevant_detail") ``` ### Expected behavior The dataset loads ### Environment info Datasets: 4.1.1 Python: 3.13 Platform: Macos
neevparikh
https://github.com/huggingface/datasets/issues/7793
null
false
3,456,802,210
7,792
Concatenate IterableDataset instances and distribute underlying shards in a RoundRobin manner
open
[ "# With `datasets.Dataset`\n\nHere is an small script that shows the distribution differences of samples between `interleave_datasets`, `concatenate_datasets` and `concatenate_datasets` + shuffling.\n\n```python\nimport datasets as hf_datasets\n\ndef gen(dataset: int, n_samples: int):\n for i in range(n_samples):\n yield {\"dataset\": dataset, \"sample\": i}\n\nds_1 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 0, \"n_samples\": 2})\nds_2 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 1, \"n_samples\": 1})\nds_3 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 2, \"n_samples\": 3})\n\nn_workers = 3\nprint(f\"Simulate run with {n_workers} workers\")\n\nprint(\"Interleave datasets\")\nfor w in range(n_workers):\n ds_interleave = hf_datasets.interleave_datasets([ds_1, ds_2, ds_3]).shard(n_workers, w)\n for i, sample in enumerate(ds_interleave):\n print(f\"Worker {w} process sample {i} {sample}\")\n\nprint(\"Concatenate datasets\")\nfor w in range(n_workers):\n ds_concatenate = hf_datasets.concatenate_datasets([ds_1, ds_2, ds_3]).shard(n_workers, w)\n for i, sample in enumerate(ds_concatenate):\n print(f\"Worker {w} process sample {i} {sample}\")\n\nprint(\"Concated and shuffled datasets\")\nfor w in range(n_workers):\n ds_concatenate = hf_datasets.concatenate_datasets([ds_1, ds_2, ds_3]).shuffle().shard(n_workers, w)\n for i, sample in enumerate(ds_concatenate):\n print(f\"Worker {w} process sample {i} {sample}\")\n```\n\n> Interleave datasets\nWorker 0 process sample 0 {'dataset': 0, 'sample': 0}\nWorker 1 process sample 0 {'dataset': 1, 'sample': 0}\nWorker 2 process sample 0 {'dataset': 2, 'sample': 0}\n\n> Concatenate datasets\nWorker 0 process sample 0 {'dataset': 0, 'sample': 0}\nWorker 0 process sample 1 {'dataset': 0, 'sample': 1}\nWorker 1 process sample 0 {'dataset': 1, 'sample': 0}\nWorker 1 process sample 1 {'dataset': 2, 'sample': 0}\nWorker 2 process sample 0 {'dataset': 2, 'sample': 1}\nWorker 2 process sample 1 {'dataset': 2, 'sample': 2}\n\n> Concated and shuffled datasets\nWorker 0 process sample 0 {'dataset': 2, 'sample': 2}\nWorker 0 process sample 1 {'dataset': 2, 'sample': 0}\nWorker 1 process sample 0 {'dataset': 0, 'sample': 1}\nWorker 1 process sample 1 {'dataset': 2, 'sample': 1}\nWorker 2 process sample 0 {'dataset': 2, 'sample': 2}\nWorker 2 process sample 1 {'dataset': 0, 'sample': 0}\n\nWithout shuffling, round robin would yield:\n> Worker 0 process sample 0 {'dataset': 0, 'sample': 0}\nWorker 0 process sample 1 {'dataset': 2, 'sample': 0}\nWorker 1 process sample 0 {'dataset': 0, 'sample': 1}\nWorker 1 process sample 1 {'dataset': 2, 'sample': 1}\nWorker 2 process sample 0 {'dataset': 1, 'sample': 0}\nWorker 2 process sample 1 {'dataset': 2, 'sample': 2}", "# With `datasets.IterableDataset`\n\nThe above works for `Dataset`, but with a sharded `IterableDataset` some data get discarded. See the following results obtained with the script below.\n\n> Simulate run with 3 workers\n\n> Interleave datasets\nWorker 0 process sample 0 {'dataset': 0, 'sample': 0}\nWorker 1 fails with list index out of range.\nWorker 2 fails with list index out of range.\nWith dataloader\nToo many dataloader workers: 3 (max is dataset.num_shards=1). Stopping 2 dataloader workers.\n{'dataset': tensor([0]), 'sample': tensor([0])}\n\n> Concatenate datasets\nWorker 0 process sample 0 {'dataset': 0, 'sample': 0}\nWorker 0 process sample 1 {'dataset': 1, 'sample': 0}\nWorker 0 process sample 2 {'dataset': 2, 'sample': 0}\nWorker 1 fails with list index out of range\nWorker 2 fails with list index out of range\nWith dataloader\nToo many dataloader workers: 3 (max is dataset.num_shards=1). Stopping 2 dataloader workers.\n{'dataset': tensor([0]), 'sample': tensor([0])}\n{'dataset': tensor([1]), 'sample': tensor([0])}\n{'dataset': tensor([2]), 'sample': tensor([0])}\n\n> Concated and shuffled datasets\nWorker 0 process sample 0 {'dataset': 0, 'sample': 0}\nWorker 0 process sample 1 {'dataset': 1, 'sample': 0}\nWorker 0 process sample 2 {'dataset': 2, 'sample': 0}\nWorker 1 fails with list index out of range\nWorker 2 fails with list index out of range\nWith dataloader\nToo many dataloader workers: 3 (max is dataset.num_shards=1). Stopping 2 dataloader workers.\n{'dataset': tensor([0]), 'sample': tensor([0])}\n{'dataset': tensor([1]), 'sample': tensor([0])}\n{'dataset': tensor([2]), 'sample': tensor([0])}\n\n<details>\n\n<summary>Experiment script</summary>\n\n```python\nds_1 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 0, \"n_samples\": 2}).to_iterable_dataset(\n num_shards=2\n)\nds_2 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 1, \"n_samples\": 1}).to_iterable_dataset(\n num_shards=1\n)\nds_3 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 2, \"n_samples\": 3}).to_iterable_dataset(\n num_shards=3\n)\n\nn_workers = 3\nprint(f\"Simulate run with {n_workers} workers\")\n\nprint(\"\\nInterleave datasets\")\nds_interleave = hf_datasets.interleave_datasets([ds_1, ds_2, ds_3])\nfor w in range(n_workers):\n try:\n for i, sample in enumerate(ds_interleave.shard(n_workers, w)):\n print(f\"Worker {w} process sample {i} {sample}\")\n except IndexError as e:\n print(f\"Worker {w} fails with {e}.\")\n\nprint(\"With dataloader\")\nfor sample in torch.utils.data.DataLoader(ds_interleave, num_workers=n_workers):\n print(f\"{sample}\")\n\nprint(\"\\nConcatenate datasets\")\nds_concatenate = hf_datasets.concatenate_datasets([ds_1, ds_2, ds_3])\nfor w in range(n_workers):\n try:\n for i, sample in enumerate(ds_concatenate.shard(n_workers, w)):\n print(f\"Worker {w} process sample {i} {sample}\")\n except IndexError as e:\n print(f\"Worker {w} fails with {e}\")\n\nprint(\"With dataloader\")\nfor sample in torch.utils.data.DataLoader(ds_concatenate, num_workers=n_workers):\n print(f\"{sample}\")\n\nprint(\"\\nConcated and shuffled datasets\")\nds_concatenate = hf_datasets.concatenate_datasets([ds_1, ds_2, ds_3]).shuffle()\nfor w in range(n_workers):\n try:\n for i, sample in enumerate(ds_concatenate.shard(n_workers, w)):\n print(f\"Worker {w} process sample {i} {sample}\")\n except IndexError as e:\n print(f\"Worker {w} fails with {e}\")\n\nprint(\"With dataloader\")\nfor sample in torch.utils.data.DataLoader(ds_concatenate, num_workers=n_workers):\n print(f\"{sample}\")\n```\n\n</details>\n\n# Round Robin with fixed logic\n\n> I started implementing the following, but I'm afraid my sharding logic is incorrect.\n\nHere is a solution for mixing the data in a round robin fashion that allows to distribute the data to all workers. In the previous example above only 1 worker over 3 was actually retrieving data, which resulted in discarding some data.\n\n```python\ndef shard_data_sources(self, num_shards: int, index: int, contiguous=True) -> \"MixMultiSourceExampleIterable\":\n \"\"\"Shard the underlying iterables in a roundrobin manner.\n\n Let's consider we have our iterables as [[s0_0, s0_1], [s1_0], [s2_0, s2_1, s2_3]],\n and we request 3 shards.\n index 0 gets s0_0 s2_0\n index 1 gets s0_1 s2_1\n index 2 gets s1_0 s2_3\n \"\"\"\n return MixMultiSourcesExampleIterable(\n list(\n islice(\n # flatten all underlying iterables (fixed logic)\n [\n ex_iterable.shard_data_sources(ex_iterable.num_shards, index)\n for ex_iterable in self.ex_iterables\n for index in range(ex_iterable.num_shards)\n ],\n # offset the starting point by the index\n index,\n # take over the full list, so exhaust the iterators\n None,\n # step by the number of shards requested\n num_shards,\n )\n )\n )\n```\n\nEditing the example above with the following we obtain the expected result:\n```python\nprint(\"\\nMix datasets\")\nds_mix = mix_dataset([ds_1, ds_2, ds_3])\nfor w in range(n_workers):\n try:\n for i, sample in enumerate(ds_mix.shard(n_workers, w)):\n print(f\"Worker {w} process sample {i} {sample}\")\n except IndexError as e:\n print(f\"Worker {w} fails with {e}\")\n\nprint(\"With dataloader\")\nfor sample in torch.utils.data.DataLoader(ds_mix, num_workers=n_workers):\n print(f\"{sample}\")\n```\n> Mix datasets\nMix datasets\nWorker 0 process sample 0 {'dataset': 0, 'sample': 0}\nWorker 0 process sample 1 {'dataset': 2, 'sample': 0}\nWorker 1 process sample 0 {'dataset': 0, 'sample': 1}\nWorker 1 process sample 1 {'dataset': 2, 'sample': 1}\nWorker 2 process sample 0 {'dataset': 1, 'sample': 0}\nWorker 2 process sample 1 {'dataset': 2, 'sample': 2}\nWith dataloader\n{'dataset': tensor([0]), 'sample': tensor([0])}\n{'dataset': tensor([0]), 'sample': tensor([1])}\n{'dataset': tensor([1]), 'sample': tensor([0])}\n{'dataset': tensor([2]), 'sample': tensor([0])}\n{'dataset': tensor([2]), 'sample': tensor([1])}\n{'dataset': tensor([2]), 'sample': tensor([2])}\n\n# Questions \n\n- The example is quite small, showing that some data get discarded, but on large datasets is this significant?\n- How does the suggested solution interplays with shuffling?\n\n\n\n\n", "# Larger Experiment\n\n> The example is quite small, showing that some data get discarded, but on large datasets is this significant?\n\nContinuing the experiment above, but with 3 larger and unbalanced datasets, with respectively 1000, 150, and 300 samples, and a dataloader with 4 workers:\n \n> Interleave datasets\nWith dataloader\nToo many dataloader workers: 4 (max is dataset.num_shards=1). Stopping 3 dataloader workers.\nYield 300 samples\n\n> Concatenate datasets\nWith dataloader\nToo many dataloader workers: 4 (max is dataset.num_shards=1). Stopping 3 dataloader workers.\nYield 705 samples\n\n> Concated and shuffled datasets\nWith dataloader\nToo many dataloader workers: 4 (max is dataset.num_shards=1). Stopping 3 dataloader workers.\nYield 705 samples\n\n> Mix datasets\nWith dataloader\nYield 1405 samples\n\nThe dataset mixing proposed above is the only one that yields all the samples while using all the dataloaders.\nAdditional checks should include training metrics (does it improve training quality to mix the data like this), and behavior check in a DDP settings, we don't want to face any deadlock due to some GPU having more batches than other. But this later point should be already handled by the iterator of the `IterableDataset`.\n\n# Follow up?\n\n@lhoestq would there be any interest in making a PR of it? Otherwise I can close the issue as I found a solution to my problem. ", "I believe this PR could solve your issue? :)\n\nhttps://github.com/huggingface/datasets/pull/7786", "> I believe this PR could solve your issue? :)\n\nThank you @lhoestq for the reply.\nI have just tested it with the script above. It gives:\n\n> Interleave datasets without replacement\nWith dataloader\nToo many dataloader workers: 4 (max is dataset.num_shards=1). Stopping 3 dataloader workers.\nYield 705 samples\n\nIf we compare with the original `interleave_dataset` method it produces 405 samples more. However, it only uses 1 worker on the 4 available. Moreover it doesn't yield all the samples as the mixing strategy with RoundRobin above does (1405 samples vs 705).", "@LTMeyer With the following script and using the code from #7786 I get all 1450 samples\n\n```\nimport datasets as hf_datasets\n\n\ndef gen(dataset: int, n_samples: int):\n for i in range(n_samples):\n yield {\"dataset\": dataset, \"sample\": i}\n\n\nds_1 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 0, \"n_samples\": 1000}).to_iterable_dataset()\nds_2 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 1, \"n_samples\": 150}).to_iterable_dataset()\nds_3 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 2, \"n_samples\": 300}).to_iterable_dataset()\n\nprint(\"Interleave datasets\")\nds_interleave = hf_datasets.interleave_datasets(\n [ds_1, ds_2, ds_3],\n probabilities=[1 / 3, 1 / 3, 1 / 3],\n stopping_strategy=\"all_exhausted_without_replacement\",\n)\nfor i, sample in enumerate(ds_interleave):\n print(f\"process sample {i} {sample}\")\n```\nI'm not sure on the workers side how many will be spawned and so on. ", "> [@LTMeyer](https://github.com/LTMeyer) With the following script and using the code from [#7786](https://github.com/huggingface/datasets/pull/7786) I get all 1450 samples\n\nThis depends on the number of shards and the number of processes being used.\nIn the example below there is only one shard per dataset (the default of `to_iterable_dataset` method). Then, the for loop is running in the main process. It thus consumes all the shards, hence the 1450 samples.\n\n> \n> ```\n> import datasets as hf_datasets\n> \n> \n> def gen(dataset: int, n_samples: int):\n> for i in range(n_samples):\n> yield {\"dataset\": dataset, \"sample\": i}\n> \n> \n> ds_1 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 0, \"n_samples\": 1000}).to_iterable_dataset()\n> ds_2 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 1, \"n_samples\": 150}).to_iterable_dataset()\n> ds_3 = hf_datasets.Dataset.from_generator(gen, gen_kwargs={\"dataset\": 2, \"n_samples\": 300}).to_iterable_dataset()\n> \n> print(\"Interleave datasets\")\n> ds_interleave = hf_datasets.interleave_datasets(\n> [ds_1, ds_2, ds_3],\n> probabilities=[1 / 3, 1 / 3, 1 / 3],\n> stopping_strategy=\"all_exhausted_without_replacement\",\n> )\n> for i, sample in enumerate(ds_interleave):\n> print(f\"process sample {i} {sample}\")\n> ```\n> \n\n\n> I'm not sure on the workers side how many will be spawned and so on.\n\nWhile using the data to train a model, I would like to use the `torch.utils.data.DataLoader` to feed batches of data to my model. To make the data loading fast, it is common to use `num_workers>0` in the dataloader. This will consume data in parallel. In practice, it copies the dataset instance and read in parallel different chunks of data. These chunks correspond to the underlying shards of the iterable dataset.\n\nIf we have 1 shard per dataset, as it is the case in the example above, the dataloading will indeed get all the 1450 samples, but it will run only in one process even if multiple are available. This is inefficient because it doesn't utilize all available resources. See the script and results below.\n\n```python\nfor num_workers in [0, 1, 2, 3, 4]:\n print(f\"Dataloader with {num_workers} workers.\")\n dataloader = DataLoader(ds_interleave, num_workers=num_workers, batch_size=1)\n for i, sample in enumerate(dataloader, start=1):\n pass\n print(f\"{i} processed samples\")\n```\n\n```\nDataloader with 0 workers.\n1450 processed samples\nDataloader with 1 workers.\n1450 processed samples\nDataloader with 2 workers.\nToo many dataloader workers: 2 (max is dataset.num_shards=1). Stopping 1 dataloader workers.\n1450 processed samples\nDataloader with 3 workers.\nToo many dataloader workers: 3 (max is dataset.num_shards=1). Stopping 2 dataloader workers.\n1450 processed samples\nDataloader with 4 workers.\nToo many dataloader workers: 4 (max is dataset.num_shards=1). Stopping 3 dataloader workers.\n1450 processed samples\n```\n\nNow if we shard our data differently, like 2, 1, and 3 for each dataset respectively as the [previous example](https://github.com/huggingface/datasets/issues/7792#issuecomment-3345970293), and use a dataloader with different number of workers (same script as above), we obtain:\n\n```\nDataloader with 0 workers.\n1450 processed samples\nDataloader with 1 workers.\n1450 processed samples\nDataloader with 2 workers.\nToo many dataloader workers: 2 (max is dataset.num_shards=1). Stopping 1 dataloader workers.\n850 processed samples\nDataloader with 3 workers.\nToo many dataloader workers: 3 (max is dataset.num_shards=1). Stopping 2 dataloader workers.\n750 processed samples\nDataloader with 4 workers.\nToo many dataloader workers: 4 (max is dataset.num_shards=1). Stopping 3 dataloader workers.\n750 processed samples\n```", "I added a small fix to your PR @radulescupetru to try to make @LTMeyer 's example work :)\n\nCan you confirm it works for you now @LTMeyer ?\n\nNote that maximum parallelism requires each subset to have num_shards >= num_workers, otherwise there aren't enough shards to distribute to every worker for interleaving. In your example one of the subsets has only 1 shard, so only 1 worker can take care of interleaving.", "> Can you confirm it works for you now [@LTMeyer](https://github.com/LTMeyer) ?\n\nResult with https://github.com/huggingface/datasets/pull/7786/commits/a547d81469128bea4acc3bcc2a4a6a95968936ee:\n```\nDataloader with 0 workers.\n1450 processed samples\nDataloader with 1 workers.\n1450 processed samples\nDataloader with 2 workers.\nToo many dataloader workers: 2 (max is dataset.num_shards=1). Stopping 1 dataloader workers.\n1450 processed samples\nDataloader with 3 workers.\nToo many dataloader workers: 3 (max is dataset.num_shards=1). Stopping 2 dataloader workers.\n1450 processed samples\nDataloader with 4 workers.\nToo many dataloader workers: 4 (max is dataset.num_shards=1). Stopping 3 dataloader workers.\n1450 processed samples\n```\n\n I have checked with the script above and I confirm that all samples are now correctly returned, thank you @lhoestq .\n\n> Note that maximum parallelism requires each subset to have num_shards >= num_workers, otherwise there aren't enough shards to distribute to every worker for interleaving. In your example one of the subsets has only 1 shard, so only 1 worker can take care of interleaving.\n\nThis point I'm not sure I understand. That is maybe where @radulescupetru's intent and mine differ. Why should we limit the number of workers to the minimum number of shards? My initial goal was to distribute shards among workers to maximize data loading speed, and to mix the data so batches are representative of the whole dataset and diverse enough (hence the round-robin). \n\nIn the example above, we have 6 shards in total, can we not distribute these shards among workers? That what the `MixMultiSourcesExampleIterable` in https://github.com/huggingface/datasets/issues/7792#issuecomment-3345970293 above does.\n- If 2 workers, 3 shards for each. \n- If 3 workers, 2 shards for each.\n- If 4 workers, the 2 first ones get 2 shards while the two last ones get only 1.\n- Above 6 workers, the 6 first ones get 1 shard each, and the remaining workers get none.\n\n\n", "@LTMeyer I think it's just a design choice that datasets library took. From my interaction with it, it seems that even when concatenating or interleaving, individual components are still treated individually (for example, num_shards is not summed).\n\nI guess in a real scenario you wouldn't end up with 1 shard only, but it's true that you need to be a bit careful with the setup. For workers it's a bit more automated in the sense that if you have more it will stop the extra ones, but when distributing a dataset over multiple gpus it's even more tricky as if the number of shards is not a factor of world size iterating is slower.", "> [@LTMeyer](https://github.com/LTMeyer) I think it's just a design choice that datasets library took. From my interaction with it, it seems that even when concatenating or interleaving, individual components are still treated individually (for example, num_shards is not summed).\n\nIndeed. I am curious to know if there is any explanation for this choice that I am missing.\n\n> I guess in a real scenario you wouldn't end up with 1 shard only, but it's true that you need to be a bit careful with the setup. \n\nIn my case I would like to mix many small datasets which are individually based on only few shards. So it's actually close to the case with 1 shard only.\n\n> For workers it's a bit more automated in the sense that if you have more it will stop the extra ones, but when distributing a dataset over multiple gpus it's even more tricky as if the number of shards is not a factor of world size iterating is slower.\n\nMy understanding is that, in a multi-gpu settings, we want each GPU to receive the same number of batches to avoid deadlock in any synchronization process. \nMulti-GPU related sharding of the `IterableDataset` is managed there https://github.com/huggingface/datasets/blob/4.1.1/src/datasets/iterable_dataset.py#L2371-L2392,\nwhile the sharding for dataloaders with multiple workers is handled there https://github.com/huggingface/datasets/blob/4.1.1/src/datasets/iterable_dataset.py#L2292-L2314.\n\nHere is a script to check the behavior in case of multi-gpus, using `split_dataset_by_node`. In the example I consider just 2 GPUs.\n\n```python\nworld_size = 2\nfor num_workers in [0, 1, 2, 3, 4]:\n for rank in range(world_size):\n print(f\"Rank {rank}\")\n ds_interleave_rank = split_dataset_by_node(ds_interleave, rank, world_size)\n print(f\"Dataloader with {num_workers} workers.\")\n dataloader = DataLoader(ds_interleave_rank, num_workers=num_workers, batch_size=1)\n for i in enumerate(dataloader, start=1):\n pass\n print(f\"{i} processed samples\")\n print(\"\\n\")\n```\n\nThe results using https://github.com/huggingface/datasets/pull/7786/commits/455bfaaa6d574aa9d9c9592baee390017512cc5f:\n```\nRank 0\nDataloader with 0 workers.\n725 processed samples\nRank 1\nDataloader with 0 workers.\n725 processed samples\n\n\nRank 0\nDataloader with 1 workers.\n725 processed samples\nRank 1\nDataloader with 1 workers.\n725 processed samples\n\n\nRank 0\nDataloader with 2 workers.\nToo many dataloader workers: 2 (max is dataset.num_shards=1). Stopping 1 dataloader workers.\n725 processed samples\nRank 1\nDataloader with 2 workers.\n725 processed samples\n\n\nRank 0\nDataloader with 3 workers.\nToo many dataloader workers: 3 (max is dataset.num_shards=1). Stopping 2 dataloader workers.\n725 processed samples\nRank 1\nDataloader with 3 workers.\n725 processed samples\n\n\nRank 0\nDataloader with 4 workers.\nToo many dataloader workers: 4 (max is dataset.num_shards=1). Stopping 3 dataloader workers.\n725 processed samples\nRank 1\nDataloader with 4 workers.\n725 processed samples\n```\n\nIf now I use the mixing described above the results are:\n```\nRank 0\nDataloader with 0 workers.\n750 processed samples\nRank 1\nDataloader with 0 workers.\n700 processed samples\n\n\nRank 0\nDataloader with 1 workers.\n750 processed samples\nRank 1\nDataloader with 1 workers.\n700 processed samples\n\n\nRank 0\nDataloader with 2 workers.\n750 processed samples\nRank 1\nDataloader with 2 workers.\n700 processed samples\n\n\nRank 0\nDataloader with 3 workers.\n750 processed samples\nRank 1\nDataloader with 3 workers.\n700 processed samples\n\n\nRank 0\nDataloader with 4 workers.\n750 processed samples\nRank 1\nDataloader with 4 workers.\n700 processed samples\n```\n\nDifferent GPUs received different number of batches which is problematic. The interleave method, on the other hand, feeds each GPU with the same number of batches. Nonetheless, it doesn't leverage all available workers.\nI'll check if I can fix the distribution of shards across GPU in the last configuration." ]
2025-09-26T10:05:19
2025-10-03T12:25:19
null
### Feature request I would like to be able to concatenate multiple `IterableDataset` with possibly different features. I would like to then be able to stream the results in parallel (both using DDP and multiple workers in the pytorch DataLoader). I want the merge of datasets to be well balanced between the different processes. ### Motivation I want to train a model on a combination of datasets, which I can convert to a single representation. This applies to converting different datasets items to the same Python class, as using a tokenizer on multiple modalities. Assuming that my original datasets are not necessarily well balanced as they may have different size and thus different number of shards, I would like the merged dataset to be distributed evenly over the multiple processes. I don't mind if it's not perfectly balanced, and as result, some workers of the torch DataLoader do nothing, as long as the DDP is properly handled causing no deadlock. ### What I've tried I've tried the two functions already provided in datasets, namely `interleave_datasets` and `concatenate_datasets`. - Interleave seems to be the best approach of what I'm trying to do. However, it doesn't suit my purpose because as I understand it, it stops as soon as one of the dataset source is exhausted, or repeat the smallest source items until the largest is exhausted. I would like something in-between, similarly to what [roundrobin does](https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.roundrobin). - Concatenate does not mix the data enough and one dataset may be overrepresented in some early batches. Let's consider we have 3 datasets composed of different number of shards as follow [[s0_0, s0_1], [s1_0], [s2_0, s2_1, s2_3]], where s denotes the underlying shard, the first index the dataset and the second the shard number. If we request 3 shards in the `shard_data_source` we should obtain the following: index 0 gets s0_0 s2_0 index 1 gets s0_1 s2_1 index 2 gets s1_0 s2_3 I started implementing the following, but I'm afraid my sharding logic is incorrect. ```python from copy import deepcopy from itertools import chain, islice import datasets import numpy as np from datasets import IterableDataset from datasets.iterable_dataset import _BaseExamplesIterable from more_itertools import roundrobin class MixMultiSourcesExampleIterable(_BaseExamplesIterable): def __init__(self, ex_iterables: list[_BaseExamplesIterable]): super().__init__() self.ex_iterables = ex_iterables def _init_state_dict(self) -> dict: self._state_dict = { "ex_iterables": [ex_iterable._init_state_dict() for ex_iterable in self.ex_iterables], "type": self.__class__.__name__, } return self._state_dict @property def num_shards(self) -> int: return sum(ex_iterable.num_shards for ex_iterable in self.ex_iterables) def __iter__(self): yield from roundrobin(*self.ex_iterables) def shuffle_data_sources(self, generator: np.random.Generator) -> "MixMultiSourcesExampleIterable": """Shuffle the list of examples iterable, as well as each underlying examples iterable.""" rng = deepcopy(generator) ex_iterables = list(self.ex_iterables) rng.shuffle(ex_iterables) ex_iterables = [ex_iterable.shuffle_data_sources(generator) for ex_iterable in ex_iterables] return MixMultiSourcesExampleIterable(ex_iterables) def shard_data_sources(self, num_shards: int, index: int, contiguous=True) -> "MixMultiSourceExampleIterable": """Shard the underlying iterables in a roundrobin manner. Let's consider we have our iterables as [[s0_0, s0_1], [s1_0], [s2_0, s2_1, s2_3]], and we request 3 shards. index 0 gets s0_0 s2_0 index 1 gets s0_1 s2_1 index 2 gets s1_0 s2_3 """ return MixMultiSourcesExampleIterable( list( islice( # flatten all underlying iterables chain.from_iterable([ex_iterable.shard_data_sources(1, 0) for ex_iterable in self.ex_iterables]), # offset the starting point by the index index, # take over the full list, so exhaust the iterators None, # step by the number of shards requested num_shards, ) ) ) def mix_dataset(iterable_datasets: list[datasets.IterableDataset]) -> IterableDataset: ex_iterable = MixMultiSourcesExampleIterable([ds._ex_iterable for ds in iterable_datasets]) return IterableDataset( ex_iterable, distributed=iterable_datasets[0]._distributed, formatting=iterable_datasets[0]._formatting ) ``` ### Questions - Am I missing something? Is there a way to use `interleave_datasets` or `concatenate_datasets` to fit my purpose? - Would it be the right approach to spread the maximum number of underlying shards across my different processes? ### Your contribution As much as I can.
LTMeyer
https://github.com/huggingface/datasets/issues/7792
null
false
3,454,046,306
7,791
fix: add `num_proc` argument to `Dataset.to_sql`
open
[]
2025-09-25T15:02:46
2025-09-25T15:03:18
null
**Task Done:** - Resolve issue #7788 : Add the missing argument mapping in Dataset.to_sql (`src/datasets/arrow_dataset.py`)
EricSaikali
https://github.com/huggingface/datasets/pull/7791
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7791", "html_url": "https://github.com/huggingface/datasets/pull/7791", "diff_url": "https://github.com/huggingface/datasets/pull/7791.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7791.patch", "merged_at": null }
true
3,453,679,876
7,790
update tips in docs
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7790). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.", "cc @mishig25" ]
2025-09-25T13:36:02
2025-09-25T13:39:28
2025-09-25T13:39:22
null
lhoestq
https://github.com/huggingface/datasets/pull/7790
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7790", "html_url": "https://github.com/huggingface/datasets/pull/7790", "diff_url": "https://github.com/huggingface/datasets/pull/7790.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7790.patch", "merged_at": "2025-09-25T13:39:22" }
true
3,453,273,059
7,789
fix link for rotten_tomatoes dataset
open
[]
2025-09-25T11:51:36
2025-09-25T11:51:36
null
The current link leads to a 404 page.
0xmohit
https://github.com/huggingface/datasets/pull/7789
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7789", "html_url": "https://github.com/huggingface/datasets/pull/7789", "diff_url": "https://github.com/huggingface/datasets/pull/7789.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7789.patch", "merged_at": null }
true
3,450,913,796
7,788
`Dataset.to_sql` doesn't utilize `num_proc`
open
[]
2025-09-24T20:34:47
2025-09-24T20:35:01
null
The underlying `SqlDatasetWriter` has `num_proc` as an available argument [here](https://github.com/huggingface/datasets/blob/5dc1a179783dff868b0547c8486268cfaea1ea1f/src/datasets/io/sql.py#L63) , but `Dataset.to_sql()` does not accept it, therefore it is always using one process for the SQL conversion.
tcsmaster
https://github.com/huggingface/datasets/issues/7788
null
false
3,450,858,674
7,787
feat: avoid some copies in torch formatter
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7787). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.", "can you re-read your PR please ?" ]
2025-09-24T20:19:44
2025-09-26T15:04:25
2025-09-26T15:04:23
## perf: reduce copies in TorchFormatter This PR make changes the torch formatter to avoid unnecessary copies and casts when converting decoded batches to tensors. Because many arrays are already in a torch-friendly memory layout and dtype, we can do zero‑copy conversions (`torch.from_numpy`) and only fall back to `as_tensor` when a dtype/device change is required. We also consolidate lists of same‑shape tensors with a cheap `stack` only when safe. Why it helps - Avoids extra materialization and dtype churn during batched map and indexing. - Preserves API and outputs; only changes internal conversion logic. Small benchmark script (based on https://github.com/huggingface/datasets/issues/6104) ```python import time from datasets import load_dataset def main(): dataset = load_dataset("NightMachinery/hf_datasets_bug1") dataset = dataset["train"] if "train" in dataset else dataset t0 = time.time() dataset.set_format(type="torch") # identity map with small batches dataset = dataset.map(lambda x: x, batched=True, batch_size=20) # force materialization data = dataset[:300] print(len(data.keys())) t1 = time.time() print(f"Duration: {t1 - t0:.2f} s") if __name__ == "__main__": main() ``` Without changes ```bash uv run bench.py ``` ```bash # 303 # Duration: 7.26 s ``` With changes ```bash uv run bench.py ``` ```bash # 303 # Duration: 4.43 s ``` # Updated reproduction scripts Below are some simple test cases using `main` and this `refactor-torch-formatter` branch. I've included the two scripts and output when running on a local machine. ```python # /// script # requires-python = ">=3.10" # dependencies = [ # "torch", # "datasets", # "pillow", # ] # # [tool.uv.sources] # datasets = { git = "https://github.com/huggingface/datasets.git" } # /// import time import random import numpy as np from PIL import Image from datasets import Dataset, load_dataset import torch def create_mock_images_dataset(num_samples=5000): """Create a deterministic mock dataset with PIL images.""" random.seed(42) np.random.seed(42) images = [] labels = [] for i in range(num_samples): # Create deterministic RGB image width, height = 64, 64 rgb_array = np.random.randint(0, 256, (height, width, 3), dtype=np.uint8) image = Image.fromarray(rgb_array) images.append(image) labels.append(i % 10) # 10 classes return Dataset.from_dict({"image": images, "label": labels}) def create_mock_text_dataset(num_samples=5000): """Create a deterministic mock dataset with text.""" random.seed(42) words = ["apple", "banana", "cherry", "date", "elderberry", "fig", "grape", "honeydew"] texts = [] labels = [] for i in range(num_samples): # Create deterministic text text_length = 5 + (i % 20) # 5-24 words text = " ".join(random.choices(words, k=text_length)) texts.append(text) labels.append(i % 3) # 3 classes return Dataset.from_dict({"text": texts, "label": labels}) def create_mock_ints_dataset(num_samples=5000): """Create a deterministic mock dataset with integers.""" random.seed(42) data = [] labels = [] for i in range(num_samples): # Create deterministic integer arrays arr = [random.randint(0, 1000) for _ in range(50)] # 50 integers each data.append(arr) labels.append(i % 5) # 5 classes return Dataset.from_dict({"data": data, "label": labels}) def create_mock_floats_dataset(num_samples=5000): """Create a deterministic mock dataset with floats.""" random.seed(42) data = [] labels = [] for i in range(num_samples): # Create deterministic float arrays arr = [random.uniform(0.0, 100.0) for _ in range(30)] # 30 floats each data.append(arr) labels.append(i % 4) # 4 classes return Dataset.from_dict({"data": data, "label": labels}) def benchmark_dataset(name, dataset, num_samples=1000): """Benchmark dataset access speed.""" print(f"\n=== {name} Dataset Benchmark ===") t0 = time.time() dataset.set_format(type="torch") # identity map with small batches dataset = dataset.map(lambda x: x, batched=True, batch_size=20) # force materialization data = dataset[:num_samples] print(f"Keys: {list(data.keys())}") print(f"Sample count: {len(data[list(data.keys())[0]])}") t1 = time.time() print(f"Duration: {t1 - t0:.2f} s") print(f"Speed: {num_samples / (t1 - t0):.1f} samples/s") def main(): # PIL Images benchmark images_dataset = create_mock_images_dataset() benchmark_dataset("PIL Images", images_dataset) # Text benchmark text_dataset = create_mock_text_dataset() benchmark_dataset("Text", text_dataset) # Integers benchmark ints_dataset = create_mock_ints_dataset() benchmark_dataset("Integers", ints_dataset) # Floats benchmark floats_dataset = create_mock_floats_dataset() benchmark_dataset("Floats", floats_dataset) if __name__ == "__main__": main() ``` output ```bash uv run --refresh example1.py ``` ```text === PIL Images Dataset Benchmark === Map: 0%| | 0/5000 [00:00<?, ? examples/s]/Users/drbh/.cache/uv/environments-v2/example1-2aca1a30e84bdead/lib/python3.10/site-packages/datasets/features/image.py:352: UserWarning: Downcasting array dtype int64 to uint8 to be compatible with 'Pillow' warnings.warn(f"Downcasting array dtype {dtype} to {dest_dtype} to be compatible with 'Pillow'") Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:01<00:00, 3669.15 examples/s] Keys: ['image', 'label'] Sample count: 1000 Duration: 2.14 s Speed: 466.5 samples/s === Text Dataset Benchmark === Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:00<00:00, 141327.04 examples/s] Keys: ['text', 'label'] Sample count: 1000 Duration: 0.04 s Speed: 27004.3 samples/s === Integers Dataset Benchmark === Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:00<00:00, 112904.90 examples/s] Keys: ['data', 'label'] Sample count: 1000 Duration: 0.05 s Speed: 21680.6 samples/s === Floats Dataset Benchmark === Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:00<00:00, 104084.25 examples/s] Keys: ['data', 'label'] Sample count: 1000 Duration: 0.05 s Speed: 20215.1 samples/s ``` and this branch specifically ```python # /// script # requires-python = ">=3.10" # dependencies = [ # "torch", # "datasets", # "pillow", # ] # # [tool.uv.sources] # datasets = { git = "https://github.com/huggingface/datasets.git", rev = "refactor-torch-formatter" } # /// import time import random import numpy as np from PIL import Image from datasets import Dataset, load_dataset import torch def create_mock_images_dataset(num_samples=5000): """Create a deterministic mock dataset with PIL images.""" random.seed(42) np.random.seed(42) images = [] labels = [] for i in range(num_samples): # Create deterministic RGB image width, height = 64, 64 rgb_array = np.random.randint(0, 256, (height, width, 3), dtype=np.uint8) image = Image.fromarray(rgb_array) images.append(image) labels.append(i % 10) # 10 classes return Dataset.from_dict({"image": images, "label": labels}) def create_mock_text_dataset(num_samples=5000): """Create a deterministic mock dataset with text.""" random.seed(42) words = [ "apple", "banana", "cherry", "date", "elderberry", "fig", "grape", "honeydew", ] texts = [] labels = [] for i in range(num_samples): # Create deterministic text text_length = 5 + (i % 20) # 5-24 words text = " ".join(random.choices(words, k=text_length)) texts.append(text) labels.append(i % 3) # 3 classes return Dataset.from_dict({"text": texts, "label": labels}) def create_mock_ints_dataset(num_samples=5000): """Create a deterministic mock dataset with integers.""" random.seed(42) data = [] labels = [] for i in range(num_samples): # Create deterministic integer arrays arr = [random.randint(0, 1000) for _ in range(50)] # 50 integers each data.append(arr) labels.append(i % 5) # 5 classes return Dataset.from_dict({"data": data, "label": labels}) def create_mock_floats_dataset(num_samples=5000): """Create a deterministic mock dataset with floats.""" random.seed(42) data = [] labels = [] for i in range(num_samples): # Create deterministic float arrays arr = [random.uniform(0.0, 100.0) for _ in range(30)] # 30 floats each data.append(arr) labels.append(i % 4) # 4 classes return Dataset.from_dict({"data": data, "label": labels}) def benchmark_dataset(name, dataset, num_samples=1000): """Benchmark dataset access speed.""" print(f"\n=== {name} Dataset Benchmark ===") t0 = time.time() dataset.set_format(type="torch") # identity map with small batches dataset = dataset.map(lambda x: x, batched=True, batch_size=20) # force materialization data = dataset[:num_samples] print(f"Keys: {list(data.keys())}") print(f"Sample count: {len(data[list(data.keys())[0]])}") t1 = time.time() print(f"Duration: {t1 - t0:.2f} s") print(f"Speed: {num_samples / (t1 - t0):.1f} samples/s") def main(): # PIL Images benchmark images_dataset = create_mock_images_dataset() benchmark_dataset("PIL Images", images_dataset) # Text benchmark text_dataset = create_mock_text_dataset() benchmark_dataset("Text", text_dataset) # Integers benchmark ints_dataset = create_mock_ints_dataset() benchmark_dataset("Integers", ints_dataset) # Floats benchmark floats_dataset = create_mock_floats_dataset() benchmark_dataset("Floats", floats_dataset) if __name__ == "__main__": main() ``` ```bash uv run --refresh example2.py ``` ```text Updated https://github.com/huggingface/datasets.git (2cb64d1b6503afb49d822b20979760efe4519d03) Built datasets @ git+https://github.com/huggingface/datasets.git@2cb64d1b6503afb49d822b20979760efe Uninstalled 1 package in 20ms Installed 1 package in 5ms === PIL Images Dataset Benchmark === Map: 0%| | 0/5000 [00:00<?, ? examples/s]/Users/drbh/.cache/uv/environments-v2/example2-d4af608668b706ec/lib/python3.10/site-packages/datasets/features/image.py:352: UserWarning: Downcasting array dtype int64 to uint8 to be compatible with 'Pillow' warnings.warn(f"Downcasting array dtype {dtype} to {dest_dtype} to be compatible with 'Pillow'") Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:01<00:00, 3645.14 examples/s] Keys: ['image', 'label'] Sample count: 1000 Duration: 2.04 s Speed: 491.2 samples/s === Text Dataset Benchmark === Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:00<00:00, 169877.28 examples/s] Keys: ['text', 'label'] Sample count: 1000 Duration: 0.03 s Speed: 32236.1 samples/s === Integers Dataset Benchmark === Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:00<00:00, 131940.33 examples/s] Keys: ['data', 'label'] Sample count: 1000 Duration: 0.04 s Speed: 25493.3 samples/s === Floats Dataset Benchmark === Map: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 5000/5000 [00:00<00:00, 120621.64 examples/s] Keys: ['data', 'label'] Sample count: 1000 Duration: 0.04 s Speed: 23370.6 samples/s ```
drbh
https://github.com/huggingface/datasets/pull/7787
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7787", "html_url": "https://github.com/huggingface/datasets/pull/7787", "diff_url": "https://github.com/huggingface/datasets/pull/7787.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7787.patch", "merged_at": "2025-09-26T15:04:23" }
true
3,448,506,148
7,786
Sample without replacement option when interleaving datasets
open
[ "@lhoestq Continuing on the idea from https://github.com/huggingface/datasets/issues/217 \r\nThis doesn't add a new stopping criteria, but a new argument to interleave_datasets method. Let me know what you think and if you see a better way of doing this I'm open to suggestions.", "Great ! this is a cool additions :)\r\n\r\nIMO sample_with_replacement as a new argument doesn't make sense if the strategy is \"first_exhausted\", which is the default, and since disabling replacement affects the stopping strategy, I would be in favor of having it as a new strategy instead", "Makes sense, here's a revised implementation with that argument removed and adding a new stopping strategy.", "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7786). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.", "@lhoestq Let me know if there's anything on my side that I can do!", "Hi @radulescupetru, I'm commenting here after @lhoestq mentioned this PR in #7792. I'm facing a similar problem and I was wondering if there was a common a solution. Let me know if we share the same problem.\r\n\r\nAs described in the issue, my problem is that I want to mix unbalanced datasets, distribute the samples on multiple workers and ranks, without repeating samples and while retrieving most samples as I can (i.e. without discarding samples whenever they could actually be used). I also noticed that the current approaches `interleave_dataset` or `concatenate_dataset` do not leverage all the workers if the number of shards do not align with the number of workers.", "I pushed a small update @radulescupetru related to @LTMeyer 's issue, I hope you don't mind.\r\n\r\nThe logic looks all good to me now :) could you also update `_interleave_map_style_datasets()` in `arrow_dataset.py` before we merge ? This way the `Dataset` objects will also benefit from this new stopping strategy.", "@lhoestq Thanks for that fix. I've pushed updates to support the new stopping strategy for map style datasets as well." ]
2025-09-24T09:18:14
2025-10-03T08:54:10
null
Right now, `interleave_datasets` function with probabilities will sample with replacement. The PR adds the ability to sample without replacement. ``` import datasets # Create datasets of different sizes to test exhaustion data_a = [{"value": i, "source": "A"} for i in range(5)] data_b = [{"value": i, "source": "B"} for i in range(10, 15)] ds_a = datasets.Dataset.from_list(data_a).to_iterable_dataset() ds_b = datasets.Dataset.from_list(data_b).to_iterable_dataset() # Interleave with probabilities ds_interleaved = datasets.interleave_datasets( [ds_a, ds_b], probabilities=[0.6, 0.4], seed=42, stopping_strategy="all_exhausted", sample_with_replacement=True, ) for i, example in enumerate(ds_interleaved): print(f"Sample:{i}: value:{example['value']:02d} source:{example['source']}") ``` In this example, `sample_with_replacement=True` and it prints: ``` Sample:0: value:10 source:B Sample:1: value:00 source:A Sample:2: value:11 source:B Sample:3: value:12 source:B Sample:4: value:01 source:A Sample:5: value:13 source:B Sample:6: value:14 source:B Sample:7: value:10 source:B Sample:8: value:02 source:A Sample:9: value:03 source:A Sample:10: value:04 source:A ``` Note that sample with value:10 source: B is sampled twice (Sample:0 and Sample:7) Re-running with `sample_with_replacement=False` in prints: ``` Sample:0: value:10 source:B Sample:1: value:00 source:A Sample:2: value:11 source:B Sample:3: value:12 source:B Sample:4: value:01 source:A Sample:5: value:13 source:B Sample:6: value:14 source:B Sample:7: value:02 source:A Sample:8: value:03 source:A Sample:9: value:04 source:A ``` Note that we don't see any repeated items.
radulescupetru
https://github.com/huggingface/datasets/pull/7786
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7786", "html_url": "https://github.com/huggingface/datasets/pull/7786", "diff_url": "https://github.com/huggingface/datasets/pull/7786.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7786.patch", "merged_at": null }
true
3,439,897,018
7,785
Fix Audio docstring by removing unsupported mono argument
open
[ "I think we can keep the arg and add the missing torch.mean() in the Audio.decode_example method", "> I think we can keep the arg and add the missing torch.mean() in the Audio.decode_example method\r\n\r\nThank you @lhoestq. I will add torch.mean()." ]
2025-09-22T09:06:52
2025-09-23T09:57:37
null
This PR fixes issue #7745. Who can review: @lhoestq
tanuj-rai
https://github.com/huggingface/datasets/pull/7785
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7785", "html_url": "https://github.com/huggingface/datasets/pull/7785", "diff_url": "https://github.com/huggingface/datasets/pull/7785.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7785.patch", "merged_at": null }
true
3,430,715,779
7,783
Support huggingface_hub v0.x and v1.x
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7783). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.", "@lhoestq could you have a look at this PR please? It makes `datasets` compatible with the upcoming `huggingface_hub` v1.0 release while staying compatible with 0.x. Look at PR description for more details.\r\n\r\nThe CI is currently failing because of 429 rate limit errors but otherwise everything should be fine (made extensive local and ci tests to ensure that). Let me know if you notice anything weird. PR is ready to be merged \"as-is\" in my opinion." ]
2025-09-18T14:45:20
2025-10-01T13:56:05
2025-10-01T13:56:03
Related to https://github.com/huggingface/huggingface_hub/issues/3340. This PR adapts `datasets` to be compatible with both huggingface_hub v0.x and v1.x. In practice nothing else should change (I've checked the codebase). The `HfHubHTTPError` is a base error defined in `huggingface_hub` that inherits from `requests.HTTPError` in v0.x and will inherit from `httpx.HTTPError` in v1.x. It has been introduced ~2 years ago so it's fine to use it right now (i.e. no need to wait for v1.x release or bump minimal version). Most of the changes have been around the test suite to make sure that tests are passing with both `requests` and `httpx` backends. Mid-term it would be good to completely remove the `requests` dependency from `datasets` but that's an orthogonal topic.
Wauplin
https://github.com/huggingface/datasets/pull/7783
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7783", "html_url": "https://github.com/huggingface/datasets/pull/7783", "diff_url": "https://github.com/huggingface/datasets/pull/7783.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7783.patch", "merged_at": "2025-10-01T13:56:03" }
true
3,430,341,875
7,782
set dev version
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7782). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-09-18T13:15:56
2025-09-18T13:20:03
2025-09-18T13:16:04
null
lhoestq
https://github.com/huggingface/datasets/pull/7782
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7782", "html_url": "https://github.com/huggingface/datasets/pull/7782", "diff_url": "https://github.com/huggingface/datasets/pull/7782.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7782.patch", "merged_at": "2025-09-18T13:16:04" }
true
3,430,332,841
7,781
release: 4.1.1
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7781). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-09-18T13:13:47
2025-09-18T13:16:48
2025-09-18T13:14:47
null
lhoestq
https://github.com/huggingface/datasets/pull/7781
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7781", "html_url": "https://github.com/huggingface/datasets/pull/7781", "diff_url": "https://github.com/huggingface/datasets/pull/7781.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7781.patch", "merged_at": "2025-09-18T13:14:47" }
true
3,429,267,259
7,780
BIGPATENT dataset inaccessible (deprecated script loader)
closed
[ "Hi ! I opened https://huggingface.co/datasets/NortheasternUniversity/big_patent/discussions/7 to update the dataset, hopefully it's merged soon !", "The dataset now works with `datasets` v4 ! closing this issue" ]
2025-09-18T08:25:34
2025-09-25T14:36:13
2025-09-25T14:36:13
dataset: https://huggingface.co/datasets/NortheasternUniversity/big_patent When I try to load it with the datasets library, it fails with: RuntimeError: Dataset scripts are no longer supported, but found big_patent.py Could you please publish a Parquet/Arrow export of BIGPATENT on the Hugging Face so that it can be accessed with datasets>=4.x.
ishmaifan
https://github.com/huggingface/datasets/issues/7780
null
false
3,427,108,011
7,779
fix empty dataset to_parquet
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7779). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-09-17T17:03:56
2025-09-17T17:07:35
2025-09-17T17:04:32
null
lhoestq
https://github.com/huggingface/datasets/pull/7779
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7779", "html_url": "https://github.com/huggingface/datasets/pull/7779", "diff_url": "https://github.com/huggingface/datasets/pull/7779.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7779.patch", "merged_at": "2025-09-17T17:04:32" }
true
3,425,917,119
7,778
[FIX] force spawning pool for MacOS
open
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7778). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.", "After more discussions on slack, we can switch the default to spawn.\r\n\r\nLet's use multiprocess instead of multiprocessing and maybe add a check to apply this only on Macos ?" ]
2025-09-17T11:38:38
2025-09-18T17:04:45
null
This PR gets multiprocessing to work on mac os: ```python from datasets import load_dataset ds = load_dataset("fka/awesome-chatgpt-prompts", split="train").take(100) ds = ds.map(lambda x: x, num_proc=4) ds.push_to_hub("burtenshaw/dataset-test", num_proc=4) ```
burtenshaw
https://github.com/huggingface/datasets/pull/7778
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7778", "html_url": "https://github.com/huggingface/datasets/pull/7778", "diff_url": "https://github.com/huggingface/datasets/pull/7778.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7778.patch", "merged_at": null }
true
3,424,462,082
7,777
push_to_hub not overwriting but stuck in a loop when there are existing commits
closed
[ "HTTP 412 means a commit happened in the meantime, so `get_deletions_and_dataset_card` has to retry to get the latest version of the dataset card and what files to delete based on the latest version of the dataset repository\n\nAre you running other operations in the dataset repo for your push_to_hub ?", "There was only a map() followed by a push_to_hub(). The repo had one prior commit also by using push_to_hub(). The error disappeared when I downgraded datasets to 4.0.0.", "It is reproducible if you use finegrained token with Read+Write (Open pull request) access to only that repo.", "Ah it was due to the use of requests_cache with POST methods, closing this. " ]
2025-09-17T03:15:35
2025-09-17T19:31:14
2025-09-17T19:31:14
### Describe the bug `get_deletions_and_dataset_card` stuck at error a commit has happened error since push to hub for http error 412 for tag 4.1.0. The error does not exists in 4.0.0. ### Steps to reproduce the bug Create code to use push_to_hub, ran twice each time with different content for datasets.Dataset. The code will stuck in time.sleep loop for `get_deletions_and_dataset_card`. If error is explicitly printed, the error is HTTP 412. ### Expected behavior New datasets overwrite existing one on repo. ### Environment info datasets 4.1.0
Darejkal
https://github.com/huggingface/datasets/issues/7777
null
false
3,420,364,069
7,776
[docs] Fix broken WebDataset link on β€œCreate a video dataset” page
closed
[]
2025-09-16T04:49:32
2025-09-27T12:03:49
2025-09-27T12:03:49
### What Fix the "WebDataset documentation" link on the Create a video dataset page to point to the correct section on the video load guide. ### Why The link currently points to an external repo, but the Hugging Face docs have an internal "WebDataset" section under video_load. ### How - docs/source/video_dataset.mdx: updated link to `https://huggingface.co/docs/datasets/main/en/video_load#webdataset` ### Issue Fixes #7699
Username46786
https://github.com/huggingface/datasets/pull/7776
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7776", "html_url": "https://github.com/huggingface/datasets/pull/7776", "diff_url": "https://github.com/huggingface/datasets/pull/7776.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7776.patch", "merged_at": null }
true
3,418,859,494
7,775
fix iterate nested field
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7775). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-09-15T17:28:34
2025-09-15T17:31:14
2025-09-15T17:28:42
null
lhoestq
https://github.com/huggingface/datasets/pull/7775
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7775", "html_url": "https://github.com/huggingface/datasets/pull/7775", "diff_url": "https://github.com/huggingface/datasets/pull/7775.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7775.patch", "merged_at": "2025-09-15T17:28:42" }
true
3,418,712,977
7,774
Set dev version
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7774). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-09-15T16:42:33
2025-09-15T16:45:16
2025-09-15T16:42:47
null
lhoestq
https://github.com/huggingface/datasets/pull/7774
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7774", "html_url": "https://github.com/huggingface/datasets/pull/7774", "diff_url": "https://github.com/huggingface/datasets/pull/7774.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7774.patch", "merged_at": "2025-09-15T16:42:47" }
true
3,418,672,306
7,773
Release: 4.1.0
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7773). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-09-15T16:30:37
2025-09-15T16:33:40
2025-09-15T16:33:39
null
lhoestq
https://github.com/huggingface/datasets/pull/7773
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7773", "html_url": "https://github.com/huggingface/datasets/pull/7773", "diff_url": "https://github.com/huggingface/datasets/pull/7773.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7773.patch", "merged_at": "2025-09-15T16:33:39" }
true
3,417,353,751
7,772
Error processing scalar columns using tensorflow.
open
[ "Using tf.convert_to_tensor works fine:\n\n```\nimport tensorflow as tf\n\nstart_pos = tf.convert_to_tensor(train_ds['start_positions'], dtype=tf.int64)\nstart_pos = tf.reshape(start_pos, [-1, 1])\n```\n\n\nAlternatively, using the built-in to_tf_dataset also avoids the issue:\n\n```\ntrain_tf = train_ds.to_tf_dataset(\n columns=['input_ids','attention_mask'],\n label_cols=['start_positions','end_positions'],\n shuffle=True,\n batch_size=32\n)\n```", "```\n start_pos = tf.convert_to_tensor(self._train_ds['start_positions'], dtype=tf.int64)\n File \"/home/khteh/.local/share/virtualenvs/pAIthon-GaqEDHQT/lib/python3.13/site-packages/tensorflow/python/util/traceback_utils.py\", line 153, in error_handler\n raise e.with_traceback(filtered_tb) from None\n File \"/home/khteh/.local/share/virtualenvs/pAIthon-GaqEDHQT/lib/python3.13/site-packages/tensorflow/python/framework/constant_op.py\", line 108, in convert_to_eager_tensor\n return ops.EagerTensor(value, ctx.device_name, dtype)\n ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nValueError: TypeError: Scalar tensor has no `len()`\nTraceback (most recent call last):\n\n File \"/home/khteh/.local/share/virtualenvs/pAIthon-GaqEDHQT/lib/python3.13/site-packages/tensorflow/python/framework/ops.py\", line 361, in __len__\n raise TypeError(\"Scalar tensor has no `len()`\")\n\nTypeError: Scalar tensor has no `len()`\n```\n\n`to_tf_dataset` works perfectly." ]
2025-09-15T10:36:31
2025-09-27T08:22:44
null
`datasets==4.0.0` ``` columns_to_return = ['input_ids','attention_mask', 'start_positions', 'end_positions'] train_ds.set_format(type='tf', columns=columns_to_return) ``` `train_ds`: ``` train_ds type: <class 'datasets.arrow_dataset.Dataset'>, shape: (1000, 9) columns: ['question', 'sentences', 'answer', 'str_idx', 'end_idx', 'input_ids', 'attention_mask', 'start_positions', 'end_positions'] features:{'question': Value('string'), 'sentences': Value('string'), 'answer': Value('string'), 'str_idx': Value('int64'), 'end_idx': Value('int64'), 'input_ids': List(Value('int32')), 'attention_mask': List(Value('int8')), 'start_positions': Value('int64'), 'end_positions': Value('int64')} ``` `train_ds_tensor = train_ds['start_positions'].to_tensor(shape=(-1,1))` hits the following error: ``` AttributeError: 'Column' object has no attribute 'to_tensor' ``` `tf.reshape(train_ds['start_positions'], shape=[-1,1])` hits the following error: ``` TypeError: Scalar tensor has no `len()` ```
khteh
https://github.com/huggingface/datasets/issues/7772
null
false
3,414,655,424
7,771
Add support for arrow iterable when concatenating or interleaving
closed
[ "Seeing the following numbers on the script shared in the original issue. (MacBook Pro M4)\r\n\r\n```\r\n1000it [00:00, 4074.63it/s] # ds_a.with_format(\"torch\")\r\n1000it [00:01, 593.39it/s] # ds_a.shuffle()\r\n1999it [00:03, 594.09it/s] # datasets.interleave_datasets([ds_a, ds_b])\r\n1000it [00:00, 5382.45it/s] # ds_a.shuffle().with_format(\"torch\") <--- Was slow <2it/s\r\n1999it [00:00, 4743.45it/s] # datasets.interleave_datasets([ds_a, ds_b]).with_format(\"torch\") <--- Was slow <2it/s\r\n1999it [00:20, 98.94it/s] # torch.tensor(example[\"tensor\"])\r\n```\r\n", "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7771). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.", "@lhoestq I've implemented the iteration on arrow as separate methods, can you take another look/trigger ci? ", "@lhoestq Any idea why the integration tests are failing, is this expected? Anything I can do on my side?", "They seem unrelated to your changes. Merging :)" ]
2025-09-14T06:40:50
2025-09-17T16:51:28
2025-09-17T16:51:28
Fixes a case when concatenating or interleaving datasets with `with_format(...)` call was slower. Details here: https://github.com/huggingface/datasets/issues/6637 @lhoestq I tried to minimize the duplication between iter and iter_arrow methods, not sure if this is against the design, can separate those if needed.
radulescupetru
https://github.com/huggingface/datasets/pull/7771
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7771", "html_url": "https://github.com/huggingface/datasets/pull/7771", "diff_url": "https://github.com/huggingface/datasets/pull/7771.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7771.patch", "merged_at": "2025-09-17T16:51:27" }
true
3,413,892,226
7,770
Fix: Correct float feature generation in `generate_examples`
open
[ "Hi @lhoestq, just a gentle follow-up on this PR." ]
2025-09-13T17:37:09
2025-09-28T12:43:04
null
This PR fixes a bug in the `generate_examples` function where `datasets.Value` features with a `float` dtype were incorrectly generated using `np.random.randint`. This resulted in integer values being cast to float, which is not representative of true floating-point data. **Key changes include:** * Added explicit handling for `float` features using `np.random.rand` to generate continuous values. * Introduced fail-fast type checks for unsupported dtypes to improve robustness. * Added validation for sequence features to ensure `seq_shapes` is provided. ### Before Fix Float features were generated incorrectly as integers cast to float: ```text - Example 0: - int_feature: 0 - float_feature: 9.0 <-- Incorrect: An integer disguised as a float - string_feature: The small grey turtle was surprisingly fast... - seq_feature: [0.3048 0.4291 0.4283] ``` ### After Fix Float features are now correctly generated as continuous numbers in the range [0, 1): ```text + Example 0: + int_feature: 0 + float_feature: 0.0183 <-- Correct: A true random float + string_feature: The small grey turtle was surprisingly fast... + seq_feature: [0.9237 0.7972 0.8526] ``` #### Note: This PR is a follow-up/fix of the previously closed PR #7769 for clarity and context.
Sanjaykumar030
https://github.com/huggingface/datasets/pull/7770
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7770", "html_url": "https://github.com/huggingface/datasets/pull/7770", "diff_url": "https://github.com/huggingface/datasets/pull/7770.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7770.patch", "merged_at": null }
true
3,413,868,583
7,769
Fix: Correct float feature generation in `generate_examples`
closed
[]
2025-09-13T17:19:36
2025-09-13T17:30:15
2025-09-13T17:30:15
This PR fixes a bug in the `generate_examples` function where `datasets.Value` features with a `float` dtype were incorrectly generated using `np.random.randint`. This resulted in integer values being cast to float, which is not representative of true floating-point data. **Key changes include:** 1. Added explicit handling for float features using `np.random.rand` to generate continuous values. 2. Introduced fail-fast type checks for unsupported dtypes to improve robustness. 3. Added validation for sequence features to ensure `seq_shapes` is provided. ### Before Fix Float features were generated incorrectly as integers cast to float: ```text Example 0: int_feature: 0 float_feature: 9.0 <-- Incorrect: An integer disguised as a float string_feature: The small grey turtle was surprisingly fast... seq_feature: [0.3048 0.4291 0.4283] ``` ### After Fix Float features are now correctly generated as continuous numbers in the range [0, 1): ```text Example 0: int_feature: 0 float_feature: 0.0183 <-- Correct: A true random float string_feature: The small grey turtle was surprisingly fast... seq_feature: [0.9237 0.7972 0.8526]
Sanjaykumar030
https://github.com/huggingface/datasets/pull/7769
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7769", "html_url": "https://github.com/huggingface/datasets/pull/7769", "diff_url": "https://github.com/huggingface/datasets/pull/7769.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7769.patch", "merged_at": null }
true
3,413,755,917
7,768
Custom `dl_manager` in `load_dataset`
open
[]
2025-09-13T16:09:45
2025-09-13T16:09:45
null
Fix #7767
ain-soph
https://github.com/huggingface/datasets/pull/7768
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7768", "html_url": "https://github.com/huggingface/datasets/pull/7768", "diff_url": "https://github.com/huggingface/datasets/pull/7768.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7768.patch", "merged_at": null }
true
3,411,654,444
7,767
Custom `dl_manager` in `load_dataset`
open
[]
2025-09-12T19:06:23
2025-09-12T19:07:52
null
### Feature request https://github.com/huggingface/datasets/blob/4.0.0/src/datasets/load.py#L1411-L1418 ``` def load_dataset( ... dl_manager: Optional[DownloadManager] = None, # add this new argument **config_kwargs, ) -> Union[DatasetDict, Dataset, IterableDatasetDict, IterableDataset]: ... # Create a dataset builder builder_instance = load_dataset_builder( path=path, name=name, data_dir=data_dir, data_files=data_files, cache_dir=cache_dir, features=features, download_config=download_config, download_mode=download_mode, revision=revision, token=token, storage_options=storage_options, **config_kwargs, ) # Return iterable dataset in case of streaming if streaming: return builder_instance.as_streaming_dataset(split=split) # Note: This is the revised part if dl_manager is None: if download_config is None: download_config = DownloadConfig( cache_dir=builder_instance._cache_downloaded_dir, force_download=download_mode == DownloadMode.FORCE_REDOWNLOAD, force_extract=download_mode == DownloadMode.FORCE_REDOWNLOAD, use_etag=False, num_proc=num_proc, token=builder_instance.token, storage_options=builder_instance.storage_options, ) # We don't use etag for data files to speed up the process dl_manager = DownloadManager( dataset_name=builder_instance.dataset_name, download_config=download_config, data_dir=builder_instance.config.data_dir, record_checksums=( builder_instance._record_infos or verification_mode == VerificationMode.ALL_CHECKS ), ) # Download and prepare data builder_instance.download_and_prepare( download_config=download_config, download_mode=download_mode, verification_mode=verification_mode, dl_manager=dl_manager, # pass the new argument num_proc=num_proc, storage_options=storage_options, ) ... ``` ### Motivation In my case, I'm hoping to deal with the cache files downloading manually (not using hash filenames and save to another location, or using potential existing local files). ### Your contribution It's already implemented above. If maintainers think this should be considered, I'll open a PR.
ain-soph
https://github.com/huggingface/datasets/issues/7767
null
false
3,411,611,165
7,766
cast columns to Image/Audio/Video with `storage_options`
open
[ "A", "1", "1", "Ok", "> ### Feature request\n> Allow `storage_options` to be passed in\n> \n> 1. `cast` related operations (e.g., `cast_columns, cast`)\n> 2. `info` related reading (e.g., `from_dict, from_pandas, from_polars`) together with `info.features`\n> \n> import datasets\n> \n> image_path = \"s3://bucket/sample.png\"\n> dataset = datasets.Dataset.from_dict({\"image_path\": [image_path]})\n> \n> # dataset = dataset.cast_column(\"image_path\", datasets.Image()) # now works without `storage_options`\n> \n> # expected behavior\n> dataset = dataset.cast_column(\"image_path\", datasets.Image(), storage_options={\"anon\": True})\n> ### Motivation\n> I'm using my own registered fsspec filesystem (s3 with customized local cache support). I need to pass cache folder paths `cache_dirs: list[str]` to the filesystem when I read the remote images (cast from file_paths).\n> \n> ### Your contribution\n> Could help with a PR at weekends\n\n\n\n>" ]
2025-09-12T18:51:01
2025-09-27T08:14:47
null
### Feature request Allow `storage_options` to be passed in 1. `cast` related operations (e.g., `cast_columns, cast`) 2. `info` related reading (e.g., `from_dict, from_pandas, from_polars`) together with `info.features` ```python3 import datasets image_path = "s3://bucket/sample.png" dataset = datasets.Dataset.from_dict({"image_path": [image_path]}) # dataset = dataset.cast_column("image_path", datasets.Image()) # now works without `storage_options` # expected behavior dataset = dataset.cast_column("image_path", datasets.Image(), storage_options={"anon": True}) ``` ### Motivation I'm using my own registered fsspec filesystem (s3 with customized local cache support). I need to pass cache folder paths `cache_dirs: list[str]` to the filesystem when I read the remote images (cast from file_paths). ### Your contribution Could help with a PR at weekends
ain-soph
https://github.com/huggingface/datasets/issues/7766
null
false
3,411,556,378
7,765
polars dataset cannot cast column to Image/Audio/Video
open
[ "I fixed this with a combination of `to_dict` and `from_dict`:\n\n```py\ndatasets.Dataset.from_dict(df.to_dict(as_series=False))\n```", "@samuelstevens Yeah, I'm using similar workaround as well. But it would be ideal if we can avoid the copy." ]
2025-09-12T18:32:49
2025-09-16T01:33:31
null
### Describe the bug `from_polars` dataset cannot cast column to Image/Audio/Video, while it works on `from_pandas` and `from_dict` ### Steps to reproduce the bug ```python3 import datasets import pandas as pd import polars as pl image_path = "./sample.png" # polars df = pl.DataFrame({"image_path": [image_path]}) dataset = datasets.Dataset.from_polars(df) dataset = dataset.cast_column("image_path", datasets.Image()) # # raises Error pyarrow.lib.ArrowNotImplementedError: Unsupported cast from large_string to struct using function cast_struct # pandas df = pd.DataFrame({"image_path": [image_path]}) dataset = datasets.Dataset.from_pandas(df) dataset = dataset.cast_column("image_path", datasets.Image()) # # pass {'image_path': <PIL.PngImagePlugin.PngImageFile image mode=RGB size=338x277 at 0x7FBA719D4050>} # dict dataset = datasets.Dataset.from_dict({"image_path": [image_path]}) dataset = dataset.cast_column("image_path", datasets.Image()) # # pass {'image_path': <PIL.PngImagePlugin.PngImageFile image mode=RGB size=338x277 at 0x7FBA719D4050>} ``` ### Expected behavior `from_polars` case shouldn't raise error and have the same outputs as `from_pandas` and `from_dict` ### Environment info ``` # Name Version Build Channel datasets 4.0.0 pypi_0 pypi pandas 2.3.1 pypi_0 pypi polars 1.32.3 pypi_0 pypi ```
ain-soph
https://github.com/huggingface/datasets/issues/7765
null
false
3,410,722,819
7,764
update torchcodec in ci
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7764). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-09-12T14:26:42
2025-09-12T15:56:16
2025-09-12T15:56:14
before the release, to make sure everything works fine
lhoestq
https://github.com/huggingface/datasets/pull/7764
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7764", "html_url": "https://github.com/huggingface/datasets/pull/7764", "diff_url": "https://github.com/huggingface/datasets/pull/7764.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7764.patch", "merged_at": "2025-09-12T15:56:14" }
true
3,407,833,429
7,763
Bump dill to 0.4.0
closed
[ "Have you tried to run `pytest tests/test_fingerprint.py` ? It seems dill 0.3.9 breaks a lot of tests\r\n\r\n```\r\nFAILED tests/test_fingerprint.py::TokenizersHashTest::test_hash_regex - NameError: name 'log' is not defined\r\nFAILED tests/test_fingerprint.py::TokenizersHashTest::test_hash_tokenizer - NameError: name 'log' is not defined\r\nFAILED tests/test_fingerprint.py::TokenizersHashTest::test_hash_tokenizer_with_cache - NameError: name 'log' is not defined\r\nFAILED tests/test_fingerprint.py::RecurseHashTest::test_hash_ignores_line_definition_of_function - AssertionError: 'c48ebfacf8768f50' != '27e49d047c02c83b'\r\nFAILED tests/test_fingerprint.py::RecurseHashTest::test_hash_ipython_function - AssertionError: '65edc6b6d425a8e9' != '9f364fe298fb286a'\r\nFAILED tests/test_fingerprint.py::HashingTest::test_hash_tiktoken_encoding - NameError: name 'log' is not defined\r\nFAILED tests/test_fingerprint.py::HashingTest::test_hash_torch_compiled_module - NameError: name 'log' is not defined\r\nFAILED tests/test_fingerprint.py::HashingTest::test_hash_torch_generator - NameError: name 'log' is not defined\r\nFAILED tests/test_fingerprint.py::HashingTest::test_hash_torch_tensor - NameError: name 'log' is not defined\r\nFAILED tests/test_fingerprint.py::HashingTest::test_set_doesnt_depend_on_order - NameError: name 'log' is not defined\r\nFAILED tests/test_fingerprint.py::HashingTest::test_set_stable - NameError: name 'log' is not defined\r\nFAILED tests/test_fingerprint.py::test_move_script_doesnt_change_hash - AssertionError: assert b'93072ca404a697db\\n' == b'cf89a7e497a97e32\\n'\r\n```", "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7763). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.", "Hi @lhoestq! Yes, I did. It's not really `dill` that breaks things. Rather the shims that `datasets` has in place did not include the next version. \n\nFYI: I also tested it with `dill-0.4.0` and the changes would need to be analogous, but I wanted to be conservative in this PR. ", "The NameError is fixed in your PR since it defines the right `log()` function for 0.3.9.\r\n\r\nBut I'm less sure about the AssertionError that may be related to deterministic hashing or ipython/shell function hashing. We would need to solve these\r\n\r\nEDIT: ah actually it does ! cool ! let me update the branch and re-run the CI" ]
2025-09-11T19:43:16
2025-09-15T08:37:48
2025-09-15T08:37:48
This bumps `dill` to 0.3.9 and closes #7510 It turns out the only thing required to make the tests pass was to extend the version checks to include 0.3.9.
Bomme
https://github.com/huggingface/datasets/pull/7763
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7763", "html_url": "https://github.com/huggingface/datasets/pull/7763", "diff_url": "https://github.com/huggingface/datasets/pull/7763.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7763.patch", "merged_at": "2025-09-15T08:37:48" }
true
3,406,885,775
7,762
Parquet: use data page v2 for efficient page pruning
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7762). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.", "Closing this since it looks like the page offset index is enough :)" ]
2025-09-11T14:42:22
2025-09-11T15:24:25
2025-09-11T15:24:24
This is needed to enable page pruning with DataFusion, which will be useful for the Dataset Viewer. Indeed page pruning with DataFusion allows to download only certain pages of a row group, reducing the I/O required to read just a few rows. But while data page v1 generally works, it's not easy with DataFusion to do page pruning on datasets with nested data. This is because rows can span multiple pages in v1, contrary to v2. cc @severo for viz
lhoestq
https://github.com/huggingface/datasets/pull/7762
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7762", "html_url": "https://github.com/huggingface/datasets/pull/7762", "diff_url": "https://github.com/huggingface/datasets/pull/7762.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7762.patch", "merged_at": null }
true
3,402,787,999
7,761
Audio: use TorchCodec instead of Soundfile for encoding
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7761). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-09-10T14:47:07
2025-09-10T15:09:36
2025-09-10T15:09:35
this removes the dependency on Soundfile completely
lhoestq
https://github.com/huggingface/datasets/pull/7761
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7761", "html_url": "https://github.com/huggingface/datasets/pull/7761", "diff_url": "https://github.com/huggingface/datasets/pull/7761.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7761.patch", "merged_at": "2025-09-10T15:09:35" }
true
3,401,799,485
7,760
Hugging Face Hub Dataset Upload CAS Error
open
[ "cc @jsulz maybe ?", "Curious! I took a look at this and was unable to see why this would be occurring on our side. Tagging in @jgodlew and @bpronan since they might have insights. \n\n@n-bkoe just a few questions if you wouldn't mind: \n1. What kind of data are you uploading and what is the difference in file size (in bytes) between 100 and 10,000 samples?\n2. Could you provide a specific repository where you encountered this so we could look at to attempt to trace this in our systems?\n3. I cannot currently reproduce this, but I'm just trying locally; have you tried to attempt this outside of SageMaker? I'm wondering if there is something unique about that environment causing this. \n4. How/where did you set `HF_HUB_DISABLE_XET`?", "Hi, and thank you for your quick answer πŸ™ \n\n1. Its fairly simple string data, four cols, all string, some long. The script works for data up to 8000 samples long, which is two parquet files totalling 260 kb. It breaks at 10k. \n2. Unfortunately, both data and code is private for now !\n3. I will try \n4. I did it both at CLI level when call my script, and tried inside the python script with os.environ[\"HF_HUB_DISABLE_XET\"] = \"1\"\n\nThe load is also partial, it starts for one file, but does not complete and no data file is pushed. \n\n```\n5. Pushing to Hugging Face Hub...\nPushing dataset to YourOrg/dataset-10000-test_set...\nCreating parquet from Arrow format: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 9/9 [00:00<00:00, 1235.07ba/s]\nProcessing Files (0 / 0) : | | 0.00B / 0.00B 2025-09-11T15:14:37.018887Z ERROR Fatal Error: \"cas::upload_xorb\" api call failed (request id 01K4WNFGSQV1FH8846S0DNS91C): HTTP status client error (401 Unauthorized) for url (https://cas-server.xethub.hf.co/xorb/default/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)\n at /home/runner/work/xet-core/xet-core/cas_client/src/retry_wrapper.rs:113\n\nProcessing Files (0 / 0) : 0%| | 0.00B / 291kB, 0.00B/s \nNew Data Upload : 0%| | 0.00B / 291kB, 0.00B/s \n❌ Failed to push test_set: Data processing error: CAS service error : Reqwest Error: HTTP status client error (401 Unauthorized), domain: https://cas-server.xethub.hf.co/xorb/default/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nUploading the dataset shards: 0%| | 0/1 [00:00<?, ? shards/s]\nPushing dataset to YourOrg/dataset-10000-indic_test_set...\nCreating parquet from Arrow format: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 9/9 [00:00<00:00, 1289.10ba/s]\nProcessing Files (0 / 0) : | | 0.00B / 0.00B 2025-09-11T15:14:37.721996Z ERROR Fatal Error: \"cas::upload_xorb\" api call failed (request id 01K4WNFHFPJ2DC5D6JC93172H9): HTTP status client error (401 Unauthorized) for url (https://cas-server.xethub.hf.co/xorb/default/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)\n at /home/runner/work/xet-core/xet-core/cas_client/src/retry_wrapper.rs:113\n\nProcessing Files (0 / 0) : 0%| | 0.00B / 277kB, 0.00B/s \nNew Data Upload : 0%| | 0.00B / 277kB, 0.00B/s \n❌ Failed to push indic_test_set: Data processing error: CAS service error : Reqwest Error: HTTP status client error (401 Unauthorized), domain: https://cas-server.xethub.hf.co/xorb/default/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nUploading the dataset shards: 0%| | 0/1 [00:00<?, ? shards/s]\nPushing dataset to YourOrg/dataset-10000-indic_test_set_combined...\nCreating parquet from Arrow format: 100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 6/6 [00:00<00:00, 1310.04ba/s]\nProcessing Files (0 / 0) : | | 0.00B / 0.00B 2025-09-11T15:14:38.685575Z ERROR Fatal Error: \"cas::upload_xorb\" api call failed (request id 01K4WNFJDTVAYM9MFTRDSWKTD6): HTTP status client error (401 Unauthorized) for url (https://cas-server.xethub.hf.co/xorb/default/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX)\n at /home/runner/work/xet-core/xet-core/cas_client/src/retry_wrapper.rs:113\n\nProcessing Files (0 / 0) : 0%| | 0.00B / 184kB, 0.00B/s \nNew Data Upload : 0%| | 0.00B / 184kB, 0.00B/s \n❌ Failed to push indic_test_set_combined: Data processing error: CAS service error : Reqwest Error: HTTP status client error (401 Unauthorized), domain: https://cas-server.xethub.hf.co/xorb/default/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nUploading the dataset shards: 0%| | 0/1 [00:00<?, ? shards/s]\n\nSummary:\n Succeeded: None\n Failed: [('test_set', 'Data processing error: CAS service error : Reqwest Error: HTTP status client error (401 Unauthorized), domain: https://cas-server.xethub.hf.co/xorb/default/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'), ('indic_test_set', 'Data processing error: CAS service error : Reqwest Error: HTTP status client error (401 Unauthorized), domain: https://cas-server.xethub.hf.co/xorb/default/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'), ('indic_test_set_combined', 'Data processing error: CAS service error : Reqwest Error: HTTP status client error (401 Unauthorized), domain: https://cas-server.xethub.hf.co/xorb/default/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')]\n❌ Some datasets failed to upload\n```\n\n", "Thanks for following up with more details, @n-bkoe \n\nCould you tell me more about your Sagemaker environment and how you are running this script? In testing with your steps to reproduce in a Sagemaker Jupyter notebook instance (and uploading Parquet datasets with splits of anywhere from a few KBs to a few hundred MBs), I've yet to reproduce this error. This makes me believe that it's either something about the Sagemaker environment or the reproduction steps that I'm not yet emulating. \n\nConcerning the `HF_HUB_DISABLE_XET` flag, you should ensure it is set before any package imports and in the same process where you are running the script itself. If either aren't true, then this environment variable will not work. You could also explicitly uninstall `hf-xet` from the environment, although that should be unnecessary with the `HF_HUB_DISABLE_XET` flag." ]
2025-09-10T10:01:19
2025-09-16T20:01:36
null
### Describe the bug Experiencing persistent 401 Unauthorized errors when attempting to upload datasets to Hugging Face Hub using the `datasets` library. The error occurs specifically with the CAS (Content Addressable Storage) service during the upload process. Tried using HF_HUB_DISABLE_XET=1. It seems to work for smaller files. Exact error message : ``` Processing Files (0 / 0) : | | 0.00B / 0.00B 2025-09-10T09:44:35.657565Z ERROR Fatal Error: "cas::upload_xorb" api call failed (request id 01b[...]XXX): HTTP status client error (401 Unauthorized) for url (https://cas-server.xethub.hf.co/xorb/default/7f3abdc[...]XXX) at /home/runner/work/xet-core/xet-core/cas_client/src/retry_wrapper.rs:113 Processing Files (0 / 0) : 0%| | 0.00B / 184kB, 0.00B/s New Data Upload : 0%| | 0.00B / 184kB, 0.00B/s ❌ Failed to push some_dataset: Data processing error: CAS service error : Reqwest Error: HTTP status client error (401 Unauthorized), domain: https://cas-server.xethub.hf.co/xorb/default/7f3abdc[...]XXX ``` Workaround Attempts 1. **Disabled XET**: Set `HF_HUB_DISABLE_XET=1` environment variable 2. **Updated hf-xet**: Use `hf-xet==1.1.9` rather than latest 3. **Verified Authentication**: Confirmed HF token is valid and has write permissions 4. **Tested with Smaller Datasets**: - 100 samples: βœ… **SUCCESS** (uploaded successfully) - 10,000 samples: ❌ **FAILS** (401 Unauthorized) ### Steps to reproduce the bug ```python from datasets import Dataset, DatasetDict # Create dataset (example with 10,000 samples) dataset = Dataset.from_dict({ "question": questions, "answer": answers, # ... other fields }) # Split into train/test dataset_dict = dataset.train_test_split(test_size=0.1) # Upload to Hub dataset_dict.push_to_hub("Org/some-dataset") ``` ### Expected behavior ## Expected Behavior - Dataset should upload successfully to Hugging Face Hub - Progress bars should complete without authentication errors - Dataset should be accessible at the specified repository URL ## Actual Behavior - Upload fails consistently with 401 Unauthorized error - Error occurs specifically during CAS service interaction - No progress is made on the upload (0% completion) - Dataset is created on Hugging Face Hub with no data folder ### Environment info - **Platform**: SageMaker (AWS) - **Python Version**: 3.12 - **Libraries**: - `datasets` library (latest version) - `hf-xet==1.1.9` (attempted fix) - **Authentication**: Hugging Face token configured - **Dataset Size**: ~10,000 samples, works for smaller sizes (e.g. 100)
n-bkoe
https://github.com/huggingface/datasets/issues/7760
null
false
3,398,099,513
7,759
Comment/feature request: Huggingface 502s from GHA
open
[]
2025-09-09T11:59:20
2025-09-09T13:02:28
null
This is no longer a pressing issue, but for completeness I am reporting that in August 26th, GET requests to `https://datasets-server.huggingface.co/info\?dataset\=livebench/math` were returning 502s when invoked from [github actions](https://github.com/UKGovernmentBEIS/inspect_evals/actions/runs/17241892475/job/48921123754) (that link will expire eventually, [here are the logs](https://github.com/user-attachments/files/22233578/logs_44225296943.zip)). When invoked from actions, it appeared to be consistently failing for ~6 hours. However, these 502s never occurred when the request was invoked from my local machine in that same time period. I suspect that this is related to how the requests are routed with github actions versus locally. Its not clear to me if the request even reached huggingface servers or if its the github proxy that stopped it from going through, but I wanted to report it nonetheless in case this is helpful information. I'm curious if huggingface can do anything on their end to confirm cause. And a feature request for if this happens in the future (assuming huggingface has visibilty on it): A "datasets status" page highlighting if 502s occur for specific individual datasets could be useful for people debugging on the other end of this!
Scott-Simmons
https://github.com/huggingface/datasets/issues/7759
null
false
3,395,590,783
7,758
Option for Anonymous Dataset link
open
[]
2025-09-08T20:20:10
2025-09-08T20:20:10
null
### Feature request Allow for anonymized viewing of datasets. For instance, something similar to [Anonymous GitHub](https://anonymous.4open.science/). ### Motivation We generally publish our data through Hugging Face. This has worked out very well as it's both our repository and archive (thanks to the DOI feature!). However, we have an increasing challenge when it comes to sharing our datasets for paper (both conference and journal) submissions. Due to the need to share data anonymously, we can't use the Hugging Face URLs, but datasets tend to be too large for inclusion as a zip. Being able to have an anonymous link would be great since we can't be double-publishing the data. ### Your contribution Sorry, I don't have a contribution to make to the implementation of this. Perhaps it would be possible to work off the [Anonymous GitHub](https://github.com/tdurieux/anonymous_github) code to generate something analogous with pointers to the data still on Hugging Face's servers (instead of the duplication of data required for the GitHub version)?
egrace479
https://github.com/huggingface/datasets/issues/7758
null
false
3,389,535,011
7,757
Add support for `.conll` file format in datasets
open
[ "That would be cool ! feel free to ping me if I can help reviewing a PR" ]
2025-09-06T07:25:39
2025-09-10T14:22:48
null
### Feature request I’d like to request native support in the Hugging Face datasets library for reading .conll files (CoNLL format). This format is widely used in NLP tasks, especially for Named Entity Recognition (NER), POS tagging, and other token classification problems. Right now `.conll` datasets need to be manually parsed or preprocessed before being loaded into datasets. Having built in support would save time and make workflows smoother for researchers and practitioners. I propose - Add a conll dataset builder or file parser to datasets that can: - Read `.conll` files with customizable delimiters (space, tab). - Handle sentence/document boundaries (typically indicated by empty lines). - Support common CoNLL variants (e.g., CoNLL-2000 chunking, CoNLL-2003 NER). - Output a dataset where each example contains: - tokens: list of strings - tags (or similar): list of labels aligned with tokens Given a .conll snippet like: ``` EU NNP B-ORG rejects VBZ O German JJ B-MISC call NN O . . O ``` The dataset should load as: ``` { "tokens": ["EU", "rejects", "German", "call", "."], "tags": ["B-ORG", "O", "B-MISC", "O", "O"] } ``` ### Motivation - CoNLL files are a standard benchmark format in NLP (e.g., CoNLL-2003, CoNLL-2000). - Many users train NER or sequence labeling models (like BERT for token classification) directly on `.conll` - Right now you have to write your own parsing scripts. Built in support would unify this process and would be much more convenient ### Your contribution I’d be happy to contribute by implementing this feature. My plan is to- - Add a new dataset script (conll.py) to handle .conll files. - Implement parsing logic that supports sentence/document boundaries and token-label alignment. - Write unit tests with small `.conll` examples to ensure correctness. - Add documentation and usage examples so new users can easily load `.conll` datasets. This would be my first open source contribution, so I’ll follow the `CONTRIBUTING.md` guidelines closely and adjust based on feedback from the maintainers.
namesarnav
https://github.com/huggingface/datasets/issues/7757
null
false
3,387,076,693
7,756
datasets.map(f, num_proc=N) hangs with N>1 when run on import
open
[]
2025-09-05T10:32:01
2025-09-05T10:32:01
null
### Describe the bug If you `import` a module that runs `datasets.map(f, num_proc=N)` at the top-level, Python hangs. ### Steps to reproduce the bug 1. Create a file that runs datasets.map at the top-level: ```bash cat <<EOF > import_me.py import datasets the_dataset = datasets.load_dataset("openai/openai_humaneval") the_dataset = the_dataset.map(lambda item: item, num_proc=2) EOF ``` 2. Start Python REPL: ```bash uv run --python 3.12.3 --with "datasets==4.0.0" python3 Python 3.12.3 (main, Aug 14 2025, 17:47:21) [GCC 13.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. ``` 3. Import the file: ```python import import_me ```` Observe hang. ### Expected behavior Ideally would not hang, or would fallback to num_proc=1 with a warning. ### Environment info - `datasets` version: 4.0.0 - Platform: Linux-6.14.0-29-generic-x86_64-with-glibc2.39 - Python version: 3.12.3 - `huggingface_hub` version: 0.34.4 - PyArrow version: 21.0.0 - Pandas version: 2.3.2 - `fsspec` version: 2025.3.0
arjunguha
https://github.com/huggingface/datasets/issues/7756
null
false
3,386,079,181
7,755
Support pathlib.Path for feature input
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7755). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-09-05T02:38:07
2025-09-10T15:19:35
2025-09-10T15:19:35
This PR adds support for specifying image, video, audio, and pdf features using `pathlib.Path`.
Joshua-Chin
https://github.com/huggingface/datasets/pull/7755
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7755", "html_url": "https://github.com/huggingface/datasets/pull/7755", "diff_url": "https://github.com/huggingface/datasets/pull/7755.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7755.patch", "merged_at": "2025-09-10T15:19:35" }
true
3,384,883,008
7,754
Add columns support to JSON loader
open
[]
2025-09-04T18:21:26
2025-09-04T18:21:26
null
New fix to #7594 This PR adds support for the columns argument in the JSON dataset builder. Added columns parameter to JsonConfig. Applied column filtering after table creation, filling missing columns with None. Extended tests to cover: - Selecting a subset of columns - Handling missing requested columns - Column selection on list-of-strings case
ArjunJagdale
https://github.com/huggingface/datasets/pull/7754
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7754", "html_url": "https://github.com/huggingface/datasets/pull/7754", "diff_url": "https://github.com/huggingface/datasets/pull/7754.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7754.patch", "merged_at": null }
true
3,381,831,487
7,753
datasets massively slows data reads, even in memory
open
[ "Hi ! you should try\n\n```python\nfrom datasets import Array3D, Dataset, Features, Value\n\nfeatures = Features({\"image\": Array3D(shape=(3, 224, 224), dtype=\"uint8\"), \"label\": Value(\"uint8\")})\nhf_dataset = Dataset.from_dict({'image': images, 'label':labels}, features=features)\n```\n\notherwise the type of the \"image\" column is List(List(List(Value(\"uint8\")))) and is less efficient.", "Thanks! This leads to a 10x speedup:\n```python\nimport torch\nimport time\nfrom datasets import Array3D, Dataset, Features, Value\n\nimages = torch.randint(0, 255, (1000, 3, 224, 224), dtype=torch.uint8)\nlabels = torch.randint(0, 200, (1000,), dtype=torch.uint8)\n\npt_dataset = torch.utils.data.TensorDataset(images, labels)\n\nfeatures = Features({\"image\": Array3D(shape=(3, 224, 224), dtype=\"uint8\"), \"label\": Value(\"uint8\")})\nhf_dataset = Dataset.from_dict({'image': images, 'label':labels}, features=features)\nhf_in_memory = hf_dataset.map(lambda x: x, keep_in_memory=True)\n\nhf_dataset.set_format('torch', dtype=torch.uint8)\nhf_in_memory.set_format('torch', dtype=torch.uint8)\n\n# measure access speeds\ndef time_access(dataset, img_col):\n start_time = time.time()\n for i in range(1000):\n _ = dataset[i][img_col].shape\n end_time = time.time()\n return end_time - start_time\n\n\nprint(f\"In-memory Tensor access: {time_access(pt_dataset, 0):.4f} seconds\")\nprint(f\"HF Dataset access: {time_access(hf_dataset, 'image'):.4f} seconds\")\nprint(f\"In-memory HF Dataset access: {time_access(hf_in_memory, 'image'):.4f} seconds\")\n```\nProduces\n```\nIn-memory Tensor access: 0.0026 seconds\nHF Dataset access: 0.2070 seconds\nIn-memory HF Dataset access: 0.2112 seconds\n```\n\nCurious if there is a reason why this is not the default behavior for huggingface image processors?\n```python\nfrom transformers import ViTImageProcessor\nfrom transformers import AutoImageProcessor\n\nfrom datasets import load_dataset\n# Load the dataset\nds = load_dataset('ylecun/mnist', split='train[0:100]')\n\n# Instantiate the processor, explicitly requesting NumPy arrays\nprocessor1 = ViTImageProcessor.from_pretrained('facebook/vit-mae-base', do_convert_rgb=True)\nprocessor2 = AutoImageProcessor.from_pretrained(\"facebook/detr-resnet-50\", use_fast=True)\n\nprocessed1 = ds.map(lambda row: processor1(row['image']))\nprocessed2 = ds.map(lambda row: processor2(row['image']))\n\nprint( type(processed1['pixel_values'][0]), type(processed1['pixel_values'][0]))\n```\nproduces\n```\n<class 'list'> <class 'list'>\n```\n\nI can, of course, manually manipulate the dataset to the use the correct format, but this is fairly standard for images, and the performance implications seem large." ]
2025-09-04T01:45:24
2025-09-18T22:08:51
null
### Describe the bug Loading image data in a huggingface dataset results in very slow read speeds, approximately 1000 times longer than reading the same data from a pytorch dataset. This applies even when the dataset is loaded into RAM using a `keep_in_memory=True` flag. The following script reproduces the result with random data, but it applies equally to datasets that are loaded from the hub. ### Steps to reproduce the bug The following script should reproduce the behavior ``` import torch import time from datasets import Dataset images = torch.randint(0, 255, (1000, 3, 224, 224), dtype=torch.uint8) labels = torch.randint(0, 200, (1000,), dtype=torch.uint8) pt_dataset = torch.utils.data.TensorDataset(images, labels) hf_dataset = Dataset.from_dict({'image': images, 'label':labels}) hf_dataset.set_format('torch', dtype=torch.uint8) hf_in_memory = hf_dataset.map(lambda x: x, keep_in_memory=True) # measure access speeds def time_access(dataset, img_col): start_time = time.time() for i in range(1000): _ = dataset[i][img_col].shape end_time = time.time() return end_time - start_time print(f"In-memory Tensor access: {time_access(pt_dataset, 0):.4f} seconds") print(f"HF Dataset access: {time_access(hf_dataset, 'image'):.4f} seconds") print(f"In-memory HF Dataset access: {time_access(hf_in_memory, 'image'):.4f} seconds") ``` ### Expected behavior For me, the above script produces ``` In-memory Tensor access: 0.0025 seconds HF Dataset access: 2.9317 seconds In-memory HF Dataset access: 2.8082 seconds ``` I think that this difference is larger than expected. ### Environment info - `datasets` version: 4.0.0 - Platform: macOS-14.7.7-arm64-arm-64bit - Python version: 3.12.11 - `huggingface_hub` version: 0.34.3 - PyArrow version: 18.0.0 - Pandas version: 2.2.3 - `fsspec` version: 2024.9.0
lrast
https://github.com/huggingface/datasets/issues/7753
null
false
3,358,374,882
7,752
Fix: Update Dill Version in Setup py
open
[ "https://github.com/huggingface/datasets/issues/7751", "same as https://github.com/huggingface/datasets/pull/7763: some tests need to be fixed to support 0.4.0" ]
2025-08-27T07:39:51
2025-09-12T13:21:30
null
Currently the DIll version is less than 3.9 and now major libraries like Multiprocess, gepa requires Dill version as 0.4.0 and this is making a conflict in installation. So added this small PR to update the DIll.
Navanit-git
https://github.com/huggingface/datasets/pull/7752
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7752", "html_url": "https://github.com/huggingface/datasets/pull/7752", "diff_url": "https://github.com/huggingface/datasets/pull/7752.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7752.patch", "merged_at": null }
true
3,358,369,976
7,751
Dill version update
open
[ "#7752 ", "related: #7510 " ]
2025-08-27T07:38:30
2025-09-10T14:24:02
null
### Describe the bug Why the datasets is not updating the dill ? Just want to know if I update the dill version in dill what will be the repucssion. For now in multiplaces I have to update the library like process requirequire dill 0.4.0 so why not datasets. Adding a pr too. ### Steps to reproduce the bug . ### Expected behavior . ### Environment info .
Navanit-git
https://github.com/huggingface/datasets/issues/7751
null
false
3,357,275,291
7,750
Refactor: use unpacking in load.py for time and memory improvement
open
[]
2025-08-26T22:13:11
2025-08-26T22:13:11
null
In `src/datasets/load.py`, we can use unpacking rather than concatenating two lists for improved time and memory performance. It’s a small improvement in absolute terms, but a consistent and measurable one: ```diff - ALL_ALLOWED_EXTENSIONS = list(_EXTENSION_TO_MODULE.keys()) + [".zip"] + ALL_ALLOWED_EXTENSIONS = [*_EXTENSION_TO_MODULE.keys(), ".zip"] ``` Benchmarking shows approximately 32.3% time improvement and 30.6% memory improvement. Example benchmarking script: ```python #!/usr/bin/env python3 """ Benchmark script to test performance of list(_EXTENSION_TO_MODULE.keys()) vs [*_EXTENSION_TO_MODULE.keys()] """ import time import tracemalloc from statistics import mean, stdev # Simulate _EXTENSION_TO_MODULE - based on actual size from datasets _EXTENSION_TO_MODULE = { f".ext{i}": f"module{i}" for i in range(20) # Realistic size } def method_old(): """Current implementation using list()""" return list(_EXTENSION_TO_MODULE.keys()) + [".zip"] def method_new(): """Proposed implementation using unpacking""" return [*_EXTENSION_TO_MODULE.keys(), ".zip"] def benchmark_time(func, iterations=100000): """Benchmark execution time""" times = [] for _ in range(10): # Multiple runs for accuracy start = time.perf_counter() for _ in range(iterations): func() end = time.perf_counter() times.append((end - start) / iterations * 1_000_000) # microseconds return mean(times), stdev(times) def benchmark_memory(func): """Benchmark peak memory usage""" tracemalloc.start() func() current, peak = tracemalloc.get_traced_memory() tracemalloc.stop() return peak if __name__ == "__main__": print("Benchmarking list() vs unpacking performance...\n") # Time benchmarks old_time, old_std = benchmark_time(method_old) new_time, new_std = benchmark_time(method_new) print(f"Time Performance (Β΅s per operation):") print(f" list() approach: {old_time:.3f} Β± {old_std:.3f}") print(f" unpacking approach: {new_time:.3f} Β± {new_std:.3f}") print(f" Improvement: {((old_time - new_time) / old_time * 100):.1f}% faster") # Memory benchmarks old_mem = benchmark_memory(method_old) new_mem = benchmark_memory(method_new) print(f"\nMemory Usage (bytes):") print(f" list() approach: {old_mem}") print(f" unpacking approach: {new_mem}") print(f" Reduction: {old_mem - new_mem} bytes ({((old_mem - new_mem) / old_mem * 100):.1f}% less)") # Verify identical results assert method_old() == method_new(), "Results should be identical!" print(f"\nβœ“ Both methods produce identical results") ``` Results: ``` Benchmarking list() vs unpacking performance... Time Performance (Β΅s per operation): list() approach: 0.213 Β± 0.020 unpacking approach: 0.144 Β± 0.002 Improvement: 32.3% faster Memory Usage (bytes): list() approach: 392 unpacking approach: 272 Reduction: 120 bytes (30.6% less) βœ“ Both methods produce identical results ```
brchristian
https://github.com/huggingface/datasets/pull/7750
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7750", "html_url": "https://github.com/huggingface/datasets/pull/7750", "diff_url": "https://github.com/huggingface/datasets/pull/7750.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7750.patch", "merged_at": null }
true
3,356,567,923
7,749
Fix typo in error message for cache directory deletion
closed
[]
2025-08-26T17:47:22
2025-09-12T15:43:08
2025-09-12T13:22:18
This PR fixes a small typo in an error message in `src/datasets/fingerprint.py`: https://github.com/huggingface/datasets/blob/910fab20606893f69b4fccac5fcc883dddf5a14d/src/datasets/fingerprint.py#L63 ```diff - occured + occurred ```
brchristian
https://github.com/huggingface/datasets/pull/7749
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7749", "html_url": "https://github.com/huggingface/datasets/pull/7749", "diff_url": "https://github.com/huggingface/datasets/pull/7749.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7749.patch", "merged_at": "2025-09-12T13:22:18" }
true
3,347,137,663
7,748
docs: Streaming best practices
open
[]
2025-08-23T00:18:43
2025-09-07T02:33:36
null
Add a new 'Streaming best practices' page with practical patterns and pitfalls for large-scale/production use of IterableDataset. Includes examples for batched map with remove_columns, deterministic shuffling with set_epoch, multi-worker sharding, checkpoint/resume, and persistence to Parquet/Hub. Linked from How-to > General usage, next to Stream.
Abdul-Omira
https://github.com/huggingface/datasets/pull/7748
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7748", "html_url": "https://github.com/huggingface/datasets/pull/7748", "diff_url": "https://github.com/huggingface/datasets/pull/7748.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7748.patch", "merged_at": null }
true
3,347,098,038
7,747
Add wikipedia-2023-redirects dataset
open
[ "you should host this dataset on HF with `ds.push_to_hub()` ! we stopped using dataset scripts some time ago" ]
2025-08-22T23:49:53
2025-09-12T13:23:34
null
Title: Add wikipedia-2023-redirects dataset (redirect resolution + pageviews) Summary - New dataset loader: wikipedia_2023_redirects - Canonical Wikipedia pages enriched with: - redirects (aliases pointing to the page) - 2023 pageviews (aggregated) - Streaming support; robust parsing; license notes included - Tests with tiny dummy data (XML + TSVs); covers streaming Motivation RAG/retrieval often benefits from: - Query expansion via redirect aliases - Popularity prior via pageviews This loader offers a practical, maintenance-light way to access canonical pages alongside their redirect aliases and 2023 pageview totals. Features - id: string - title: string - url: string - text: string - redirects: list[string] - pageviews_2023: int32 - timestamp: string Licensing - Wikipedia text: CC BY-SA 3.0 (attribution and share-alike apply) - Pageviews: public domain The PR docs mention both, and the module docstring cites sources. Notes - The URLs in _get_urls_for_config are wired to dummy files for tests. In production, these would point to Wikimedia dumps: - XML page dumps: https://dumps.wikimedia.org/ - Pageviews: https://dumps.wikimedia.org/other/pageviews/ - The schema is intentionally simple and stable. Pageview aggregation is per-title sum across 2023. Testing - make style && make quality - pytest -q tests/test_dataset_wikipedia_2023_redirects.py Example ```python from datasets import load_dataset ds = load_dataset("wikipedia_2023_redirects", split="train") print(ds[0]["title"], ds[0]["redirects"][:5], ds[0]["pageviews_2023"]) ``` Acknowledgements - Wikipedia/Wikimedia Foundation for the source data - Hugging Face Datasets for the dataset infrastructure
Abdul-Omira
https://github.com/huggingface/datasets/pull/7747
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7747", "html_url": "https://github.com/huggingface/datasets/pull/7747", "diff_url": "https://github.com/huggingface/datasets/pull/7747.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7747.patch", "merged_at": null }
true
3,345,391,211
7,746
Fix: Canonical 'multi_news' dataset is broken and should be updated to a Parquet version
open
[ "@sayakpaul @a-r-r-o-w could you verify this issue then i can contribute to solve this issue!😊" ]
2025-08-22T12:52:03
2025-08-27T20:23:35
null
Hi, The canonical `multi_news` dataset is currently broken and fails to load. This is because it points to the [alexfabri/multi_news](https://huggingface.co/datasets/alexfabbri/multi_news) repository, which contains a legacy loading script (`multi_news.py`) that requires the now-removed `trust_remote_code` parameter. The original maintainer's GitHub and Hugging Face repositories appear to be inactive, so a community-led fix is needed. I have created a working fix by converting the dataset to the modern Parquet format, which does not require a loading script. The fixed version is available here and loads correctly: **[Awesome075/multi_news_parquet](https://huggingface.co/datasets/Awesome075/multi_news_parquet)** Could the maintainers please guide me or themselves update the official `multi_news` dataset to use this working Parquet version? This would involve updating the canonical pointer for "multi_news" to resolve to the new repository. This action would fix the dataset for all users and ensure its continued availability. Thank you!
Awesome075
https://github.com/huggingface/datasets/issues/7746
null
false
3,345,286,773
7,745
Audio mono argument no longer supported, despite class documentation
open
[ "I want to solve this problem can you please assign it to me\nand also can you please guide whether the mono parameter is required to be re-added or the documentation needs an update?" ]
2025-08-22T12:15:41
2025-08-24T18:22:41
null
### Describe the bug Either update the documentation, or re-introduce the flag (and corresponding logic to convert the audio to mono) ### Steps to reproduce the bug Audio(sampling_rate=16000, mono=True) raises the error TypeError: Audio.__init__() got an unexpected keyword argument 'mono' However, in the class documentation, is says: Args: sampling_rate (`int`, *optional*): Target sampling rate. If `None`, the native sampling rate is used. mono (`bool`, defaults to `True`): Whether to convert the audio signal to mono by averaging samples across channels. [...] ### Expected behavior The above call should either work, or the documentation within the Audio class should be updated ### Environment info - `datasets` version: 4.0.0 - Platform: Linux-5.15.0-124-generic-x86_64-with-glibc2.35 - Python version: 3.12.11 - `huggingface_hub` version: 0.34.4 - PyArrow version: 21.0.0 - Pandas version: 2.3.2 - `fsspec` version: 2025.3.0
jheitz
https://github.com/huggingface/datasets/issues/7745
null
false
3,343,510,686
7,744
dtype: ClassLabel is not parsed correctly in `features.py`
closed
[ "I think it's \"class_label\"", "> I think it's \"class_label\"\n\nI see -- thank you. This works\n\n```yaml\nlicense: mit\nlanguage:\n- en\ntags:\n- genomics\n- yeast\n- transcription\n- perturbation\n- response\n- overexpression\npretty_name: Hackett, 2020 Overexpression\nsize_categories:\n- 1M<n<10M\ndataset_info:\n features:\n ...\n - name: mechanism\n dtype:\n class_label:\n names: [\"GEV\", \"ZEV\"]\n description: induction system (GEV or ZEV)\n - name: restriction\n dtype:\n class_label:\n names: [\"M\", \"N\", \"P\"]\n description: nutrient limitation (M, N or P)\n```\n\nI see the documentation for [datasets.ClassLabel](https://huggingface.co/docs/datasets/v4.0.0/en/package_reference/main_classes#datasets.ClassLabel). And the documentation for the [dataset cards](https://huggingface.co/docs/hub/en/datasets-cards). I don't see anything in either of those places, though, that specifies the pattern above.\n\nI suppose rather than writing the yaml by hand, the expected workflow is to use `datasets` to construct these features?", "I generally copy/paste and adapt a YAML from another dataset.\n\nBut it's also possible to generate it from `datasets` like that\n\n```python\n>>> import yaml\n>>> print(yaml.dump(features._to_yaml_list(), sort_keys=False))\n- name: start\n dtype: int32\n- name: end\n dtype: int32\n- name: restriction\n dtype:\n class_label:\n names: [\"M\", \"N\", \"P\"]\n```" ]
2025-08-21T23:28:50
2025-09-10T15:23:41
2025-09-10T15:23:41
`dtype: ClassLabel` in the README.md yaml metadata is parsed incorrectly and causes the data viewer to fail. This yaml in my metadata ([source](https://huggingface.co/datasets/BrentLab/yeast_genome_resources/blob/main/README.md), though i changed `ClassLabel` to `string` to using different dtype in order to avoid the error): ```yaml license: mit pretty_name: BrentLab Yeast Genome Resources size_categories: - 1K<n<10K language: - en dataset_info: features: - name: start dtype: int32 description: Start coordinate (1-based, **inclusive**) - name: end dtype: int32 description: End coordinate (1-based, **inclusive**) - name: strand dtype: ClassLabel ... ``` is producing the following error in the data viewer: ``` Error code: ConfigNamesError Exception: ValueError Message: Feature type 'Classlabel' not found. Available feature types: ['Value', 'ClassLabel', 'Translation', 'TranslationVariableLanguages', 'LargeList', 'List', 'Array2D', 'Array3D', 'Array4D', 'Array5D', 'Audio', 'Image', 'Video', 'Pdf'] Traceback: Traceback (most recent call last): File "/src/services/worker/src/worker/job_runners/dataset/config_names.py", line 66, in compute_config_names_response config_names = get_dataset_config_names( File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/inspect.py", line 161, in get_dataset_config_names dataset_module = dataset_module_factory( File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/load.py", line 1031, in dataset_module_factory raise e1 from None File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/load.py", line 996, in dataset_module_factory return HubDatasetModuleFactory( File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/load.py", line 605, in get_module dataset_infos = DatasetInfosDict.from_dataset_card_data(dataset_card_data) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/info.py", line 386, in from_dataset_card_data dataset_info = DatasetInfo._from_yaml_dict(dataset_card_data["dataset_info"]) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/info.py", line 317, in _from_yaml_dict yaml_data["features"] = Features._from_yaml_list(yaml_data["features"]) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 2027, in _from_yaml_list return cls.from_dict(from_yaml_inner(yaml_data)) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 1872, in from_dict obj = generate_from_dict(dic) File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 1459, in generate_from_dict return {key: generate_from_dict(value) for key, value in obj.items()} File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 1459, in <dictcomp> return {key: generate_from_dict(value) for key, value in obj.items()} File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/features/features.py", line 1465, in generate_from_dict raise ValueError(f"Feature type '{_type}' not found. Available feature types: {list(_FEATURE_TYPES.keys())}") ValueError: Feature type 'Classlabel' not found. Available feature types: ['Value', 'ClassLabel', 'Translation', 'TranslationVariableLanguages', 'LargeList', 'List', 'Array2D', 'Array3D', 'Array4D', 'Array5D', 'Audio', 'Image', 'Video', 'Pdf'] ``` I think that this is caused by this line https://github.com/huggingface/datasets/blob/896616c6cb03d92a33248c3529b0796cda27e955/src/datasets/features/features.py#L2013 Reproducible example from [naming.py](https://github.com/huggingface/datasets/blob/896616c6cb03d92a33248c3529b0796cda27e955/src/datasets/naming.py) ```python import itertools import os import re _uppercase_uppercase_re = re.compile(r"([A-Z]+)([A-Z][a-z])") _lowercase_uppercase_re = re.compile(r"([a-z\d])([A-Z])") _single_underscore_re = re.compile(r"(?<!_)_(?!_)") _multiple_underscores_re = re.compile(r"(_{2,})") _split_re = r"^\w+(\.\w+)*$" def snakecase_to_camelcase(name): """Convert snake-case string to camel-case string.""" name = _single_underscore_re.split(name) name = [_multiple_underscores_re.split(n) for n in name] return "".join(n.capitalize() for n in itertools.chain.from_iterable(name) if n != "") snakecase_to_camelcase("ClassLabel") ``` Result: ```raw 'Classlabel' ```
cmatKhan
https://github.com/huggingface/datasets/issues/7744
null
false
3,342,611,297
7,743
Refactor HDF5 and preserve tree structure
closed
[ "@lhoestq this is ready for you now!", "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7743). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-08-21T17:28:17
2025-08-26T15:28:05
2025-08-26T15:28:05
Closes #7741. Followup to #7690 - Recursive parsing and feature inference, to preserve the tree structure of the file. Note this means we now visit all links in the file. It also means we have to call` combine_chunks` on any large non-root datasets. - Support for `complex64` (two `float32`s, used to be converted to two `float64`s) - Support for ndim complex, compound, more field types for compound (due to reusing the main parser, compound types are treated like groups) - Cleaned up varlen support - Always do feature inference and always cast to features (used to cast to schema) - Updated tests to use `load_dataset` instead of internal APIs - Removed `columns` in config. Have to give Features (i.e., must specify types) if filtering
klamike
https://github.com/huggingface/datasets/pull/7743
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7743", "html_url": "https://github.com/huggingface/datasets/pull/7743", "diff_url": "https://github.com/huggingface/datasets/pull/7743.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7743.patch", "merged_at": "2025-08-26T15:28:05" }
true
3,336,704,928
7,742
module 'pyarrow' has no attribute 'PyExtensionType'
open
[ "Just checked out the files and thishad already been addressed", "For others who find this issue: \n\n`pip install --upgrade \"datasets>=2.20.0\"` \n\nfrom https://github.com/explodinggradients/ragas/issues/2170#issuecomment-3204393672 can fix it." ]
2025-08-20T06:14:33
2025-09-09T02:51:46
null
### Describe the bug When importing certain libraries, users will encounter the following error which can be traced back to the datasets library. module 'pyarrow' has no attribute 'PyExtensionType'. Example issue: https://github.com/explodinggradients/ragas/issues/2170 The issue occurs due to the following. I will proceed to submit a PR with the below fix: **Issue Reason** The issue is that PyArrow version 21.0.0 doesn’t have PyExtensionType. This was changed in newer versions of PyArrow. The PyExtensionType class was renamed to ExtensionType in PyArrow 13.0.0 and later versions. ** Issue Solution** Making the following changes to the following lib files should temporarily resolve the issue. I will submit a PR to the dataets library in the meantime. env_name/lib/python3.10/site-packages/datasets/features/features.py: ``` > 521 self.shape = tuple(shape) 522 self.value_type = dtype 523 self.storage_dtype = self._generate_dtype(self.value_type) 524 - pa.PyExtensionType.__init__(self, self.storage_dtype) 524 + pa.ExtensionType.__init__(self, self.storage_dtype) 525 526 def __reduce__(self): 527 return self.__class__, ( ``` Updated venv_name/lib/python3.10/site-packages/datasets/features/features.py: ``` 510 _type: str = field(default=β€œArray5D”, init=False, repr=False) 511 512 513 - class _ArrayXDExtensionType(pa.PyExtensionType): 513 + class _ArrayXDExtensionType(pa.ExtensionType): 514 ndims: Optional[int] = None 515 516 def __init__(self, shape: tuple, dtype: str): ``` ### Steps to reproduce the bug Ragas version: 0.3.1 Python version: 3.11 **Code to Reproduce** _**In notebook:**_ !pip install ragas from ragas import evaluate ### Expected behavior The required package installs without issue. ### Environment info In Jupyter Notebook. venv
mnedelko
https://github.com/huggingface/datasets/issues/7742
null
false
3,334,848,656
7,741
Preserve tree structure when loading HDF5
closed
[]
2025-08-19T15:42:05
2025-08-26T15:28:06
2025-08-26T15:28:06
### Feature request https://github.com/huggingface/datasets/pull/7740#discussion_r2285605374 ### Motivation `datasets` has the `Features` class for representing nested features. HDF5 files have groups of datasets which are nested, though in #7690 the keys are flattened. We should preserve that structure for the user. ### Your contribution I'll open a PR (#7743)
klamike
https://github.com/huggingface/datasets/issues/7741
null
false
3,334,693,293
7,740
Document HDF5 support
closed
[ "@lhoestq any guidance on what else to add/feedback on what is there now? It seems a bit minimal, but I don't think it's worth doing an entire page on HDF5?" ]
2025-08-19T14:53:04
2025-09-24T14:51:11
2025-09-24T14:51:11
I think these are at least the main places where we should put content. Ideally it is not just repeated in the final version ref #7690 - [x] Wait for #7743 to land
klamike
https://github.com/huggingface/datasets/pull/7740
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7740", "html_url": "https://github.com/huggingface/datasets/pull/7740", "diff_url": "https://github.com/huggingface/datasets/pull/7740.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7740.patch", "merged_at": "2025-09-24T14:51:11" }
true
3,331,537,762
7,739
Replacement of "Sequence" feature with "List" breaks backward compatibility
open
[ "Backward compatibility here means 4.0.0 can load datasets saved with older versions.\n\nYou will need 4.0.0 to load datasets saved with 4.0.0" ]
2025-08-18T17:28:38
2025-09-10T14:17:50
null
PR #7634 replaced the Sequence feature with List in 4.0.0, so datasets saved with version 4.0.0 with that feature cannot be loaded by earlier versions. There is no clear option in 4.0.0 to use the legacy feature type to preserve backward compatibility. Why is this a problem? I have a complex preprocessing and training pipeline dependent on 3.6.0; we manage a very large number of separate datasets that get concatenated during training. If just one of those datasets is saved with 4.0.0, they become unusable, and we have no way of "fixing" them. I can load them in 4.0.0 but I can't re-save with the legacy feature type, and I can't load it in 3.6.0 for obvious reasons. Perhaps I'm missing something here, since the PR says that backward compatibility is preserved; if so, it's not obvious to me how.
evmaki
https://github.com/huggingface/datasets/issues/7739
null
false
3,328,948,690
7,738
Allow saving multi-dimensional ndarray with dynamic shapes
open
[ "I agree this would be super valuable.\n\nIt looks like this was discussed a few years ago in https://github.com/huggingface/datasets/issues/5272#issuecomment-1550200824 but there were some issues. Those PRs are merged now and it looks like Arrow [officially supports](https://arrow.apache.org/docs/format/CanonicalExtensions.html#variable-shape-tensor) this so it's a good time to re-evaluate!", "Happy to help with this, maybe we can think of adding a new type `Tensor` (instead of Array2D, 3D etc. which imply a fixed number of dims - we can keep them for backward compat anyways) that uses VariableShapeTensor (or FixedShapeTensor if the shape is provided maybe ? happy to discuss this)" ]
2025-08-18T02:23:51
2025-08-26T15:25:02
null
### Feature request I propose adding a dedicated feature to the datasets library that allows for the efficient storage and retrieval of multi-dimensional ndarray with dynamic shapes. Similar to how Image columns handle variable-sized images, this feature would provide a structured way to store array data where the dimensions are not fixed. A possible implementation could be a new Array or Tensor feature type that stores the data in a structured format, for example, ```python { "shape": (5, 224, 224), "dtype": "uint8", "data": [...] } ``` This would allow the datasets library to handle heterogeneous array sizes within a single column without requiring a fixed shape definition in the feature schema. ### Motivation I am currently trying to upload data from astronomical telescopes, specifically FITS files, to the Hugging Face Hub. This type of data is very similar to images but often has more than three dimensions. For example, data from the SDSS project contains five channels (u, g, r, i, z), and the pixel values can exceed 255, making the Pillow based Image feature unsuitable. The current datasets library requires a fixed shape to be defined in the feature schema for multi-dimensional arrays, which is a major roadblock. This prevents me from saving my data, as the dimensions of the arrays can vary across different FITS files. https://github.com/huggingface/datasets/blob/985c9bee6bfc345787a8b9dd316e1d4f3b930503/src/datasets/features/features.py#L613-L614 A feature that supports dynamic shapes would be incredibly beneficial for the astronomy community and other fields dealing with similar high-dimensional, variable-sized data (e.g., medical imaging, scientific simulations). ### Your contribution I am willing to create a PR to help implement this feature if the proposal is accepted.
ryan-minato
https://github.com/huggingface/datasets/issues/7738
null
false
3,318,670,801
7,737
docs: Add column overwrite example to batch mapping guide
closed
[ "Hi @lhoestq, just a gentle follow-up on this PR." ]
2025-08-13T14:20:19
2025-09-04T11:11:37
2025-09-04T11:11:37
This PR adds a complementary example showing the **column-overwriting** pattern, which is both more direct and more flexible for many transformations. ### Proposed Change The original `remove_columns` example remains untouched. Below it, this PR introduces an alternative approach that overwrites an existing column during batch mapping. This teaches users a core `.map()` capability for in-place transformations without extra intermediate steps. **New Example:** > ```python > >>> from datasets import Dataset > >>> dataset = Dataset.from_dict({"a": [0, 1, 2]}) > # Overwrite "a" directly to duplicate each value > >>> duplicated_dataset = dataset.map( > ... lambda batch: {"a": [x for x in batch["a"] for _ in range(2)]}, > ... batched=True > ... ) > >>> duplicated_dataset > Dataset({ > features: ['a'], > num_rows: 6 > }) > >>> duplicated_dataset["a"] > [0, 0, 1, 1, 2, 2] > ```
Sanjaykumar030
https://github.com/huggingface/datasets/pull/7737
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7737", "html_url": "https://github.com/huggingface/datasets/pull/7737", "diff_url": "https://github.com/huggingface/datasets/pull/7737.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7737.patch", "merged_at": "2025-09-04T11:11:37" }
true
3,311,618,096
7,736
Fix type hint `train_test_split`
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7736). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-08-11T20:46:53
2025-08-13T13:13:50
2025-08-13T13:13:48
null
qgallouedec
https://github.com/huggingface/datasets/pull/7736
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7736", "html_url": "https://github.com/huggingface/datasets/pull/7736", "diff_url": "https://github.com/huggingface/datasets/pull/7736.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7736.patch", "merged_at": "2025-08-13T13:13:48" }
true
3,310,514,828
7,735
fix largelist repr
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7735). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-08-11T15:17:42
2025-08-11T15:39:56
2025-08-11T15:39:54
null
lhoestq
https://github.com/huggingface/datasets/pull/7735
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7735", "html_url": "https://github.com/huggingface/datasets/pull/7735", "diff_url": "https://github.com/huggingface/datasets/pull/7735.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7735.patch", "merged_at": "2025-08-11T15:39:54" }
true
3,306,519,239
7,734
Fixing __getitem__ of datasets which behaves inconsistent to documentation when setting _format_type to None
closed
[ "this breaking change is actually expected, happy to help with a fix in sentencetransformers to account for this", "Thank you for the context. I thought this was a mismatch do the documentation. Good to know it was intentional. No worries, can add a PR to sentence transformers." ]
2025-08-09T15:52:54
2025-08-17T07:23:00
2025-08-17T07:23:00
Setting _format_type to None, should return plain python object but as of 4.0.0 returns Column. This fails in libs such as sentencetransformers (such as in generation of hard negatives) where plain python is expected.
awagen
https://github.com/huggingface/datasets/pull/7734
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7734", "html_url": "https://github.com/huggingface/datasets/pull/7734", "diff_url": "https://github.com/huggingface/datasets/pull/7734.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7734.patch", "merged_at": null }
true
3,304,979,299
7,733
Dataset Repo Paths to Locally Stored Images Not Being Appended to Image Path
open
[ "This is the download issues I come into, about ever other time it fails...\n<img width=\"1719\" height=\"1226\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/2e5b4b3e-7c13-4bad-a77c-34b47a932831\" />" ]
2025-08-08T19:10:58
2025-08-12T00:54:58
null
### Describe the bug I’m not sure if this is a bug or a feature and I just don’t fully understand how dataset loading is to work, but it appears there may be a bug with how locally stored Image() are being accessed. I’ve uploaded a new dataset to hugging face (rmdig/rocky_mountain_snowpack) but I’ve come into a ton of trouble trying to have the images handled properly (at least in the way I’d expect them to be handled). I find that I cannot use relative paths for loading images remotely from the Hugging Face repo or from a local repository. Any time I do it always simply appends my current working directory to the dataset. As a result to use the datasets library with my dataset I have to change my working directory to the dataset folder or abandon the dataset object structure, which I cannot imagine you intended. As a result I have to use URL’s since an absolute path on my system obviously wouldn’t work for others. The URL works ok, but despite me having it locally downloaded, it appears to be redownloading the dataset every time I train my snowGAN model on it (and often times I’m coming into HTTPS errors for over requesting the data). Or maybe image relative paths aren't intended to be loaded directly through your datasets library as images and should be kept as strings for the user to handle? If so I feel like you’re missing out on some pretty seamless functionality ### Steps to reproduce the bug 1. Download a local copy of the dataset (rmdig/rocky_mountain_snowpack) through git or whatever you prefer. 2. Alter the README.md YAML for file_path (the relative path to each image) to be type Image instead of type string ` --- dataset_info: features: - name: image dtype: Image - name: file_path dtype: Image ` 3. Initialize the dataset locally, make sure your working directory is not the dataset directory root `dataset = datasets.load_dataset(β€˜path/to/local/rocky_mountain_snowpack/β€˜)` 4. Call to one of the samples and you’ll get an error that the image was not found in current/working/directory/preprocessed/cores/image_1.png. Showing that it’s simply looking in the current working directory + relative path ` >>> dataset['train'][0] Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/dennyschaedig/miniconda3/lib/python3.12/site-packages/datasets/arrow_dataset.py", line 2859, in __getitem__ return self._getitem(key) ^^^^^^^^^^^^^^^^^^ File "/Users/dennyschaedig/miniconda3/lib/python3.12/site-packages/datasets/arrow_dataset.py", line 2841, in _getitem formatted_output = format_table( ^^^^^^^^^^^^^ File "/Users/dennyschaedig/miniconda3/lib/python3.12/site-packages/datasets/formatting/formatting.py", line 657, in format_table return formatter(pa_table, query_type=query_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dennyschaedig/miniconda3/lib/python3.12/site-packages/datasets/formatting/formatting.py", line 410, in __call__ return self.format_row(pa_table) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dennyschaedig/miniconda3/lib/python3.12/site-packages/datasets/formatting/formatting.py", line 459, in format_row row = self.python_features_decoder.decode_row(row) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dennyschaedig/miniconda3/lib/python3.12/site-packages/datasets/formatting/formatting.py", line 223, in decode_row return self.features.decode_example(row, token_per_repo_id=self.token_per_repo_id) if self.features else row ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dennyschaedig/miniconda3/lib/python3.12/site-packages/datasets/features/features.py", line 2093, in decode_example column_name: decode_nested_example(feature, value, token_per_repo_id=token_per_repo_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dennyschaedig/miniconda3/lib/python3.12/site-packages/datasets/features/features.py", line 1405, in decode_nested_example return schema.decode_example(obj, token_per_repo_id=token_per_repo_id) if obj is not None else None ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/dennyschaedig/miniconda3/lib/python3.12/site-packages/datasets/features/image.py", line 171, in decode_example image = PIL.Image.open(path) ^^^^^^^^^^^^^^^^^^^^ File "/Users/dennyschaedig/miniconda3/lib/python3.12/site-packages/PIL/Image.py", line 3277, in open fp = builtins.open(filename, "rb") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: '/Users/dennyschaedig/Datasets/preprocessed/cores/image_1.png' ` ### Expected behavior I expect the datasets and Image() to load the locally hosted data using path/to/local/rocky_mountain_snowpack/ (that I pass in with my datasets.load_dataset() or the you all handle on the backend) call + relative path. Instead it appears to load from my current working directory + relative path. ### Environment info Tested on… Windows 11, Ubuntu Linux 22.04 and Mac Sequoia 15.5 Silicone M2 datasets version 4.0.0 Python 3.12 and 3.13
dennys246
https://github.com/huggingface/datasets/issues/7733
null
false
3,304,673,383
7,732
webdataset: key errors when `field_name` has upper case characters
open
[]
2025-08-08T16:56:42
2025-08-08T16:56:42
null
### Describe the bug When using a webdataset each sample can be a collection of different "fields" like this: ``` images17/image194.left.jpg images17/image194.right.jpg images17/image194.json images17/image12.left.jpg images17/image12.right.jpg images17/image12.json ``` if the field_name contains upper case characters, the HF webdataset integration throws a key error when trying to load the dataset: e.g. from a dataset (now updated so that it doesn't throw this error) ``` --------------------------------------------------------------------------- KeyError Traceback (most recent call last) Cell In[1], line 2 1 from datasets import load_dataset ----> 2 ds = load_dataset("commaai/comma2k19", data_files={'train': ['data-00000.tar.gz']}, num_proc=1) File ~/xx/.venv/lib/python3.11/site-packages/datasets/load.py:1412, in load_dataset(path, name, data_dir, data_files, split, cache_dir, features, download_config, download_mode, verification_mode, keep_in_memory, save_infos, revision, token, streaming, num_proc, storage_options, **config_kwargs) 1409 return builder_instance.as_streaming_dataset(split=split) 1411 # Download and prepare data -> 1412 builder_instance.download_and_prepare( 1413 download_config=download_config, 1414 download_mode=download_mode, 1415 verification_mode=verification_mode, 1416 num_proc=num_proc, 1417 storage_options=storage_options, 1418 ) 1420 # Build dataset for splits 1421 keep_in_memory = ( 1422 keep_in_memory if keep_in_memory is not None else is_small_dataset(builder_instance.info.dataset_size) 1423 ) File ~/xx/.venv/lib/python3.11/site-packages/datasets/builder.py:894, in DatasetBuilder.download_and_prepare(self, output_dir, download_config, download_mode, verification_mode, dl_manager, base_path, file_format, max_shard_size, num_proc, storage_options, **download_and_prepare_kwargs) 892 if num_proc is not None: 893 prepare_split_kwargs["num_proc"] = num_proc --> 894 self._download_and_prepare( 895 dl_manager=dl_manager, 896 verification_mode=verification_mode, 897 **prepare_split_kwargs, 898 **download_and_prepare_kwargs, 899 ) 900 # Sync info 901 self.info.dataset_size = sum(split.num_bytes for split in self.info.splits.values()) File ~/xx/.venv/lib/python3.11/site-packages/datasets/builder.py:1609, in GeneratorBasedBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs) 1608 def _download_and_prepare(self, dl_manager, verification_mode, **prepare_splits_kwargs): -> 1609 super()._download_and_prepare( 1610 dl_manager, 1611 verification_mode, 1612 check_duplicate_keys=verification_mode == VerificationMode.BASIC_CHECKS 1613 or verification_mode == VerificationMode.ALL_CHECKS, 1614 **prepare_splits_kwargs, 1615 ) File ~/xx/.venv/lib/python3.11/site-packages/datasets/builder.py:948, in DatasetBuilder._download_and_prepare(self, dl_manager, verification_mode, **prepare_split_kwargs) 946 split_dict = SplitDict(dataset_name=self.dataset_name) 947 split_generators_kwargs = self._make_split_generators_kwargs(prepare_split_kwargs) --> 948 split_generators = self._split_generators(dl_manager, **split_generators_kwargs) 950 # Checksums verification 951 if verification_mode == VerificationMode.ALL_CHECKS and dl_manager.record_checksums: File ~/xx/.venv/lib/python3.11/site-packages/datasets/packaged_modules/webdataset/webdataset.py:81, in WebDataset._split_generators(self, dl_manager) 78 if not self.info.features: 79 # Get one example to get the feature types 80 pipeline = self._get_pipeline_from_tar(tar_paths[0], tar_iterators[0]) ---> 81 first_examples = list(islice(pipeline, self.NUM_EXAMPLES_FOR_FEATURES_INFERENCE)) 82 if any(example.keys() != first_examples[0].keys() for example in first_examples): 83 raise ValueError( 84 "The TAR archives of the dataset should be in WebDataset format, " 85 "but the files in the archive don't share the same prefix or the same types." 86 ) File ~/xx/.venv/lib/python3.11/site-packages/datasets/packaged_modules/webdataset/webdataset.py:55, in WebDataset._get_pipeline_from_tar(cls, tar_path, tar_iterator) 53 data_extension = field_name.split(".")[-1] 54 if data_extension in cls.DECODERS: ---> 55 current_example[field_name] = cls.DECODERS[data_extension](current_example[field_name]) 56 if current_example: 57 yield current_example KeyError: 'processed_log_IMU_magnetometer_value.npy' ``` ### Steps to reproduce the bug unit test was added in: https://github.com/huggingface/datasets/pull/7726 it fails without the fixed proposed in the same PR ### Expected behavior Not throwing a key error. ### Environment info ``` - `datasets` version: 4.0.0 - Platform: Linux-6.8.0-51-generic-x86_64-with-glibc2.39 - Python version: 3.11.4 - `huggingface_hub` version: 0.33.4 - PyArrow version: 21.0.0 - Pandas version: 2.3.1 - `fsspec` version: 2025.7.0 ```
YassineYousfi
https://github.com/huggingface/datasets/issues/7732
null
false
3,303,637,075
7,731
Add the possibility of a backend for audio decoding
open
[ "is there a work around im stuck", "never mind just downgraded" ]
2025-08-08T11:08:56
2025-08-20T16:29:33
null
### Feature request Add the possibility of a backend for audio decoding. Before version 4.0.0, soundfile was used, and now torchcodec is used, but the problem is that torchcodec requires ffmpeg, which is problematic to install on the same colab. Therefore, I suggest adding a decoder selection when loading the dataset. ### Motivation I use a service for training models in which ffmpeg cannot be installed. ### Your contribution I use a service for training models in which ffmpeg cannot be installed.
intexcor
https://github.com/huggingface/datasets/issues/7731
null
false
3,301,907,242
7,730
Grammar fix: correct "showed" to "shown" in fingerprint.py
closed
[]
2025-08-07T21:22:56
2025-08-13T18:34:30
2025-08-13T13:12:56
This PR corrects a small grammatical issue in the outputs of fingerprint.py: ```diff - "This warning is only showed once. Subsequent hashing failures won't be showed." + "This warning is only shown once. Subsequent hashing failures won't be shown." ```
brchristian
https://github.com/huggingface/datasets/pull/7730
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7730", "html_url": "https://github.com/huggingface/datasets/pull/7730", "diff_url": "https://github.com/huggingface/datasets/pull/7730.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7730.patch", "merged_at": "2025-08-13T13:12:56" }
true
3,300,672,954
7,729
OSError: libcudart.so.11.0: cannot open shared object file: No such file or directory
open
[ "Is this related to the \"datasets\" library? @SaleemMalikAI " ]
2025-08-07T14:07:23
2025-09-24T02:17:15
null
> Hi is there any solution for that eror i try to install this one pip install torch==1.12.1+cpu torchaudio==0.12.1+cpu -f https://download.pytorch.org/whl/torch_stable.html this is working fine but tell me how to install pytorch version that is fit for gpu
SaleemMalikAI
https://github.com/huggingface/datasets/issues/7729
null
false
3,298,854,904
7,728
NonMatchingSplitsSizesError and ExpectedMoreSplitsError
open
[ "To load just one shard without errors, you should use data_files directly with split set to \"train\", but don’t specify \"allenai/c4\", since that points to the full dataset with all shards.\n\nInstead, do this:\n```\nfrom datasets import load_dataset\n\n# Load only one shard of C4\ntraindata = load_dataset(\n \"json\", # <-- use \"json\" since you’re directly passing JSON files\n data_files={\"train\": \"en/c4-train.00000-of-01024.json.gz\"},\n split=\"train\"\n)\n\nprint(traindata)\n```\nIf you want both train and validation but only a subset of shards, do:\n```\ntraindata = load_dataset(\n \"json\",\n data_files={\n \"train\": \"en/c4-train.00000-of-01024.json.gz\",\n \"validation\": \"en/c4-validation.00000-of-00008.json.gz\"\n }\n)\n\nprint(traindata)\n```" ]
2025-08-07T04:04:50
2025-10-05T10:24:51
null
### Describe the bug When loading dataset, the info specified by `data_files` did not overwrite the original info. ### Steps to reproduce the bug ```python from datasets import load_dataset traindata = load_dataset( "allenai/c4", "en", data_files={"train": "en/c4-train.00000-of-01024.json.gz", "validation": "en/c4-validation.00000-of-00008.json.gz"}, ) ``` ```log NonMatchingSplitsSizesError: [{'expected': SplitInfo(name='train', num_bytes=828589180707, num_examples=364868892, shard_lengths=None, dataset_name=None), 'recorded': SplitInfo(name='train', num_bytes=809262831, num_examples=356317, shard_lengths=[223006, 133311], dataset_name='c4')}, {'expected': SplitInfo(name='validation', num_bytes=825767266, num_examples=364608, shard_lengths=None, dataset_name=None), 'recorded': SplitInfo(name='validation', num_bytes=102199431, num_examples=45576, shard_lengths=None, dataset_name='c4')}] ``` ```python from datasets import load_dataset traindata = load_dataset( "allenai/c4", "en", data_files={"train": "en/c4-train.00000-of-01024.json.gz"}, split="train" ) ``` ```log ExpectedMoreSplitsError: {'validation'} ``` ### Expected behavior No error ### Environment info datasets 4.0.0
efsotr
https://github.com/huggingface/datasets/issues/7728
null
false
3,295,718,578
7,727
config paths that start with ./ are not valid as hf:// accessed repos, but are valid when accessed locally
open
[]
2025-08-06T08:21:37
2025-08-06T08:21:37
null
### Describe the bug ``` - config_name: some_config data_files: - split: train path: - images/xyz/*.jpg ``` will correctly download but ``` - config_name: some_config data_files: - split: train path: - ./images/xyz/*.jpg ``` will error with `FileNotFoundError` due to improper url joining. `load_dataset` on the same directory locally works fine. ### Steps to reproduce the bug 1. create a README.md with the front matter of the form ``` - config_name: some_config data_files: - split: train path: - ./images/xyz/*.jpg ``` 2. `touch ./images/xyz/1.jpg` 3. Observe this directory loads with `load_dataset("filesystem_path", "some_config")` correctly. 4. Observe exceptions when you load this with `load_dataset("repoid/filesystem_path", "some_config")` ### Expected behavior `./` prefix should be interpreted correctly ### Environment info datasets 4.0.0 datasets 3.4.0 reproduce
doctorpangloss
https://github.com/huggingface/datasets/issues/7727
null
false
3,293,789,832
7,726
fix(webdataset): don't .lower() field_name
closed
[ "fixes: https://github.com/huggingface/datasets/issues/7732", "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7726). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.", "CI failures are unrelated, merging :)" ]
2025-08-05T16:57:09
2025-08-20T16:35:55
2025-08-20T16:35:55
This fixes cases where keys have upper case identifiers
YassineYousfi
https://github.com/huggingface/datasets/pull/7726
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7726", "html_url": "https://github.com/huggingface/datasets/pull/7726", "diff_url": "https://github.com/huggingface/datasets/pull/7726.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7726.patch", "merged_at": "2025-08-20T16:35:55" }
true
3,292,315,241
7,724
Can not stepinto load_dataset.py?
open
[]
2025-08-05T09:28:51
2025-08-05T09:28:51
null
I set a breakpoint in "load_dataset.py" and try to debug my data load codes, but it does not stop at any breakpoints, so "load_dataset.py" can not be stepped into ? <!-- Failed to upload "ζˆͺε›Ύ 2025-08-05 17-25-18.png" -->
micklexqg
https://github.com/huggingface/datasets/issues/7724
null
false
3,289,943,261
7,723
Don't remove `trust_remote_code` arg!!!
open
[]
2025-08-04T15:42:07
2025-08-04T15:42:07
null
### Feature request defaulting it to False is nice balance. we need manully setting it to True in certain scenarios! Add `trust_remote_code` arg back please! ### Motivation defaulting it to False is nice balance. we need manully setting it to True in certain scenarios! ### Your contribution defaulting it to False is nice balance. we need manully setting it to True in certain scenarios!
autosquid
https://github.com/huggingface/datasets/issues/7723
null
false
3,289,741,064
7,722
Out of memory even though using load_dataset(..., streaming=True)
open
[]
2025-08-04T14:41:55
2025-08-04T14:41:55
null
### Describe the bug I am iterating over a large dataset that I load using streaming=True to avoid running out of memory. Unfortunately, I am observing that memory usage increases over time and I'm finally running in an oom. ### Steps to reproduce the bug ``` ds = load_dataset("openslr/librispeech_asr", split="train.clean.360", streaming=True) for i,sample in enumerate(tqdm(ds)): target_file = os.path.join(NSFW_TARGET_FOLDER, f'audio{i}.wav') try: sf.write(target_file, sample['audio']['array'], samplerate=sample['audio']['sampling_rate']) except Exception as e: print(f"Could not write audio {i} in ds: {e}") ``` ### Expected behavior I'd expect to have a small memory footprint and memory being freed after each iteration of the for loop. Instead the memory usage is increasing. I tried to remove the logic to write the sound file and just print the sample but the issue remains the same. ### Environment info Python 3.12.11 Ubuntu 24 datasets 4.0.0 and 3.6.0
padmalcom
https://github.com/huggingface/datasets/issues/7722
null
false
3,289,426,104
7,721
Bad split error message when using percentages
open
[ "I'd like to work on this: add clearer validation/messages for percent-based splits + tests", "The most basic example is this code:\n`load_dataset(\"openslr/librispeech_asr\", split=\"train[10%:20%]\")`\n\nThis results in this ValueError:\n```\n raise ValueError(f'Unknown split \"{split}\". Should be one of {list(name2len)}.')\nValueError: Unknown split \"train\". Should be one of ['test.clean', 'test.other', 'train.clean.100', 'train.clean.360', 'train.other.500', 'validation.clean', 'validation.other'].\n```\n" ]
2025-08-04T13:20:25
2025-08-14T14:42:24
null
### Describe the bug Hi, I'm trying to download a dataset. To not load the entire dataset in memory, I split it as described [here](https://huggingface.co/docs/datasets/v4.0.0/loading#slice-splits) in 10% steps. When doing so, the library returns this error: raise ValueError(f"Bad split: {split}. Available splits: {list(splits_generators)}") ValueError: Bad split: train[0%:10%]. Available splits: ['train'] Edit: Same happens with a split like _train[:90000]_ ### Steps to reproduce the bug ``` for split in range(10): split_str = f"train[{split*10}%:{(split+1)*10}%]" print(f"Processing split {split_str}...") ds = load_dataset("user/dataset", split=split_str, streaming=True) ``` ### Expected behavior I'd expect the library to split my dataset in 10% steps. ### Environment info python 3.12.11 ubuntu 24 dataset 4.0.0
padmalcom
https://github.com/huggingface/datasets/issues/7721
null
false
3,287,150,513
7,720
Datasets 4.0 map function causing column not found
open
[ "Hi, I tried to reproduce this issue on the latest `main` branch but it seems to be working correctly now. My test script (which creates a dummy dataset and applies the `.map()` function) successfully creates and accesses the new column without a `KeyError`.\n\nIt's possible this was fixed by a recent commit. The maintainers might want to consider closing this issue.", "Hi, have you tried on a large dataset (200GB+) perhaps? I will try my best to do a rerun with main branch when I have the time.", "I ran it on a small dataset, maybe that’s why I didn’t hit the issue. If it still shows up on your side with the latest main, let me know. I can try it on a bigger set too." ]
2025-08-03T12:52:34
2025-08-07T19:23:34
null
### Describe the bug Column returned after mapping is not found in new instance of the dataset. ### Steps to reproduce the bug Code for reproduction. After running get_total_audio_length, it is errored out due to `data` not having `duration` ``` def compute_duration(x): return {"duration": len(x["audio"]["array"]) / x["audio"]["sampling_rate"]} def get_total_audio_length(dataset): data = dataset.map(compute_duration, num_proc=NUM_PROC) print(data) durations=data["duration"] total_seconds = sum(durations) return total_seconds ``` ### Expected behavior New datasets.Dataset instance should have new columns attached. ### Environment info - `datasets` version: 4.0.0 - Platform: Linux-5.4.0-124-generic-x86_64-with-glibc2.31 - Python version: 3.10.13 - `huggingface_hub` version: 0.33.2 - PyArrow version: 20.0.0 - Pandas version: 2.3.0 - `fsspec` version: 2023.12.2
Darejkal
https://github.com/huggingface/datasets/issues/7720
null
false
3,285,928,491
7,719
Specify dataset columns types in typehint
open
[]
2025-08-02T13:22:31
2025-08-02T13:22:31
null
### Feature request Make dataset optionaly generic to datasets usage with type annotations like it was done in `torch.Dataloader` https://github.com/pytorch/pytorch/blob/134179474539648ba7dee1317959529fbd0e7f89/torch/utils/data/dataloader.py#L131 ### Motivation In MTEB we're using a lot of datasets objects, but they're a bit poor in typehints. E.g. we can specify this for dataloder ```python from typing import TypedDict from torch.utils.data import DataLoader class CorpusInput(TypedDict): title: list[str] body: list[str] class QueryInput(TypedDict): query: list[str] instruction: list[str] def queries_loader() -> DataLoader[QueryInput]: ... def corpus_loader() -> DataLoader[CorpusInput]: ... ``` But for datasets we can only specify columns in type in comments ```python from datasets import Dataset QueryDataset = Dataset """Query dataset should have `query` and `instructions` columns as `str` """ ``` ### Your contribution I can create draft implementation
Samoed
https://github.com/huggingface/datasets/issues/7719
null
false
3,284,221,177
7,718
add support for pyarrow string view in features
closed
[ "@lhoestq who do you think would be the best to have a look at this? Any pointers would be appreciated, thanks!", "Hi ! what's the rationale for supporting string view ? I'm afraid it can complexify the typing logic without much value", "Hi @lhoestq ! I mainly want to be able to create features by using `Features.from_arrow_schema(dataset_schema)` on an arrow dataset with string view columns, currently there is no easy way to do this, and string_view is becoming an increasingly common data type for string columns in arrow. Thanks for having a look!", "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7718). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-08-01T14:58:39
2025-09-12T13:14:16
2025-09-12T13:13:24
null
onursatici
https://github.com/huggingface/datasets/pull/7718
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7718", "html_url": "https://github.com/huggingface/datasets/pull/7718", "diff_url": "https://github.com/huggingface/datasets/pull/7718.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7718.patch", "merged_at": "2025-09-12T13:13:24" }
true
3,282,855,127
7,717
Cached dataset is not used when explicitly passing the cache_dir parameter
open
[ "Hi, I've investigated this issue and can confirm the bug. Here are my findings:\n\n**1. Reproduction:**\nI was able to reproduce the issue on the latest `main` branch. Using the provided code snippet, `snapshot_download` correctly populates the custom `cache_dir`, but `load_dataset` with the same `cache_dir` triggers a full re-download and re-processing of the dataset, ignoring the existing cache.\n\n**2. Investigation:**\nI traced the `cache_dir` parameter from `load_dataset` down to the `DatasetBuilder` class in `src/datasets/builder.py`. The root cause seems to be a mismatch between the cache path structure created by `snapshot_download` and the path structure expected by the `DatasetBuilder`.\n\nSpecifically, the `_relative_data_dir` method in `DatasetBuilder` constructs a path using `namespace___dataset_name` (with three underscores), while the cache from `snapshot_download` appears to use a `repo_id` based format like `datasets--namespace--dataset_name` (with double hyphens).\n\n**3. Attempted Fix & Result:**\nI attempted a fix by modifying the `_relative_data_dir` method to replace the path separator \"/\" in `self.repo_id` with \"--\", to align it with the `snapshot_download` structure.\n\nThis partially worked: `load_dataset` no longer re-downloads the files. However, it still re-processes them every time (triggering \"Generating train split...\", etc.) instead of loading the already processed Arrow files from the cache.\n\nThis suggests the issue is deeper than just the directory name and might be related to how the builder verifies the integrity or presence of the processed cache files.\n\nI hope these findings are helpful for whoever picks up this issue." ]
2025-08-01T07:12:41
2025-08-05T19:19:36
null
### Describe the bug Hi, we are pre-downloading a dataset using snapshot_download(). When loading this exact dataset with load_dataset() the cached snapshot is not used. In both calls, I provide the cache_dir parameter. ### Steps to reproduce the bug ``` from datasets import load_dataset, concatenate_datasets from huggingface_hub import snapshot_download def download_ds(name: str): snapshot_download(repo_id=name, repo_type="dataset", cache_dir="G:/Datasets/cache") def prepare_ds(): audio_ds = load_dataset("openslr/librispeech_asr", num_proc=4, cache_dir="G:/Datasets/cache") print(sfw_ds.features) if __name__ == '__main__': download_ds("openslr/librispeech_asr") prepare_ds() ``` ### Expected behavior I'd expect that the cached version of the dataset is used. Instead, the same dataset is downloaded again to the default cache directory. ### Environment info Windows 11 datasets==4.0.0 Python 3.12.11
padmalcom
https://github.com/huggingface/datasets/issues/7717
null
false
3,281,204,362
7,716
typo
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7716). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-07-31T17:14:45
2025-07-31T17:17:15
2025-07-31T17:14:51
null
lhoestq
https://github.com/huggingface/datasets/pull/7716
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7716", "html_url": "https://github.com/huggingface/datasets/pull/7716", "diff_url": "https://github.com/huggingface/datasets/pull/7716.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7716.patch", "merged_at": "2025-07-31T17:14:51" }
true
3,281,189,955
7,715
Docs: Use Image(mode="F") for PNG/JPEG depth maps
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7715). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-07-31T17:09:49
2025-07-31T17:12:23
2025-07-31T17:10:10
null
lhoestq
https://github.com/huggingface/datasets/pull/7715
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7715", "html_url": "https://github.com/huggingface/datasets/pull/7715", "diff_url": "https://github.com/huggingface/datasets/pull/7715.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7715.patch", "merged_at": "2025-07-31T17:10:10" }
true
3,281,090,499
7,714
fix num_proc=1 ci test
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7714). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-07-31T16:36:32
2025-07-31T16:39:03
2025-07-31T16:38:03
null
lhoestq
https://github.com/huggingface/datasets/pull/7714
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7714", "html_url": "https://github.com/huggingface/datasets/pull/7714", "diff_url": "https://github.com/huggingface/datasets/pull/7714.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7714.patch", "merged_at": "2025-07-31T16:38:03" }
true
3,280,813,699
7,713
Update cli.mdx to refer to the new "hf" CLI
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7713). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-07-31T15:06:11
2025-07-31T16:37:56
2025-07-31T16:37:55
Update to refer to `hf auth login`
evalstate
https://github.com/huggingface/datasets/pull/7713
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7713", "html_url": "https://github.com/huggingface/datasets/pull/7713", "diff_url": "https://github.com/huggingface/datasets/pull/7713.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7713.patch", "merged_at": "2025-07-31T16:37:55" }
true
3,280,706,762
7,712
Retry intermediate commits too
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7712). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-07-31T14:33:33
2025-07-31T14:37:43
2025-07-31T14:36:43
null
lhoestq
https://github.com/huggingface/datasets/pull/7712
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7712", "html_url": "https://github.com/huggingface/datasets/pull/7712", "diff_url": "https://github.com/huggingface/datasets/pull/7712.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7712.patch", "merged_at": "2025-07-31T14:36:43" }
true
3,280,471,353
7,711
Update dataset_dict push_to_hub
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7711). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-07-31T13:25:03
2025-07-31T14:18:55
2025-07-31T14:18:53
following https://github.com/huggingface/datasets/pull/7708
lhoestq
https://github.com/huggingface/datasets/pull/7711
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7711", "html_url": "https://github.com/huggingface/datasets/pull/7711", "diff_url": "https://github.com/huggingface/datasets/pull/7711.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7711.patch", "merged_at": "2025-07-31T14:18:53" }
true
3,279,878,230
7,710
Concurrent IterableDataset push_to_hub
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7710). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-07-31T10:11:31
2025-07-31T10:14:00
2025-07-31T10:12:52
Same as https://github.com/huggingface/datasets/pull/7708 but for `IterableDataset`
lhoestq
https://github.com/huggingface/datasets/pull/7710
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7710", "html_url": "https://github.com/huggingface/datasets/pull/7710", "diff_url": "https://github.com/huggingface/datasets/pull/7710.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7710.patch", "merged_at": "2025-07-31T10:12:52" }
true
3,276,677,990
7,709
Release 4.0.0 breaks usage patterns of with_format
closed
[ "This is a breaking change with 4.0 which introduced `Column` objects. To get the numpy array from a `Column` you can `col[i]`, `col[i:j]` or even `col[:]` if you want the full column as a numpy array:\n\n```python\nfrom datasets import load_dataset\ndataset = load_dataset(...)\ndataset = dataset.with_format(\"numpy\")\nprint(dataset[\"star\"][:].ndim)\n```", "Ah perfect, thanks for clearing this up. I would close this ticket then." ]
2025-07-30T11:34:53
2025-08-07T08:27:18
2025-08-07T08:27:18
### Describe the bug Previously it was possible to access a whole column that was e.g. in numpy format via `with_format` by indexing the column. Now this possibility seems to be gone with the new Column() class. As far as I see, this makes working on a whole column (in-memory) more complex, i.e. normalizing an in-memory dataset for which iterating would be too slow. Is this intended behaviour? I couldn't find much documentation on the intended usage of the new Column class yet. ### Steps to reproduce the bug Steps to reproduce: ``` from datasets import load_dataset dataset = load_dataset("lhoestq/demo1") dataset = dataset.with_format("numpy") print(dataset["star"].ndim) ``` ### Expected behavior Working on whole columns should be possible. ### Environment info - `datasets` version: 4.0.0 - Platform: Linux-6.8.0-63-generic-x86_64-with-glibc2.36 - Python version: 3.12.11 - `huggingface_hub` version: 0.34.3 - PyArrow version: 21.0.0 - Pandas version: 2.3.1 - `fsspec` version: 2025.3.0
wittenator
https://github.com/huggingface/datasets/issues/7709
null
false
3,273,614,584
7,708
Concurrent push_to_hub
closed
[ "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7708). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update." ]
2025-07-29T13:14:30
2025-07-31T10:00:50
2025-07-31T10:00:49
Retry the step that (download + update + upload) the README.md using `create_commit(..., parent_commit=...)` if there was a commit in the meantime. This should enable concurrent `push_to_hub()` since it won't overwrite the README.md metadata anymore. Note: we fixed an issue server side to make this work: <details> DO NOT MERGE FOR NOW since it seems there is one bug that prevents this logic from working: I'm using parent_commit to enable concurrent push_to_hub() in datasets for a retry mechanism, but for some reason I always run into a weird situation. Sometimes create_commit(.., parent_commit=...) returns error 500 but the commit did happen on the Hub side without respecting parent_commit e.g. request id ``` huggingface_hub.errors.HfHubHTTPError: 500 Server Error: Internal Server Error for url: https://huggingface.co/api/datasets/lhoestq/tmp/commit/main (Request ID: Root=1-6888d8af-2ce517bc60c69cb378b51526;d1b17993-c5d0-4ccd-9926-060c45f9ed61) ``` fix coming in [internal](https://github.com/huggingface-internal/moon-landing/pull/14617) </details> close https://github.com/huggingface/datasets/issues/7600
lhoestq
https://github.com/huggingface/datasets/pull/7708
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7708", "html_url": "https://github.com/huggingface/datasets/pull/7708", "diff_url": "https://github.com/huggingface/datasets/pull/7708.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7708.patch", "merged_at": "2025-07-31T10:00:49" }
true
3,271,867,998
7,707
load_dataset() in 4.0.0 failed when decoding audio
closed
[ "Hi @lhoestq . Would you please have a look at it? I use the official NV Docker ([NV official docker image](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch): `nvcr.io/nvidia/pytorch:25.06-py3`) on A100 and encountered this issue, but I don't know how to fix it.", "Use !pip install -U datasets[audio] rather than !pip install datasets\n\nI got the solution from this link [https://github.com/huggingface/datasets/issues/7678](https://github.com/huggingface/datasets/issues/7678), and it processes the data; however, it led to certain transformer importnerrors", "> https://github.com/huggingface/datasets/issues/7678\n\nHi @asantewaa-bremang . Thanks for your reply, but sadly it does not work for me.", "It looks like a torchcodec issue, have you tried to look at the torchcodec issues here in case someone has the same issue ? https://github.com/pytorch/torchcodec/issues\n\notherwise feel free to open a new issue there", "@jiqing-feng, are you running the code on Colab? If you are, you should restart after making this installation ! pip install -U datasets[audio]. ", "> [@jiqing-feng](https://github.com/jiqing-feng), are you running the code on Colab? If you are, you should restart after making this installation ! pip install -U datasets[audio].\n\nNo, I ran the script on the A100 instance locally.", "> It looks like a torchcodec issue, have you tried to look at the torchcodec issues here in case someone has the same issue ? https://github.com/pytorch/torchcodec/issues\n> \n> otherwise feel free to open a new issue there\n\nThanks! I've opened a new issue on torchcodec. Could we have a fallback implementation without torchcodec (just like datasets==3.6.0) ?", "> Thanks! I've opened a new issue on torchcodec. Could we have a fallback implementation without torchcodec (just like datasets==3.6.0) ?\n\nFor now I'd recommend using `datasets==3.6.0` if this issue is blocking for you", "Resolved by installing the pre-release torchcodec. Thanks!", "Same. torchcodec==0.6.0 failed, torchcodec==0.5.0 solved", "So what combination of 'datasets' and 'torchcodec' worked out?", "> So what combination of 'datasets' and 'torchcodec' worked out?\n\nnice mate! \njust about to write this massage!!!!!\n\n\n\nwhen this will solve????\n", "torchcodec 0.7 fails\n0.5 not guaranty to work with torch 2.8\n\n", "> Resolved by installing the pre-release torchcodec. Thanks!\n\nhow to install the pre-release torchcodec, when I use pip install --pre torchcodec, it do not download new version", "i fixed this issue by install :\n\nconda install \"ffmpeg<8\"\nor\nconda install \"ffmpeg<8\" -c conda-forge\n\nyou can find more info : https://github.com/meta-pytorch/torchcodec?tab=readme-ov-file#installing-torchcodec", "It loads fine with datasets==3.6.0" ]
2025-07-29T03:25:03
2025-10-05T06:41:38
2025-08-01T05:15:45
### Describe the bug Cannot decode audio data. ### Steps to reproduce the bug ```python from datasets import load_dataset dataset = load_dataset("hf-internal-testing/librispeech_asr_demo", "clean", split="validation") print(dataset[0]["audio"]["array"]) ``` 1st round run, got ``` File "/usr/local/lib/python3.12/dist-packages/datasets/features/audio.py", line 172, in decode_example raise ImportError("To support decoding audio data, please install 'torchcodec'.") ImportError: To support decoding audio data, please install 'torchcodec'. ``` After `pip install torchcodec` and run, got ``` File "/usr/local/lib/python3.12/dist-packages/torchcodec/_core/_metadata.py", line 16, in <module> from torchcodec._core.ops import ( File "/usr/local/lib/python3.12/dist-packages/torchcodec/_core/ops.py", line 84, in <module> load_torchcodec_shared_libraries() File "/usr/local/lib/python3.12/dist-packages/torchcodec/_core/ops.py", line 69, in load_torchcodec_shared_libraries raise RuntimeError( RuntimeError: Could not load libtorchcodec. Likely causes: 1. FFmpeg is not properly installed in your environment. We support versions 4, 5, 6 and 7. 2. The PyTorch version (2.8.0a0+5228986c39.nv25.06) is not compatible with this version of TorchCodec. Refer to the version compatibility table: https://github.com/pytorch/torchcodec?tab=readme-ov-file#installing-torchcodec. 3. Another runtime dependency; see exceptions below. The following exceptions were raised as we tried to load libtorchcodec: [start of libtorchcodec loading traceback] FFmpeg version 7: libavutil.so.59: cannot open shared object file: No such file or directory FFmpeg version 6: libavutil.so.58: cannot open shared object file: No such file or directory FFmpeg version 5: libavutil.so.57: cannot open shared object file: No such file or directory FFmpeg version 4: libavutil.so.56: cannot open shared object file: No such file or directory [end of libtorchcodec loading traceback]. ``` After `apt update && apt install ffmpeg -y`, got ``` Traceback (most recent call last): File "/workspace/jiqing/test_datasets.py", line 4, in <module> print(dataset[0]["audio"]["array"]) ~~~~~~~^^^ File "/usr/local/lib/python3.12/dist-packages/datasets/arrow_dataset.py", line 2859, in __getitem__ return self._getitem(key) ^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/datasets/arrow_dataset.py", line 2841, in _getitem formatted_output = format_table( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/datasets/formatting/formatting.py", line 657, in format_table return formatter(pa_table, query_type=query_type) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/datasets/formatting/formatting.py", line 410, in __call__ return self.format_row(pa_table) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/datasets/formatting/formatting.py", line 459, in format_row row = self.python_features_decoder.decode_row(row) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/datasets/formatting/formatting.py", line 223, in decode_row return self.features.decode_example(row, token_per_repo_id=self.token_per_repo_id) if self.features else row ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/datasets/features/features.py", line 2093, in decode_example column_name: decode_nested_example(feature, value, token_per_repo_id=token_per_repo_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/datasets/features/features.py", line 1405, in decode_nested_example return schema.decode_example(obj, token_per_repo_id=token_per_repo_id) if obj is not None else None ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/datasets/features/audio.py", line 198, in decode_example audio = AudioDecoder(bytes, stream_index=self.stream_index, sample_rate=self.sampling_rate) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/torchcodec/decoders/_audio_decoder.py", line 62, in __init__ self._decoder = create_decoder(source=source, seek_mode="approximate") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/torchcodec/decoders/_decoder_utils.py", line 33, in create_decoder return core.create_from_bytes(source, seek_mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/torchcodec/_core/ops.py", line 144, in create_from_bytes return create_from_tensor(buffer, seek_mode) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/dist-packages/torch/_ops.py", line 756, in __call__ return self._op(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ NotImplementedError: Could not run 'torchcodec_ns::create_from_tensor' with arguments from the 'CPU' backend. This could be because the operator doesn't exist for this backend, or was omitted during the selective/custom build process (if using custom build). If you are a Facebook employee using PyTorch on mobile, please visit https://fburl.com/ptmfixes for possible resolutions. 'torchcodec_ns::create_from_tensor' is only available for these backends: [Meta, BackendSelect, Python, FuncTorchDynamicLayerBackMode, Functionalize, Named, Conjugate, Negative, ZeroTensor, ADInplaceOrView, AutogradOther, AutogradCPU, AutogradCUDA, AutogradXLA, AutogradMPS, AutogradXPU, AutogradHPU, AutogradLazy, AutogradMTIA, AutogradMAIA, AutogradMeta, Tracer, AutocastCPU, AutocastMTIA, AutocastMAIA, AutocastXPU, AutocastMPS, AutocastCUDA, FuncTorchBatched, BatchedNestedTensor, FuncTorchVmapMode, Batched, VmapMode, FuncTorchGradWrapper, PythonTLSSnapshot, FuncTorchDynamicLayerFrontMode, PreDispatch, PythonDispatcher]. Meta: registered at /dev/null:214 [kernel] BackendSelect: fallthrough registered at /opt/pytorch/pytorch/aten/src/ATen/core/BackendSelectFallbackKernel.cpp:3 [backend fallback] Python: registered at /__w/torchcodec/torchcodec/pytorch/torchcodec/src/torchcodec/_core/custom_ops.cpp:694 [kernel] FuncTorchDynamicLayerBackMode: registered at /opt/pytorch/pytorch/aten/src/ATen/functorch/DynamicLayer.cpp:479 [backend fallback] Functionalize: registered at /opt/pytorch/pytorch/aten/src/ATen/FunctionalizeFallbackKernel.cpp:349 [backend fallback] Named: registered at /opt/pytorch/pytorch/aten/src/ATen/core/NamedRegistrations.cpp:7 [backend fallback] Conjugate: registered at /opt/pytorch/pytorch/aten/src/ATen/ConjugateFallback.cpp:17 [backend fallback] Negative: registered at /opt/pytorch/pytorch/aten/src/ATen/native/NegateFallback.cpp:18 [backend fallback] ZeroTensor: registered at /opt/pytorch/pytorch/aten/src/ATen/ZeroTensorFallback.cpp:86 [backend fallback] ADInplaceOrView: fallthrough registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:104 [backend fallback] AutogradOther: registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:63 [backend fallback] AutogradCPU: registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:67 [backend fallback] AutogradCUDA: registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:75 [backend fallback] AutogradXLA: registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:87 [backend fallback] AutogradMPS: registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:95 [backend fallback] AutogradXPU: registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:71 [backend fallback] AutogradHPU: registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:108 [backend fallback] AutogradLazy: registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:91 [backend fallback] AutogradMTIA: registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:79 [backend fallback] AutogradMAIA: registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:83 [backend fallback] AutogradMeta: registered at /opt/pytorch/pytorch/aten/src/ATen/core/VariableFallbackKernel.cpp:99 [backend fallback] Tracer: registered at /opt/pytorch/pytorch/torch/csrc/autograd/TraceTypeManual.cpp:294 [backend fallback] AutocastCPU: fallthrough registered at /opt/pytorch/pytorch/aten/src/ATen/autocast_mode.cpp:322 [backend fallback] AutocastMTIA: fallthrough registered at /opt/pytorch/pytorch/aten/src/ATen/autocast_mode.cpp:466 [backend fallback] AutocastMAIA: fallthrough registered at /opt/pytorch/pytorch/aten/src/ATen/autocast_mode.cpp:504 [backend fallback] AutocastXPU: fallthrough registered at /opt/pytorch/pytorch/aten/src/ATen/autocast_mode.cpp:542 [backend fallback] AutocastMPS: fallthrough registered at /opt/pytorch/pytorch/aten/src/ATen/autocast_mode.cpp:209 [backend fallback] AutocastCUDA: fallthrough registered at /opt/pytorch/pytorch/aten/src/ATen/autocast_mode.cpp:165 [backend fallback] FuncTorchBatched: registered at /opt/pytorch/pytorch/aten/src/ATen/functorch/LegacyBatchingRegistrations.cpp:731 [backend fallback] BatchedNestedTensor: registered at /opt/pytorch/pytorch/aten/src/ATen/functorch/LegacyBatchingRegistrations.cpp:758 [backend fallback] FuncTorchVmapMode: fallthrough registered at /opt/pytorch/pytorch/aten/src/ATen/functorch/VmapModeRegistrations.cpp:27 [backend fallback] Batched: registered at /opt/pytorch/pytorch/aten/src/ATen/LegacyBatchingRegistrations.cpp:1075 [backend fallback] VmapMode: fallthrough registered at /opt/pytorch/pytorch/aten/src/ATen/VmapModeRegistrations.cpp:33 [backend fallback] FuncTorchGradWrapper: registered at /opt/pytorch/pytorch/aten/src/ATen/functorch/TensorWrapper.cpp:208 [backend fallback] PythonTLSSnapshot: registered at /opt/pytorch/pytorch/aten/src/ATen/core/PythonFallbackKernel.cpp:202 [backend fallback] FuncTorchDynamicLayerFrontMode: registered at /opt/pytorch/pytorch/aten/src/ATen/functorch/DynamicLayer.cpp:475 [backend fallback] PreDispatch: registered at /opt/pytorch/pytorch/aten/src/ATen/core/PythonFallbackKernel.cpp:206 [backend fallback] PythonDispatcher: registered at /opt/pytorch/pytorch/aten/src/ATen/core/PythonFallbackKernel.cpp:198 [backend fallback] ``` ### Expected behavior The result is ``` [0.00238037 0.0020752 0.00198364 ... 0.00042725 0.00057983 0.0010376 ] ``` on `datasets==3.6.0` ### Environment info [NV official docker image](https://catalog.ngc.nvidia.com/orgs/nvidia/containers/pytorch): `nvcr.io/nvidia/pytorch:25.06-py3` ``` - `datasets` version: 4.0.0 - Platform: Linux-5.4.292-1.el8.elrepo.x86_64-x86_64-with-glibc2.39 - Python version: 3.12.3 - `huggingface_hub` version: 0.34.2 - PyArrow version: 19.0.1 - Pandas version: 2.2.3 - `fsspec` version: 2025.3.0 ```
jiqing-feng
https://github.com/huggingface/datasets/issues/7707
null
false
3,271,129,240
7,706
Reimplemented partial split download support (revival of #6832)
open
[ " Mario’s Patch (in PR #6832):\r\n```\r\ndef _make_split_generators_kwargs(self, prepare_split_kwargs):\r\n # Pass `pipeline` into `_split_generators()` from `prepare_split_kwargs` if\r\n # it's in the call signature of `_split_generators()`.\r\n # This allows for global preprocessing in beam.\r\n split_generators_kwargs = {}\r\n if \"pipeline\" in inspect.signature(self._split_generators).parameters:\r\n split_generators_kwargs[\"pipeline\"] = prepare_split_kwargs[\"pipeline\"]\r\n split_generators_kwargs.update(super()._make_split_generators_kwargs(prepare_split_kwargs))\r\n return split_generators_kwargs\r\n```\r\n\r\nIn the latest main(in my fork and og repo's main):\r\n```\r\ndef _make_split_generators_kwargs(self, prepare_split_kwargs):\r\n \"\"\"Get kwargs for `self._split_generators()` from `prepare_split_kwargs`.\"\"\"\r\n splits = prepare_split_kwargs.pop(\"splits\", None)\r\n if self._supports_partial_generation():\r\n return {\"splits\": splits}\r\n return {}\r\n```\r\nIt enables passing splits into _split_generators() only for builders that support it(if i am not wrong..). So ignored Beam logic for now!", "Awesome ! btw we can modify the GeneratorBasedBuilder and ArrowBasedBuilder if needed now that custom loading scripts are not supported anymore :)\r\n\r\nI'll review this in a bit" ]
2025-07-28T19:40:40
2025-09-04T10:55:57
null
(revival of #6832) https://github.com/huggingface/datasets/pull/7648#issuecomment-3084050130 Close https://github.com/huggingface/datasets/issues/4101, and more --- ### PR under work!!!!
ArjunJagdale
https://github.com/huggingface/datasets/pull/7706
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7706", "html_url": "https://github.com/huggingface/datasets/pull/7706", "diff_url": "https://github.com/huggingface/datasets/pull/7706.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7706.patch", "merged_at": null }
true
3,269,070,499
7,705
Can Not read installed dataset in dataset.load(.)
open
[ "You can download the dataset locally using [huggingface_hub.snapshot_download](https://huggingface.co/docs/huggingface_hub/v0.34.3/en/package_reference/file_download#huggingface_hub.snapshot_download) and then do\n\n```python\ndataset = load_dataset(local_directory_path)\n```", "> You can download the dataset locally using [huggingface_hub.snapshot_download](https://huggingface.co/docs/huggingface_hub/v0.34.3/en/package_reference/file_download#huggingface_hub.snapshot_download) and then do\n> \n> dataset = load_dataset(local_directory_path)\n\nIt's good suggestion, but my server env is network restriction. It can not directly fetch data from huggingface. I spent lot of time to download and transfer it to the server.\nSo, I attempt to make load_dataset connect to my local dataset. ", "Just Solved it few day before. Will post solution later...\nalso thanks folks quick reply.." ]
2025-07-28T09:43:54
2025-08-05T01:24:32
null
Hi, folks, I'm newbie in huggingface dataset api. As title, i'm facing the issue that the dataset.load api can not connect to the installed dataset. code snippet : <img width="572" height="253" alt="Image" src="https://github.com/user-attachments/assets/10f48aaf-d6ca-4239-b1cf-145d74f125d1" /> data path : "/xxx/joseph/llava_ds/vlm_ds" it contains all video clips i want! <img width="1398" height="261" alt="Image" src="https://github.com/user-attachments/assets/bf213b66-e344-4311-97e7-bc209677ae77" /> i run the py script by <img width="1042" height="38" alt="Image" src="https://github.com/user-attachments/assets/8b3fcee4-e1a6-41b8-bee1-91567b00d9d2" /> But bad happended, even i provide dataset path by "HF_HUB_CACHE", it still attempt to download data from remote side : <img width="1697" height="813" alt="Image" src="https://github.com/user-attachments/assets/baa6cff1-a724-4710-a8c4-4805459deffb" /> Any suggestion will be appreciated!!
HuangChiEn
https://github.com/huggingface/datasets/issues/7705
null
false
3,265,730,177
7,704
Fix map() example in datasets documentation: define tokenizer before use
closed
[ "Hi @lhoestq, just a gentle follow-up on this doc fix PR (#7704). Let me know if any changes are needed β€” happy to update.\r\nHope this improvement helps users run the example without confusion!", "the modified file is the readme of the docs, not about map() specifically" ]
2025-07-26T14:18:17
2025-08-13T13:23:18
2025-08-13T13:06:37
## Problem The current datasets.Dataset.map() example in the documentation demonstrates batched processing using a tokenizer object without defining or importing it. This causes a NameError when users copy and run the example as-is, breaking the expected seamless experience. ## Correction This PR fixes the issue by explicitly importing and initializing the tokenizer using the Transformers library (AutoTokenizer.from_pretrained("bert-base-uncased")), making the example self-contained and runnable without errors. This will help new users understand the workflow and apply the method correctly. Closes #7703
Sanjaykumar030
https://github.com/huggingface/datasets/pull/7704
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7704", "html_url": "https://github.com/huggingface/datasets/pull/7704", "diff_url": "https://github.com/huggingface/datasets/pull/7704.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7704.patch", "merged_at": null }
true
3,265,648,942
7,703
[Docs] map() example uses undefined `tokenizer` β€” causes NameError
open
[ "I've submitted PR #7704 which adds documentation to clarify the behavior of `map()` when returning `None`." ]
2025-07-26T13:35:11
2025-07-27T09:44:35
null
## Description The current documentation example for `datasets.Dataset.map()` demonstrates batched processing but uses a `tokenizer` object without defining or importing it. This causes an error every time it's copied. Here is the problematic line: ```python # process a batch of examples >>> ds = ds.map(lambda example: tokenizer(example["text"]), batched=True) ``` This assumes the user has already set up a tokenizer, which contradicts the goal of having self-contained, copy-paste-friendly examples. ## Problem Users who copy and run the example as-is will encounter: ```python NameError: name 'tokenizer' is not defined ``` This breaks the flow for users and violates HuggingFace's documentation principle that examples should "work as expected" when copied directly. ## Proposal Update the example to include the required tokenizer setup using the Transformers library, like so: ```python from transformers import AutoTokenizer tokenizer = AutoTokenizer.from_pretrained("bert-base-uncased") ds_tokenized = ds.map(lambda example: tokenizer(example["text"]), batched=True) ``` This will help new users understand the workflow and apply the method correctly. ## Note This PR complements ongoing improvements like #7700, which clarifies multiprocessing in .map(). My change focuses on undefined tokenizer β€” causes NameError
Sanjaykumar030
https://github.com/huggingface/datasets/issues/7703
null
false
3,265,328,549
7,702
num_proc=0 behave like None, num_proc=1 uses one worker (not main process) and clarify num_proc documentation
closed
[ "I think we can support num_proc=0 and make it equivalent to `None` to make it simpler", "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7702). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.", "> I think we can support num_proc=0 and make it equivalent to `None` to make it simpler\r\n\r\nThank you @lhoestq for reviewing it. Please let me know if anything needs to be updated further." ]
2025-07-26T08:19:39
2025-07-31T14:52:33
2025-07-31T14:52:33
Fixes issue #7700 This PR makes num_proc=0 behave like None in Dataset.map(), disabling multiprocessing. It improves UX by aligning with DataLoader(num_workers=0) behavior. The num_proc docstring is also updated to clearly explain valid values and behavior. @SunMarc
tanuj-rai
https://github.com/huggingface/datasets/pull/7702
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7702", "html_url": "https://github.com/huggingface/datasets/pull/7702", "diff_url": "https://github.com/huggingface/datasets/pull/7702.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7702.patch", "merged_at": "2025-07-31T14:52:33" }
true
3,265,236,296
7,701
Update fsspec max version to current release 2025.7.0
closed
[ "@lhoestq I ran the test suite locally and while some tests were failing those failures are present on the main branch too. Could you please review and trigger the CI?", "The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_7701). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.", "Which release will this be available in ? I'm running into this issue with `datasets=3.6.0`" ]
2025-07-26T06:47:59
2025-08-13T17:32:07
2025-07-28T11:58:11
Diffusers currently asks for a max fsspec version of `2025.3.0`. This change updates it to the current latest version. This change is mainly required to resolve conflicts with other packages in an environment. In my particular case, `aider-chat` which is a part of my environment installs `2025.5.1` which is incompatible with `datasets`.
rootAvish
https://github.com/huggingface/datasets/pull/7701
{ "url": "https://api.github.com/repos/huggingface/datasets/pulls/7701", "html_url": "https://github.com/huggingface/datasets/pull/7701", "diff_url": "https://github.com/huggingface/datasets/pull/7701.diff", "patch_url": "https://github.com/huggingface/datasets/pull/7701.patch", "merged_at": "2025-07-28T11:58:11" }
true
3,263,922,255
7,700
[doc] map.num_proc needs clarification
open
[]
2025-07-25T17:35:09
2025-07-25T17:39:36
null
https://huggingface.co/docs/datasets/v4.0.0/en/package_reference/main_classes#datasets.Dataset.map.num_proc ``` num_proc (int, optional, defaults to None) β€” Max number of processes when generating cache. Already cached shards are loaded sequentially. ``` for batch: ``` num_proc (int, optional, defaults to None): The number of processes to use for multiprocessing. If None, no multiprocessing is used. This can significantly speed up batching for large datasets. ``` So what happens to `map.num_proc` - is it the same behavior as `batch.num_proc` - so only if `num_proc=None` then no multiprocessing is used? Let's update the doc to be unambiguous. **bonus**: we could make all of these behave similarly to `DataLoader.num_workers` - where `num_workers==0` implies no multiprocessing. I think that's the most intuitive, IMHO. 0 workers - the main process has to do all the work. `None` could be the same as `0`. context: debugging a failing `map` Thank you!
sfc-gh-sbekman
https://github.com/huggingface/datasets/issues/7700
null
false
3,261,053,171
7,699
Broken link in documentation for "Create a video dataset"
open
[ "The URL is ok but it seems the webdataset website is down. There seems to be a related issue here: https://github.com/webdataset/webdataset/issues/155\n\nFeel free to ask the authors there for an update. Otherwise happy to witch the link to the mirror shared in that issue" ]
2025-07-24T19:46:28
2025-07-25T15:27:47
null
The link to "the [WebDataset documentation](https://webdataset.github.io/webdataset)." is broken. https://huggingface.co/docs/datasets/main/en/video_dataset#webdataset <img width="2048" height="264" alt="Image" src="https://github.com/user-attachments/assets/975dd10c-aad8-42fc-9fbc-de0e2747a326" />
cleong110
https://github.com/huggingface/datasets/issues/7699
null
false
3,255,350,916
7,698
NotImplementedError when using streaming=True in Google Colab environment
open
[ "Hi, @Aniket17200, try upgrading datasets using '!pip install -U datasets'. I hope this will resolve your issue.", "Thank you @tanuj-rai, it's working great " ]
2025-07-23T08:04:53
2025-07-23T15:06:23
null
### Describe the bug When attempting to load a large dataset (like tiiuae/falcon-refinedweb or allenai/c4) using streaming=True in a standard Google Colab notebook, the process fails with a NotImplementedError: Loading a streaming dataset cached in a LocalFileSystem is not supported yet. This issue persists even after upgrading datasets and huggingface_hub and restarting the session. ### Steps to reproduce the bug Open a new Google Colab notebook. (Optional but recommended) Run !pip install --upgrade datasets huggingface_hub and restart the runtime. Run the following code: Python from datasets import load_dataset try: print("Attempting to load a stream...") streaming_dataset = load_dataset('tiiuae/falcon-refinedweb', streaming=True) print("Success!") except Exception as e: print(e) ### Expected behavior The load_dataset command should return a StreamingDataset object without raising an error, allowing iteration over the dataset. Actual Behavior The code fails and prints the following error traceback: [PASTE THE FULL ERROR TRACEBACK HERE] (Note: Copy the entire error message you received, from Traceback... to the final error line, and paste it in this section.) ### Environment info Platform: Google Colab datasets version: [Run !pip show datasets in Colab and paste the version here] huggingface_hub version: [Run !pip show huggingface_hub and paste the version here] Python version: [Run !python --version and paste the version here]
Aniket17200
https://github.com/huggingface/datasets/issues/7698
null
false
3,254,526,399
7,697
-
closed
[]
2025-07-23T01:30:32
2025-07-25T15:21:39
2025-07-25T15:21:39
-
ghost
https://github.com/huggingface/datasets/issues/7697
null
false