load json file error with v2.20.0

Thanks for reporting, @xiaoyaolangzhi.

Indeed, we are currently requiring `pandas` >= 2.0.0.

You will need to update pandas in your local environment:
```
pip install -U pandas
```

### Describe the bug

```
load_dataset(path="json", data_files="./test.json")
```
```
Generating train split: 0 examples [00:00, ? examples/s]
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/datasets/packaged_modules/json/json.py", line 132, in _generate_tables
    pa_table = paj.read_json(
  File "pyarrow/_json.pyx", line 308, in pyarrow._json.read_json
  File "pyarrow/error.pxi", line 154, in pyarrow.lib.pyarrow_internal_check_status
  File "pyarrow/error.pxi", line 91, in pyarrow.lib.check_status
pyarrow.lib.ArrowInvalid: JSON parse error: Column() changed from object to array in row 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1997, in _prepare_split_single
    for _, table in generator:
  File "/usr/local/lib/python3.10/dist-packages/datasets/packaged_modules/json/json.py", line 155, in _generate_tables
    df = pd.read_json(f, dtype_backend="pyarrow")
  File "/usr/local/lib/python3.10/dist-packages/pandas/util/_decorators.py", line 211, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/pandas/util/_decorators.py", line 331, in wrapper
    return func(*args, **kwargs)
TypeError: read_json() got an unexpected keyword argument 'dtype_backend'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/app/t1.py", line 11, in <module>
    load_dataset(path=data_path, data_files="./t2.json")
  File "/usr/local/lib/python3.10/dist-packages/datasets/load.py", line 2616, in load_dataset
    builder_instance.download_and_prepare(
  File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1029, in download_and_prepare
    self._download_and_prepare(
  File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1124, in _download_and_prepare
    self._prepare_split(split_generator, **prepare_split_kwargs)
  File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 1884, in _prepare_split
    for job_id, done, content in self._prepare_split_single(
  File "/usr/local/lib/python3.10/dist-packages/datasets/builder.py", line 2040, 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
```
```
import pandas as pd
with open("./test.json", "r") as f:
    df = pd.read_json(f, dtype_backend="pyarrow")
```
```
Traceback (most recent call last):
  File "/app/t3.py", line 3, in <module>
    df = pd.read_json(f, dtype_backend="pyarrow")
  File "/usr/local/lib/python3.10/dist-packages/pandas/util/_decorators.py", line 211, in wrapper
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/pandas/util/_decorators.py", line 331, in wrapper
    return func(*args, **kwargs)
TypeError: read_json() got an unexpected keyword argument 'dtype_backend'
```

### Steps to reproduce the bug

.

### Expected behavior

.

### Environment info

 ```
datasets                  2.20.0
pandas                    1.5.3
```


Ensure compatibility with numpy 2.0.0

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6976). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Show benchmarks

PyArrow==8.0.0

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005361 / 0.011353 (-0.005992) | 0.003983 / 0.011008 (-0.007025) | 0.062865 / 0.038508 (0.024357) | 0.029880 / 0.023109 (0.006771) | 0.261465 / 0.275898 (-0.014433) | 0.269791 / 0.323480 (-0.053689) | 0.004198 / 0.007986 (-0.003788) | 0.002942 / 0.004328 (-0.001387) | 0.049002 / 0.004250 (0.044751) | 0.043232 / 0.037052 (0.006180) | 0.328774 / 0.258489 (0.070285) | 0.297308 / 0.293841 (0.003467) | 0.030552 / 0.128546 (-0.097994) | 0.012632 / 0.075646 (-0.063015) | 0.204156 / 0.419271 (-0.215116) | 0.036014 / 0.043533 (-0.007519) | 0.241224 / 0.255139 (-0.013915) | 0.268358 / 0.283200 (-0.014842) | 0.019227 / 0.141683 (-0.122456) | 1.114515 / 1.452155 (-0.337639) | 1.147029 / 1.492716 (-0.345688) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.094925 / 0.018006 (0.076919) | 0.301548 / 0.000490 (0.301059) | 0.000211 / 0.000200 (0.000011) | 0.000043 / 0.000054 (-0.000011) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.018875 / 0.037411 (-0.018536) | 0.062824 / 0.014526 (0.048298) | 0.075657 / 0.176557 (-0.100900) | 0.121926 / 0.737135 (-0.615209) | 0.077102 / 0.296338 (-0.219236) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.286018 / 0.215209 (0.070808) | 2.832222 / 2.077655 (0.754567) | 1.462629 / 1.504120 (-0.041491) | 1.354746 / 1.541195 (-0.186449) | 1.339504 / 1.468490 (-0.128986) | 0.718381 / 4.584777 (-3.866396) | 2.401456 / 3.745712 (-1.344256) | 3.013518 / 5.269862 (-2.256343) | 1.944892 / 4.565676 (-2.620784) | 0.078793 / 0.424275 (-0.345482) | 0.005219 / 0.007607 (-0.002388) | 0.349551 / 0.226044 (0.123507) | 3.417844 / 2.268929 (1.148916) | 1.830669 / 55.444624 (-53.613956) | 1.502134 / 6.876477 (-5.374343) | 1.529242 / 2.142072 (-0.612830) | 0.793732 / 4.805227 (-4.011495) | 0.133571 / 6.500664 (-6.367093) | 0.042588 / 0.075469 (-0.032881) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.988167 / 1.841788 (-0.853620) | 11.926728 / 8.074308 (3.852420) | 9.806971 / 10.191392 (-0.384421) | 0.173951 / 0.680424 (-0.506473) | 0.015308 / 0.534201 (-0.518893) | 0.310768 / 0.579283 (-0.268515) | 0.268261 / 0.434364 (-0.166103) | 0.342962 / 0.540337 (-0.197375) | 0.431255 / 1.386936 (-0.955681) |

PyArrow==latest

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005680 / 0.011353 (-0.005673) | 0.004231 / 0.011008 (-0.006778) | 0.051009 / 0.038508 (0.012501) | 0.031431 / 0.023109 (0.008322) | 0.268582 / 0.275898 (-0.007316) | 0.287942 / 0.323480 (-0.035538) | 0.004442 / 0.007986 (-0.003543) | 0.002818 / 0.004328 (-0.001511) | 0.050241 / 0.004250 (0.045991) | 0.039933 / 0.037052 (0.002881) | 0.285814 / 0.258489 (0.027325) | 0.316082 / 0.293841 (0.022241) | 0.032416 / 0.128546 (-0.096130) | 0.012398 / 0.075646 (-0.063248) | 0.060779 / 0.419271 (-0.358493) | 0.033706 / 0.043533 (-0.009827) | 0.273915 / 0.255139 (0.018776) | 0.289752 / 0.283200 (0.006553) | 0.017859 / 0.141683 (-0.123824) | 1.150224 / 1.452155 (-0.301930) | 1.197467 / 1.492716 (-0.295250) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.093810 / 0.018006 (0.075803) | 0.302529 / 0.000490 (0.302039) | 0.000221 / 0.000200 (0.000021) | 0.000047 / 0.000054 (-0.000008) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.022903 / 0.037411 (-0.014508) | 0.077445 / 0.014526 (0.062919) | 0.089335 / 0.176557 (-0.087222) | 0.130848 / 0.737135 (-0.606287) | 0.091106 / 0.296338 (-0.205232) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.294194 / 0.215209 (0.078985) | 2.886983 / 2.077655 (0.809328) | 1.557768 / 1.504120 (0.053648) | 1.424467 / 1.541195 (-0.116727) | 1.440625 / 1.468490 (-0.027865) | 0.724793 / 4.584777 (-3.859984) | 0.985216 / 3.745712 (-2.760496) | 2.856826 / 5.269862 (-2.413036) | 1.911638 / 4.565676 (-2.654039) | 0.080350 / 0.424275 (-0.343925) | 0.005616 / 0.007607 (-0.001991) | 0.348713 / 0.226044 (0.122668) | 3.414764 / 2.268929 (1.145835) | 1.925056 / 55.444624 (-53.519568) | 1.635752 / 6.876477 (-5.240725) | 1.761117 / 2.142072 (-0.380955) | 0.808309 / 4.805227 (-3.996918) | 0.136893 / 6.500664 (-6.363771) | 0.042116 / 0.075469 (-0.033354) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.004740 / 1.841788 (-0.837048) | 12.495859 / 8.074308 (4.421550) | 10.681233 / 10.191392 (0.489841) | 0.133320 / 0.680424 (-0.547104) | 0.015943 / 0.534201 (-0.518258) | 0.304869 / 0.579283 (-0.274414) | 0.128616 / 0.434364 (-0.305748) | 0.345930 / 0.540337 (-0.194407) | 0.457434 / 1.386936 (-0.929502) |

![](https://cml.dev/watermark.png#84d9dea52098c9403efb43d5b542dd6d45000bec "CML watermark")

Following the conversion guide, copy=False is no longer required and will result in an error: https://numpy.org/devdocs/numpy_2_0_migration_guide.html#adapting-to-changes-in-the-copy-keyword.

The following fix should resolve the issue.

error found during testing on the MTEB repository e.g. [here](https://github.com/embeddings-benchmark/mteb/pull/938)


The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6975). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Show benchmarks

PyArrow==8.0.0

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005168 / 0.011353 (-0.006185) | 0.003720 / 0.011008 (-0.007288) | 0.063347 / 0.038508 (0.024839) | 0.031474 / 0.023109 (0.008364) | 0.243233 / 0.275898 (-0.032665) | 0.276695 / 0.323480 (-0.046785) | 0.004109 / 0.007986 (-0.003877) | 0.002689 / 0.004328 (-0.001639) | 0.049522 / 0.004250 (0.045271) | 0.043477 / 0.037052 (0.006425) | 0.258578 / 0.258489 (0.000088) | 0.288134 / 0.293841 (-0.005707) | 0.027836 / 0.128546 (-0.100710) | 0.010677 / 0.075646 (-0.064969) | 0.206412 / 0.419271 (-0.212860) | 0.036204 / 0.043533 (-0.007329) | 0.250588 / 0.255139 (-0.004551) | 0.272354 / 0.283200 (-0.010846) | 0.018359 / 0.141683 (-0.123324) | 1.118867 / 1.452155 (-0.333288) | 1.157318 / 1.492716 (-0.335399) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.092927 / 0.018006 (0.074921) | 0.298252 / 0.000490 (0.297762) | 0.000228 / 0.000200 (0.000028) | 0.000042 / 0.000054 (-0.000013) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.018824 / 0.037411 (-0.018588) | 0.069304 / 0.014526 (0.054778) | 0.075094 / 0.176557 (-0.101462) | 0.122546 / 0.737135 (-0.614590) | 0.076453 / 0.296338 (-0.219885) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.287131 / 0.215209 (0.071922) | 2.838945 / 2.077655 (0.761291) | 1.473578 / 1.504120 (-0.030542) | 1.351214 / 1.541195 (-0.189981) | 1.354924 / 1.468490 (-0.113566) | 0.577092 / 4.584777 (-4.007685) | 2.348072 / 3.745712 (-1.397640) | 2.762130 / 5.269862 (-2.507732) | 1.725195 / 4.565676 (-2.840482) | 0.063596 / 0.424275 (-0.360679) | 0.004921 / 0.007607 (-0.002686) | 0.335422 / 0.226044 (0.109377) | 3.340398 / 2.268929 (1.071469) | 1.789390 / 55.444624 (-53.655234) | 1.516247 / 6.876477 (-5.360229) | 1.529653 / 2.142072 (-0.612420) | 0.643547 / 4.805227 (-4.161680) | 0.116491 / 6.500664 (-6.384173) | 0.042404 / 0.075469 (-0.033065) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.959839 / 1.841788 (-0.881948) | 11.269778 / 8.074308 (3.195470) | 9.574898 / 10.191392 (-0.616494) | 0.128979 / 0.680424 (-0.551444) | 0.013901 / 0.534201 (-0.520300) | 0.280778 / 0.579283 (-0.298505) | 0.256511 / 0.434364 (-0.177853) | 0.319361 / 0.540337 (-0.220977) | 0.411803 / 1.386936 (-0.975133) |

PyArrow==latest

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005453 / 0.011353 (-0.005899) | 0.003478 / 0.011008 (-0.007530) | 0.050055 / 0.038508 (0.011547) | 0.031415 / 0.023109 (0.008306) | 0.275057 / 0.275898 (-0.000841) | 0.296690 / 0.323480 (-0.026789) | 0.004253 / 0.007986 (-0.003732) | 0.002777 / 0.004328 (-0.001551) | 0.049553 / 0.004250 (0.045303) | 0.039843 / 0.037052 (0.002791) | 0.286938 / 0.258489 (0.028449) | 0.318579 / 0.293841 (0.024738) | 0.029773 / 0.128546 (-0.098774) | 0.010404 / 0.075646 (-0.065242) | 0.057915 / 0.419271 (-0.361356) | 0.033486 / 0.043533 (-0.010047) | 0.273293 / 0.255139 (0.018154) | 0.293155 / 0.283200 (0.009955) | 0.017843 / 0.141683 (-0.123839) | 1.131130 / 1.452155 (-0.321024) | 1.167412 / 1.492716 (-0.325304) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.092553 / 0.018006 (0.074547) | 0.298888 / 0.000490 (0.298399) | 0.000201 / 0.000200 (0.000001) | 0.000043 / 0.000054 (-0.000011) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.022646 / 0.037411 (-0.014765) | 0.076921 / 0.014526 (0.062395) | 0.089238 / 0.176557 (-0.087318) | 0.128793 / 0.737135 (-0.608342) | 0.089190 / 0.296338 (-0.207148) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.292552 / 0.215209 (0.077343) | 2.884277 / 2.077655 (0.806622) | 1.568798 / 1.504120 (0.064678) | 1.441819 / 1.541195 (-0.099375) | 1.435766 / 1.468490 (-0.032724) | 0.572435 / 4.584777 (-4.012342) | 0.957387 / 3.745712 (-2.788326) | 2.650843 / 5.269862 (-2.619019) | 1.727424 / 4.565676 (-2.838252) | 0.063470 / 0.424275 (-0.360805) | 0.005314 / 0.007607 (-0.002293) | 0.345881 / 0.226044 (0.119836) | 3.395463 / 2.268929 (1.126535) | 1.921340 / 55.444624 (-53.523285) | 1.621563 / 6.876477 (-5.254914) | 1.742561 / 2.142072 (-0.399512) | 0.639948 / 4.805227 (-4.165279) | 0.116091 / 6.500664 (-6.384573) | 0.041218 / 0.075469 (-0.034251) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.991506 / 1.841788 (-0.850281) | 11.897462 / 8.074308 (3.823154) | 10.083008 / 10.191392 (-0.108384) | 0.140626 / 0.680424 (-0.539798) | 0.015454 / 0.534201 (-0.518747) | 0.283856 / 0.579283 (-0.295427) | 0.125935 / 0.434364 (-0.308429) | 0.323884 / 0.540337 (-0.216454) | 0.438348 / 1.386936 (-0.948588) |

![](https://cml.dev/watermark.png#e59582adc7fcb53a86a8ca8eda7e04a4e7b25bd2 "CML watermark")

Set temporary numpy upper version < 2.0.0 to fix CI. See: https://github.com/huggingface/datasets/actions/runs/9546031216/job/26308072017
```
A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.0.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.
```


IndexError during training with Squad dataset and T5-small model

add remove_unused_columns=False to training_args
https://github.com/huggingface/datasets/issues/6535#issuecomment-1874024704

### Describe the bug

I am encountering an IndexError while training a T5-small model on the Squad dataset using the transformers and datasets libraries. The error occurs even with a minimal reproducible example, suggesting a potential bug or incompatibility.

### Steps to reproduce the bug

1.Install the required libraries: !pip install transformers datasets
2.Run the following code:
!pip install transformers datasets

import torch
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, TrainingArguments, Trainer, DataCollatorWithPadding

# Load a small, publicly available dataset
from datasets import load_dataset
dataset = load_dataset("squad", split="train[:100]") # Use a small subset for testing

# Load a pre-trained model and tokenizer
model_name = "t5-small"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSeq2SeqLM.from_pretrained(model_name)

# Define a basic data collator
data_collator = DataCollatorWithPadding(tokenizer=tokenizer)

# Define training arguments
training_args = TrainingArguments(
    output_dir="./results",
    per_device_train_batch_size=2,
    num_train_epochs=1,
)

# Create a trainer
trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=dataset,
    data_collator=data_collator,
)

# Train the model
trainer.train()

### Expected behavior

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
[<ipython-input-23-f13a4b23c001>](https://localhost:8080/#) in <cell line: 34>()
     32
     33 # Train the model
---> 34 trainer.train()

10 frames
[/usr/local/lib/python3.10/dist-packages/datasets/formatting/formatting.py](https://localhost:8080/#) in _check_valid_index_key(key, size)
    427     if isinstance(key, int):
    428         if (key < 0 and key + size < 0) or (key >= size):
--> 429             raise IndexError(f"Invalid key: {key} is out of bounds for size {size}")
    430         return
    431     elif isinstance(key, slice):

IndexError: Invalid key: 42 is out of bounds for size 0

### Environment info

transformers version:4.41.2
datasets version:1.18.4
Python version:3.10.12


Fix webdataset pickling

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6972). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Show benchmarks

PyArrow==8.0.0

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005195 / 0.011353 (-0.006157) | 0.003734 / 0.011008 (-0.007275) | 0.063087 / 0.038508 (0.024579) | 0.031467 / 0.023109 (0.008358) | 0.245183 / 0.275898 (-0.030715) | 0.280071 / 0.323480 (-0.043409) | 0.003205 / 0.007986 (-0.004780) | 0.003311 / 0.004328 (-0.001018) | 0.049967 / 0.004250 (0.045717) | 0.044927 / 0.037052 (0.007875) | 0.262244 / 0.258489 (0.003755) | 0.284549 / 0.293841 (-0.009292) | 0.027595 / 0.128546 (-0.100952) | 0.010521 / 0.075646 (-0.065126) | 0.206928 / 0.419271 (-0.212343) | 0.036179 / 0.043533 (-0.007354) | 0.254256 / 0.255139 (-0.000883) | 0.272733 / 0.283200 (-0.010467) | 0.020456 / 0.141683 (-0.121226) | 1.118527 / 1.452155 (-0.333628) | 1.152741 / 1.492716 (-0.339975) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.096642 / 0.018006 (0.078636) | 0.306981 / 0.000490 (0.306491) | 0.000220 / 0.000200 (0.000020) | 0.000042 / 0.000054 (-0.000012) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.019031 / 0.037411 (-0.018380) | 0.063960 / 0.014526 (0.049435) | 0.074428 / 0.176557 (-0.102129) | 0.121226 / 0.737135 (-0.615909) | 0.077111 / 0.296338 (-0.219228) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.279830 / 0.215209 (0.064621) | 2.748243 / 2.077655 (0.670588) | 1.481554 / 1.504120 (-0.022566) | 1.355015 / 1.541195 (-0.186180) | 1.379655 / 1.468490 (-0.088835) | 0.560378 / 4.584777 (-4.024399) | 2.407241 / 3.745712 (-1.338471) | 2.837090 / 5.269862 (-2.432771) | 1.767084 / 4.565676 (-2.798593) | 0.063517 / 0.424275 (-0.360758) | 0.005024 / 0.007607 (-0.002584) | 0.334845 / 0.226044 (0.108800) | 3.290712 / 2.268929 (1.021783) | 1.836923 / 55.444624 (-53.607702) | 1.543671 / 6.876477 (-5.332806) | 1.582319 / 2.142072 (-0.559754) | 0.637689 / 4.805227 (-4.167538) | 0.119515 / 6.500664 (-6.381149) | 0.042191 / 0.075469 (-0.033278) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.980018 / 1.841788 (-0.861770) | 11.620211 / 8.074308 (3.545903) | 9.697799 / 10.191392 (-0.493593) | 0.131733 / 0.680424 (-0.548691) | 0.014007 / 0.534201 (-0.520193) | 0.286046 / 0.579283 (-0.293237) | 0.264776 / 0.434364 (-0.169588) | 0.325041 / 0.540337 (-0.215296) | 0.452740 / 1.386936 (-0.934196) |

PyArrow==latest

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005603 / 0.011353 (-0.005750) | 0.003810 / 0.011008 (-0.007199) | 0.050773 / 0.038508 (0.012265) | 0.032601 / 0.023109 (0.009492) | 0.268035 / 0.275898 (-0.007863) | 0.292614 / 0.323480 (-0.030866) | 0.005076 / 0.007986 (-0.002910) | 0.004487 / 0.004328 (0.000159) | 0.049988 / 0.004250 (0.045737) | 0.040258 / 0.037052 (0.003205) | 0.284145 / 0.258489 (0.025656) | 0.318291 / 0.293841 (0.024450) | 0.029672 / 0.128546 (-0.098875) | 0.010534 / 0.075646 (-0.065113) | 0.059020 / 0.419271 (-0.360252) | 0.033451 / 0.043533 (-0.010082) | 0.270220 / 0.255139 (0.015081) | 0.290500 / 0.283200 (0.007300) | 0.017123 / 0.141683 (-0.124560) | 1.130870 / 1.452155 (-0.321285) | 1.160038 / 1.492716 (-0.332678) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.097045 / 0.018006 (0.079039) | 0.314573 / 0.000490 (0.314083) | 0.000203 / 0.000200 (0.000003) | 0.000044 / 0.000054 (-0.000011) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.022396 / 0.037411 (-0.015015) | 0.079393 / 0.014526 (0.064867) | 0.088460 / 0.176557 (-0.088097) | 0.128050 / 0.737135 (-0.609085) | 0.093070 / 0.296338 (-0.203268) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.293858 / 0.215209 (0.078649) | 2.819956 / 2.077655 (0.742301) | 1.540181 / 1.504120 (0.036061) | 1.419671 / 1.541195 (-0.121524) | 1.441594 / 1.468490 (-0.026897) | 0.565200 / 4.584777 (-4.019577) | 0.963967 / 3.745712 (-2.781745) | 2.752137 / 5.269862 (-2.517725) | 1.779239 / 4.565676 (-2.786438) | 0.063787 / 0.424275 (-0.360488) | 0.005344 / 0.007607 (-0.002263) | 0.344283 / 0.226044 (0.118239) | 3.353263 / 2.268929 (1.084334) | 1.898678 / 55.444624 (-53.545947) | 1.607868 / 6.876477 (-5.268609) | 1.781938 / 2.142072 (-0.360134) | 0.652119 / 4.805227 (-4.153108) | 0.117883 / 6.500664 (-6.382781) | 0.048811 / 0.075469 (-0.026658) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.013154 / 1.841788 (-0.828634) | 12.421963 / 8.074308 (4.347655) | 10.352056 / 10.191392 (0.160664) | 0.143784 / 0.680424 (-0.536640) | 0.016370 / 0.534201 (-0.517831) | 0.283668 / 0.579283 (-0.295615) | 0.127070 / 0.434364 (-0.307294) | 0.326199 / 0.540337 (-0.214138) | 0.432776 / 1.386936 (-0.954160) |

![](https://cml.dev/watermark.png#5e72fb13b4824dcb27aedb807e4e28c420dec244 "CML watermark")

...by making tracked iterables picklable.

This is important to make streaming datasets compatible with multiprocessing e.g. for parallel data loading


packaging: Remove useless dependencies

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6971). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@HuggingFaceDocBuilderDev There is no doc for this change. Call a human.

Haha it was me who triggered the CI for your PR

Show benchmarks

PyArrow==8.0.0

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005051 / 0.011353 (-0.006302) | 0.004831 / 0.011008 (-0.006178) | 0.063006 / 0.038508 (0.024498) | 0.031589 / 0.023109 (0.008480) | 0.296202 / 0.275898 (0.020304) | 0.274274 / 0.323480 (-0.049205) | 0.003199 / 0.007986 (-0.004786) | 0.002768 / 0.004328 (-0.001561) | 0.049422 / 0.004250 (0.045172) | 0.045174 / 0.037052 (0.008121) | 0.263814 / 0.258489 (0.005325) | 0.288125 / 0.293841 (-0.005716) | 0.027641 / 0.128546 (-0.100905) | 0.010439 / 0.075646 (-0.065207) | 0.203075 / 0.419271 (-0.216196) | 0.036259 / 0.043533 (-0.007274) | 0.245159 / 0.255139 (-0.009980) | 0.268897 / 0.283200 (-0.014303) | 0.019493 / 0.141683 (-0.122190) | 1.108330 / 1.452155 (-0.343824) | 1.155835 / 1.492716 (-0.336881) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.096860 / 0.018006 (0.078854) | 0.309428 / 0.000490 (0.308938) | 0.000197 / 0.000200 (-0.000003) | 0.000044 / 0.000054 (-0.000011) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.019275 / 0.037411 (-0.018136) | 0.062623 / 0.014526 (0.048098) | 0.073871 / 0.176557 (-0.102686) | 0.120410 / 0.737135 (-0.616726) | 0.075766 / 0.296338 (-0.220572) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.279876 / 0.215209 (0.064667) | 2.742429 / 2.077655 (0.664774) | 1.414368 / 1.504120 (-0.089752) | 1.293194 / 1.541195 (-0.248001) | 1.318043 / 1.468490 (-0.150447) | 0.570904 / 4.584777 (-4.013873) | 2.384386 / 3.745712 (-1.361326) | 2.757953 / 5.269862 (-2.511908) | 1.728766 / 4.565676 (-2.836910) | 0.062699 / 0.424275 (-0.361576) | 0.004951 / 0.007607 (-0.002656) | 0.332222 / 0.226044 (0.106177) | 3.407429 / 2.268929 (1.138500) | 1.777136 / 55.444624 (-53.667488) | 1.521269 / 6.876477 (-5.355207) | 1.544814 / 2.142072 (-0.597258) | 0.646249 / 4.805227 (-4.158978) | 0.117032 / 6.500664 (-6.383632) | 0.042274 / 0.075469 (-0.033195) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.016249 / 1.841788 (-0.825539) | 11.794003 / 8.074308 (3.719695) | 9.871925 / 10.191392 (-0.319467) | 0.133694 / 0.680424 (-0.546730) | 0.014904 / 0.534201 (-0.519297) | 0.287453 / 0.579283 (-0.291831) | 0.271802 / 0.434364 (-0.162561) | 0.324711 / 0.540337 (-0.215626) | 0.411812 / 1.386936 (-0.975124) |

PyArrow==latest

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005376 / 0.011353 (-0.005977) | 0.003631 / 0.011008 (-0.007377) | 0.050154 / 0.038508 (0.011646) | 0.033665 / 0.023109 (0.010556) | 0.279062 / 0.275898 (0.003164) | 0.298899 / 0.323480 (-0.024581) | 0.004388 / 0.007986 (-0.003598) | 0.002810 / 0.004328 (-0.001518) | 0.049032 / 0.004250 (0.044781) | 0.040531 / 0.037052 (0.003478) | 0.287220 / 0.258489 (0.028731) | 0.319060 / 0.293841 (0.025219) | 0.029473 / 0.128546 (-0.099073) | 0.010317 / 0.075646 (-0.065329) | 0.058483 / 0.419271 (-0.360789) | 0.033359 / 0.043533 (-0.010174) | 0.276404 / 0.255139 (0.021265) | 0.295013 / 0.283200 (0.011813) | 0.019372 / 0.141683 (-0.122311) | 1.172624 / 1.452155 (-0.279531) | 1.176815 / 1.492716 (-0.315902) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.097347 / 0.018006 (0.079341) | 0.306959 / 0.000490 (0.306469) | 0.000200 / 0.000200 (-0.000000) | 0.000044 / 0.000054 (-0.000011) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.022776 / 0.037411 (-0.014635) | 0.077865 / 0.014526 (0.063340) | 0.088806 / 0.176557 (-0.087751) | 0.130448 / 0.737135 (-0.606687) | 0.090973 / 0.296338 (-0.205365) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.301168 / 0.215209 (0.085959) | 2.957634 / 2.077655 (0.879979) | 1.556999 / 1.504120 (0.052879) | 1.413940 / 1.541195 (-0.127255) | 1.427970 / 1.468490 (-0.040520) | 0.587653 / 4.584777 (-3.997124) | 0.951295 / 3.745712 (-2.794417) | 2.691004 / 5.269862 (-2.578858) | 1.755826 / 4.565676 (-2.809851) | 0.064883 / 0.424275 (-0.359392) | 0.005379 / 0.007607 (-0.002228) | 0.353790 / 0.226044 (0.127745) | 3.457747 / 2.268929 (1.188818) | 1.891884 / 55.444624 (-53.552740) | 1.616619 / 6.876477 (-5.259858) | 1.736167 / 2.142072 (-0.405906) | 0.669257 / 4.805227 (-4.135970) | 0.119620 / 6.500664 (-6.381044) | 0.041390 / 0.075469 (-0.034080) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.008851 / 1.841788 (-0.832937) | 13.151216 / 8.074308 (5.076908) | 10.398371 / 10.191392 (0.206979) | 0.143420 / 0.680424 (-0.537004) | 0.015759 / 0.534201 (-0.518442) | 0.293068 / 0.579283 (-0.286215) | 0.131449 / 0.434364 (-0.302914) | 0.334715 / 0.540337 (-0.205623) | 0.445824 / 1.386936 (-0.941112) |

![](https://cml.dev/watermark.png#087671dcaf817c906a8649404c07b0440e2732ea "CML watermark")

Revert changes in #6396 and #6404. CVE-2023-47248 has been fixed since PyArrow v14.0.1. Meanwhile Python requirements requires `pyarrow>=15.0.0`.


Set dev version

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6970). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Show benchmarks

PyArrow==8.0.0

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005450 / 0.011353 (-0.005902) | 0.003911 / 0.011008 (-0.007098) | 0.063467 / 0.038508 (0.024959) | 0.031029 / 0.023109 (0.007920) | 0.247916 / 0.275898 (-0.027982) | 0.274737 / 0.323480 (-0.048743) | 0.003255 / 0.007986 (-0.004731) | 0.002842 / 0.004328 (-0.001487) | 0.049617 / 0.004250 (0.045366) | 0.046689 / 0.037052 (0.009637) | 0.255152 / 0.258489 (-0.003337) | 0.288630 / 0.293841 (-0.005211) | 0.028174 / 0.128546 (-0.100372) | 0.010773 / 0.075646 (-0.064873) | 0.202119 / 0.419271 (-0.217153) | 0.035914 / 0.043533 (-0.007619) | 0.248197 / 0.255139 (-0.006942) | 0.273508 / 0.283200 (-0.009691) | 0.020626 / 0.141683 (-0.121057) | 1.125668 / 1.452155 (-0.326487) | 1.156678 / 1.492716 (-0.336038) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.098294 / 0.018006 (0.080288) | 0.306661 / 0.000490 (0.306172) | 0.000227 / 0.000200 (0.000027) | 0.000043 / 0.000054 (-0.000011) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.019118 / 0.037411 (-0.018293) | 0.063086 / 0.014526 (0.048560) | 0.077735 / 0.176557 (-0.098822) | 0.123159 / 0.737135 (-0.613976) | 0.077228 / 0.296338 (-0.219111) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.280031 / 0.215209 (0.064822) | 2.762524 / 2.077655 (0.684870) | 1.444571 / 1.504120 (-0.059549) | 1.330590 / 1.541195 (-0.210604) | 1.371937 / 1.468490 (-0.096553) | 0.563847 / 4.584777 (-4.020930) | 2.369908 / 3.745712 (-1.375804) | 2.827441 / 5.269862 (-2.442420) | 1.749864 / 4.565676 (-2.815812) | 0.063996 / 0.424275 (-0.360279) | 0.005060 / 0.007607 (-0.002547) | 0.326067 / 0.226044 (0.100023) | 3.270170 / 2.268929 (1.001242) | 1.785164 / 55.444624 (-53.659460) | 1.560432 / 6.876477 (-5.316045) | 1.587005 / 2.142072 (-0.555068) | 0.645714 / 4.805227 (-4.159513) | 0.119975 / 6.500664 (-6.380689) | 0.043962 / 0.075469 (-0.031507) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.979003 / 1.841788 (-0.862785) | 11.988701 / 8.074308 (3.914393) | 9.788564 / 10.191392 (-0.402828) | 0.142644 / 0.680424 (-0.537780) | 0.014924 / 0.534201 (-0.519277) | 0.285942 / 0.579283 (-0.293341) | 0.264086 / 0.434364 (-0.170278) | 0.343360 / 0.540337 (-0.196977) | 0.413467 / 1.386936 (-0.973469) |

PyArrow==latest

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005818 / 0.011353 (-0.005535) | 0.003726 / 0.011008 (-0.007283) | 0.050936 / 0.038508 (0.012428) | 0.032000 / 0.023109 (0.008890) | 0.273282 / 0.275898 (-0.002616) | 0.293889 / 0.323480 (-0.029591) | 0.004287 / 0.007986 (-0.003699) | 0.002797 / 0.004328 (-0.001531) | 0.049088 / 0.004250 (0.044838) | 0.040235 / 0.037052 (0.003183) | 0.280240 / 0.258489 (0.021751) | 0.315749 / 0.293841 (0.021908) | 0.029986 / 0.128546 (-0.098560) | 0.010440 / 0.075646 (-0.065206) | 0.058935 / 0.419271 (-0.360336) | 0.033198 / 0.043533 (-0.010335) | 0.274321 / 0.255139 (0.019182) | 0.288039 / 0.283200 (0.004840) | 0.018865 / 0.141683 (-0.122818) | 1.114915 / 1.452155 (-0.337240) | 1.180548 / 1.492716 (-0.312169) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.095028 / 0.018006 (0.077022) | 0.304797 / 0.000490 (0.304307) | 0.000221 / 0.000200 (0.000021) | 0.000056 / 0.000054 (0.000001) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.022556 / 0.037411 (-0.014855) | 0.076839 / 0.014526 (0.062313) | 0.090255 / 0.176557 (-0.086302) | 0.128748 / 0.737135 (-0.608387) | 0.091718 / 0.296338 (-0.204621) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.296061 / 0.215209 (0.080852) | 2.851376 / 2.077655 (0.773722) | 1.548084 / 1.504120 (0.043964) | 1.428589 / 1.541195 (-0.112606) | 1.467244 / 1.468490 (-0.001246) | 0.583533 / 4.584777 (-4.001244) | 0.967436 / 3.745712 (-2.778277) | 2.774775 / 5.269862 (-2.495087) | 1.800435 / 4.565676 (-2.765242) | 0.063998 / 0.424275 (-0.360277) | 0.005420 / 0.007607 (-0.002187) | 0.346353 / 0.226044 (0.120308) | 3.383885 / 2.268929 (1.114956) | 1.902914 / 55.444624 (-53.541710) | 1.599545 / 6.876477 (-5.276932) | 1.772754 / 2.142072 (-0.369318) | 0.651804 / 4.805227 (-4.153423) | 0.120380 / 6.500664 (-6.380284) | 0.043311 / 0.075469 (-0.032159) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.004414 / 1.841788 (-0.837374) | 12.356077 / 8.074308 (4.281769) | 10.513420 / 10.191392 (0.322028) | 0.132419 / 0.680424 (-0.548005) | 0.015470 / 0.534201 (-0.518731) | 0.284883 / 0.579283 (-0.294400) | 0.130763 / 0.434364 (-0.303601) | 0.320068 / 0.540337 (-0.220270) | 0.430284 / 1.386936 (-0.956652) |

![](https://cml.dev/watermark.png#574791e0a0cf57ba761f679a054b9e89e4a3ee22 "CML watermark")


Release: 2.20.0

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6969). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Show benchmarks

PyArrow==8.0.0

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005414 / 0.011353 (-0.005939) | 0.003936 / 0.011008 (-0.007073) | 0.064129 / 0.038508 (0.025621) | 0.032985 / 0.023109 (0.009875) | 0.244051 / 0.275898 (-0.031847) | 0.273500 / 0.323480 (-0.049980) | 0.003227 / 0.007986 (-0.004759) | 0.002858 / 0.004328 (-0.001470) | 0.049212 / 0.004250 (0.044962) | 0.046432 / 0.037052 (0.009380) | 0.249543 / 0.258489 (-0.008946) | 0.297339 / 0.293841 (0.003498) | 0.027880 / 0.128546 (-0.100666) | 0.010582 / 0.075646 (-0.065065) | 0.202345 / 0.419271 (-0.216927) | 0.036402 / 0.043533 (-0.007131) | 0.253157 / 0.255139 (-0.001982) | 0.283355 / 0.283200 (0.000155) | 0.021907 / 0.141683 (-0.119776) | 1.174431 / 1.452155 (-0.277723) | 1.172103 / 1.492716 (-0.320613) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.097942 / 0.018006 (0.079936) | 0.307114 / 0.000490 (0.306624) | 0.000230 / 0.000200 (0.000030) | 0.000043 / 0.000054 (-0.000011) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.019149 / 0.037411 (-0.018262) | 0.064283 / 0.014526 (0.049758) | 0.075643 / 0.176557 (-0.100913) | 0.122531 / 0.737135 (-0.614604) | 0.077360 / 0.296338 (-0.218978) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.291790 / 0.215209 (0.076581) | 2.869234 / 2.077655 (0.791580) | 1.550266 / 1.504120 (0.046146) | 1.392392 / 1.541195 (-0.148802) | 1.375700 / 1.468490 (-0.092790) | 0.574963 / 4.584777 (-4.009814) | 2.444746 / 3.745712 (-1.300966) | 2.920602 / 5.269862 (-2.349259) | 1.812720 / 4.565676 (-2.752957) | 0.064811 / 0.424275 (-0.359464) | 0.005163 / 0.007607 (-0.002444) | 0.341306 / 0.226044 (0.115261) | 3.443177 / 2.268929 (1.174249) | 1.843510 / 55.444624 (-53.601115) | 1.534023 / 6.876477 (-5.342454) | 1.603575 / 2.142072 (-0.538498) | 0.656923 / 4.805227 (-4.148304) | 0.120338 / 6.500664 (-6.380326) | 0.042958 / 0.075469 (-0.032511) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.975993 / 1.841788 (-0.865795) | 11.942335 / 8.074308 (3.868027) | 9.964277 / 10.191392 (-0.227115) | 0.131247 / 0.680424 (-0.549176) | 0.014166 / 0.534201 (-0.520035) | 0.283994 / 0.579283 (-0.295290) | 0.267516 / 0.434364 (-0.166848) | 0.328363 / 0.540337 (-0.211974) | 0.412204 / 1.386936 (-0.974732) |

PyArrow==latest

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005867 / 0.011353 (-0.005486) | 0.003860 / 0.011008 (-0.007148) | 0.050247 / 0.038508 (0.011739) | 0.033819 / 0.023109 (0.010710) | 0.264840 / 0.275898 (-0.011058) | 0.291253 / 0.323480 (-0.032227) | 0.004481 / 0.007986 (-0.003504) | 0.002880 / 0.004328 (-0.001449) | 0.048528 / 0.004250 (0.044278) | 0.041720 / 0.037052 (0.004667) | 0.280467 / 0.258489 (0.021978) | 0.315244 / 0.293841 (0.021404) | 0.030569 / 0.128546 (-0.097977) | 0.010494 / 0.075646 (-0.065152) | 0.058652 / 0.419271 (-0.360620) | 0.034181 / 0.043533 (-0.009352) | 0.266466 / 0.255139 (0.011327) | 0.292038 / 0.283200 (0.008838) | 0.018501 / 0.141683 (-0.123182) | 1.115965 / 1.452155 (-0.336189) | 1.162753 / 1.492716 (-0.329963) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.101301 / 0.018006 (0.083295) | 0.296812 / 0.000490 (0.296322) | 0.000212 / 0.000200 (0.000012) | 0.000049 / 0.000054 (-0.000006) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.023662 / 0.037411 (-0.013749) | 0.080678 / 0.014526 (0.066153) | 0.089867 / 0.176557 (-0.086689) | 0.130803 / 0.737135 (-0.606332) | 0.091479 / 0.296338 (-0.204860) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.286028 / 0.215209 (0.070819) | 2.780072 / 2.077655 (0.702418) | 1.520146 / 1.504120 (0.016026) | 1.372952 / 1.541195 (-0.168243) | 1.428734 / 1.468490 (-0.039756) | 0.571484 / 4.584777 (-4.013293) | 0.969643 / 3.745712 (-2.776069) | 2.788157 / 5.269862 (-2.481705) | 1.841166 / 4.565676 (-2.724511) | 0.063311 / 0.424275 (-0.360964) | 0.005320 / 0.007607 (-0.002287) | 0.333341 / 0.226044 (0.107296) | 3.295141 / 2.268929 (1.026213) | 1.865537 / 55.444624 (-53.579088) | 1.584655 / 6.876477 (-5.291821) | 1.747417 / 2.142072 (-0.394655) | 0.634549 / 4.805227 (-4.170678) | 0.116373 / 6.500664 (-6.384291) | 0.041567 / 0.075469 (-0.033902) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.023086 / 1.841788 (-0.818702) | 13.091905 / 8.074308 (5.017597) | 10.572164 / 10.191392 (0.380772) | 0.142208 / 0.680424 (-0.538216) | 0.015692 / 0.534201 (-0.518509) | 0.284309 / 0.579283 (-0.294974) | 0.126467 / 0.434364 (-0.307897) | 0.322719 / 0.540337 (-0.217618) | 0.439952 / 1.386936 (-0.946985) |

![](https://cml.dev/watermark.png#98fdc9e78e6d057ca66e58a37f49d6618aab8130 "CML watermark")


Use `HF_HUB_OFFLINE` instead of `HF_DATASETS_OFFLINE`

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6968). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Oops, sorry for the style issue. Fixed in https://github.com/huggingface/datasets/pull/6968/commits/a4e2b28fa647b28190ae2615d7271e6ac63c8499.

Regarding docs, I can't find mentions of `HF_DATASETS_OFFLINE` anywhere else in `datasets`/`hub-docs`. Once this is merged and released, I'm planning to update some `transformers` docs that briefly mention it.

Show benchmarks

PyArrow==8.0.0

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005173 / 0.011353 (-0.006180) | 0.003485 / 0.011008 (-0.007524) | 0.063867 / 0.038508 (0.025359) | 0.031338 / 0.023109 (0.008229) | 0.242093 / 0.275898 (-0.033805) | 0.266606 / 0.323480 (-0.056874) | 0.003069 / 0.007986 (-0.004916) | 0.003307 / 0.004328 (-0.001022) | 0.051059 / 0.004250 (0.046808) | 0.044396 / 0.037052 (0.007344) | 0.254896 / 0.258489 (-0.003593) | 0.282835 / 0.293841 (-0.011006) | 0.027548 / 0.128546 (-0.100998) | 0.010520 / 0.075646 (-0.065126) | 0.201701 / 0.419271 (-0.217570) | 0.035613 / 0.043533 (-0.007920) | 0.240955 / 0.255139 (-0.014184) | 0.271902 / 0.283200 (-0.011298) | 0.019826 / 0.141683 (-0.121857) | 1.116994 / 1.452155 (-0.335161) | 1.162886 / 1.492716 (-0.329831) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.093683 / 0.018006 (0.075677) | 0.297970 / 0.000490 (0.297480) | 0.000211 / 0.000200 (0.000011) | 0.000043 / 0.000054 (-0.000011) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.018952 / 0.037411 (-0.018459) | 0.062710 / 0.014526 (0.048184) | 0.073641 / 0.176557 (-0.102916) | 0.121200 / 0.737135 (-0.615935) | 0.075723 / 0.296338 (-0.220616) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.286056 / 0.215209 (0.070847) | 2.811424 / 2.077655 (0.733770) | 1.448045 / 1.504120 (-0.056075) | 1.338309 / 1.541195 (-0.202885) | 1.328371 / 1.468490 (-0.140119) | 0.557282 / 4.584777 (-4.027495) | 2.362235 / 3.745712 (-1.383477) | 2.732108 / 5.269862 (-2.537754) | 1.730911 / 4.565676 (-2.834765) | 0.061689 / 0.424275 (-0.362586) | 0.004947 / 0.007607 (-0.002660) | 0.346700 / 0.226044 (0.120656) | 3.355989 / 2.268929 (1.087060) | 1.828078 / 55.444624 (-53.616546) | 1.511531 / 6.876477 (-5.364946) | 1.535897 / 2.142072 (-0.606175) | 0.630276 / 4.805227 (-4.174951) | 0.115808 / 6.500664 (-6.384857) | 0.042199 / 0.075469 (-0.033270) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.969203 / 1.841788 (-0.872584) | 11.282997 / 8.074308 (3.208689) | 9.538914 / 10.191392 (-0.652478) | 0.140072 / 0.680424 (-0.540352) | 0.014021 / 0.534201 (-0.520180) | 0.283784 / 0.579283 (-0.295499) | 0.255973 / 0.434364 (-0.178391) | 0.320284 / 0.540337 (-0.220053) | 0.412689 / 1.386936 (-0.974247) |

PyArrow==latest

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005201 / 0.011353 (-0.006152) | 0.003312 / 0.011008 (-0.007697) | 0.050044 / 0.038508 (0.011536) | 0.033610 / 0.023109 (0.010501) | 0.266429 / 0.275898 (-0.009469) | 0.287782 / 0.323480 (-0.035698) | 0.004316 / 0.007986 (-0.003670) | 0.002696 / 0.004328 (-0.001633) | 0.049667 / 0.004250 (0.045417) | 0.040244 / 0.037052 (0.003192) | 0.278870 / 0.258489 (0.020381) | 0.311415 / 0.293841 (0.017574) | 0.029150 / 0.128546 (-0.099396) | 0.010046 / 0.075646 (-0.065600) | 0.058527 / 0.419271 (-0.360744) | 0.032871 / 0.043533 (-0.010662) | 0.266582 / 0.255139 (0.011443) | 0.286157 / 0.283200 (0.002957) | 0.017197 / 0.141683 (-0.124486) | 1.120944 / 1.452155 (-0.331211) | 1.161111 / 1.492716 (-0.331606) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.092679 / 0.018006 (0.074672) | 0.299195 / 0.000490 (0.298705) | 0.000204 / 0.000200 (0.000004) | 0.000048 / 0.000054 (-0.000007) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.022212 / 0.037411 (-0.015199) | 0.076734 / 0.014526 (0.062208) | 0.088326 / 0.176557 (-0.088230) | 0.128209 / 0.737135 (-0.608926) | 0.088807 / 0.296338 (-0.207531) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.291782 / 0.215209 (0.076573) | 2.882990 / 2.077655 (0.805335) | 1.601638 / 1.504120 (0.097518) | 1.457560 / 1.541195 (-0.083635) | 1.470517 / 1.468490 (0.002027) | 0.565738 / 4.584777 (-4.019039) | 0.949235 / 3.745712 (-2.796478) | 2.661927 / 5.269862 (-2.607934) | 1.722178 / 4.565676 (-2.843498) | 0.063680 / 0.424275 (-0.360595) | 0.005339 / 0.007607 (-0.002268) | 0.344280 / 0.226044 (0.118235) | 3.432998 / 2.268929 (1.164070) | 1.985516 / 55.444624 (-53.459108) | 1.651826 / 6.876477 (-5.224651) | 1.764541 / 2.142072 (-0.377531) | 0.640219 / 4.805227 (-4.165008) | 0.116541 / 6.500664 (-6.384124) | 0.041237 / 0.075469 (-0.034232) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.013927 / 1.841788 (-0.827861) | 11.876661 / 8.074308 (3.802353) | 10.264144 / 10.191392 (0.072752) | 0.131151 / 0.680424 (-0.549273) | 0.015774 / 0.534201 (-0.518427) | 0.284948 / 0.579283 (-0.294335) | 0.125924 / 0.434364 (-0.308439) | 0.319845 / 0.540337 (-0.220493) | 0.431978 / 1.386936 (-0.954958) |

![](https://cml.dev/watermark.png#68f67741ffde68c98d0a2f59ac4d8e3a7bc03065 "CML watermark")

To use `datasets` offline, one can use the `HF_DATASETS_OFFLINE` environment variable. This PR makes `HF_HUB_OFFLINE` the recommended environment variable for offline training. Goal is to be more consistent with the rest of HF ecosystem and have a single config value to set.

The changes are backward-compatible meaning that:
- `HF_DATASETS_OFFLINE` environment is still taken into account, though not documented
- `datasets.config.HF_DATASETS_OFFLINE` still exists, though it is not used anymore (in favor of `datasets.config.HF_HUB_OFFLINE`)

**Note:** it might break things in downstream libraries if they were monkeypatching `datasets.config.HF_DATASETS_OFFLINE` in their CI tests (for instance). Not much of a problem IMO.


Method to load Laion400m

enhancement

New feature or request

### Feature request

Large datasets like Laion400m are provided as embeddings. The provided methods in load_dataset are not straightforward for loading embedding files, i.e. img_emb_XX.npy ; XX = 0 to 99

### Motivation

The trial and experimentation is the key pivot of HF. It would be great if HF can load embeddings files s,ealessly.

### Your contribution

I cam write the loader with some help.


Remove underlines between badges

Show benchmarks

PyArrow==8.0.0

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005326 / 0.011353 (-0.006027) | 0.003448 / 0.011008 (-0.007560) | 0.062516 / 0.038508 (0.024008) | 0.030222 / 0.023109 (0.007113) | 0.237006 / 0.275898 (-0.038892) | 0.258224 / 0.323480 (-0.065256) | 0.003191 / 0.007986 (-0.004795) | 0.002768 / 0.004328 (-0.001560) | 0.048754 / 0.004250 (0.044504) | 0.043694 / 0.037052 (0.006641) | 0.248832 / 0.258489 (-0.009657) | 0.272217 / 0.293841 (-0.021624) | 0.029684 / 0.128546 (-0.098862) | 0.011997 / 0.075646 (-0.063650) | 0.204047 / 0.419271 (-0.215225) | 0.035944 / 0.043533 (-0.007589) | 0.242094 / 0.255139 (-0.013045) | 0.258897 / 0.283200 (-0.024303) | 0.019228 / 0.141683 (-0.122455) | 1.110193 / 1.452155 (-0.341961) | 1.166780 / 1.492716 (-0.325937) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.097162 / 0.018006 (0.079156) | 0.303148 / 0.000490 (0.302659) | 0.000229 / 0.000200 (0.000029) | 0.000050 / 0.000054 (-0.000005) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.019981 / 0.037411 (-0.017431) | 0.062669 / 0.014526 (0.048144) | 0.074801 / 0.176557 (-0.101756) | 0.120509 / 0.737135 (-0.616626) | 0.075957 / 0.296338 (-0.220382) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.279527 / 0.215209 (0.064318) | 2.722749 / 2.077655 (0.645094) | 1.441770 / 1.504120 (-0.062350) | 1.312172 / 1.541195 (-0.229023) | 1.329418 / 1.468490 (-0.139072) | 0.723939 / 4.584777 (-3.860838) | 2.359146 / 3.745712 (-1.386566) | 2.963445 / 5.269862 (-2.306416) | 1.881974 / 4.565676 (-2.683702) | 0.078189 / 0.424275 (-0.346086) | 0.005249 / 0.007607 (-0.002358) | 0.334508 / 0.226044 (0.108463) | 3.271961 / 2.268929 (1.003032) | 1.817365 / 55.444624 (-53.627259) | 1.522755 / 6.876477 (-5.353721) | 1.514203 / 2.142072 (-0.627870) | 0.803486 / 4.805227 (-4.001741) | 0.134189 / 6.500664 (-6.366475) | 0.042761 / 0.075469 (-0.032708) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.971126 / 1.841788 (-0.870662) | 11.367159 / 8.074308 (3.292851) | 9.520174 / 10.191392 (-0.671218) | 0.142705 / 0.680424 (-0.537719) | 0.014586 / 0.534201 (-0.519615) | 0.300869 / 0.579283 (-0.278414) | 0.263161 / 0.434364 (-0.171203) | 0.336403 / 0.540337 (-0.203935) | 0.436088 / 1.386936 (-0.950848) |

PyArrow==latest

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005800 / 0.011353 (-0.005553) | 0.003906 / 0.011008 (-0.007103) | 0.050197 / 0.038508 (0.011689) | 0.031348 / 0.023109 (0.008238) | 0.265636 / 0.275898 (-0.010262) | 0.286550 / 0.323480 (-0.036930) | 0.004502 / 0.007986 (-0.003484) | 0.002828 / 0.004328 (-0.001501) | 0.049668 / 0.004250 (0.045417) | 0.039552 / 0.037052 (0.002499) | 0.279091 / 0.258489 (0.020602) | 0.309987 / 0.293841 (0.016146) | 0.032104 / 0.128546 (-0.096442) | 0.011989 / 0.075646 (-0.063657) | 0.059875 / 0.419271 (-0.359397) | 0.033446 / 0.043533 (-0.010087) | 0.265256 / 0.255139 (0.010117) | 0.285649 / 0.283200 (0.002449) | 0.018330 / 0.141683 (-0.123353) | 1.140073 / 1.452155 (-0.312081) | 1.194538 / 1.492716 (-0.298178) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.093692 / 0.018006 (0.075685) | 0.301422 / 0.000490 (0.300932) | 0.000216 / 0.000200 (0.000016) | 0.000051 / 0.000054 (-0.000004) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.022844 / 0.037411 (-0.014568) | 0.077129 / 0.014526 (0.062603) | 0.087948 / 0.176557 (-0.088608) | 0.129905 / 0.737135 (-0.607230) | 0.089872 / 0.296338 (-0.206466) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.293135 / 0.215209 (0.077926) | 2.880280 / 2.077655 (0.802626) | 1.554250 / 1.504120 (0.050130) | 1.428005 / 1.541195 (-0.113190) | 1.520863 / 1.468490 (0.052373) | 0.759903 / 4.584777 (-3.824874) | 0.959674 / 3.745712 (-2.786038) | 2.848914 / 5.269862 (-2.420948) | 1.900355 / 4.565676 (-2.665322) | 0.079434 / 0.424275 (-0.344841) | 0.005487 / 0.007607 (-0.002121) | 0.344837 / 0.226044 (0.118793) | 3.401730 / 2.268929 (1.132802) | 1.887526 / 55.444624 (-53.557098) | 1.596821 / 6.876477 (-5.279655) | 1.732190 / 2.142072 (-0.409882) | 0.800929 / 4.805227 (-4.004299) | 0.132763 / 6.500664 (-6.367901) | 0.041185 / 0.075469 (-0.034284) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.994396 / 1.841788 (-0.847391) | 12.488692 / 8.074308 (4.414384) | 10.365952 / 10.191392 (0.174560) | 0.142951 / 0.680424 (-0.537472) | 0.015448 / 0.534201 (-0.518753) | 0.305577 / 0.579283 (-0.273706) | 0.126897 / 0.434364 (-0.307467) | 0.340784 / 0.540337 (-0.199554) | 0.461955 / 1.386936 (-0.924981) |

![](https://cml.dev/watermark.png#1d65718438ac4bc401468e57d5358e69012ed0c8 "CML watermark")

## Before:

## After:


Improve skip take shuffling and distributed

The docs for this PR live [here](https://moon-ci-docs.huggingface.co/docs/datasets/pr_6965). All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Show benchmarks

PyArrow==8.0.0

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.005879 / 0.011353 (-0.005474) | 0.004144 / 0.011008 (-0.006865) | 0.063327 / 0.038508 (0.024819) | 0.032577 / 0.023109 (0.009468) | 0.242936 / 0.275898 (-0.032962) | 0.269882 / 0.323480 (-0.053598) | 0.003339 / 0.007986 (-0.004647) | 0.002901 / 0.004328 (-0.001428) | 0.049163 / 0.004250 (0.044912) | 0.047072 / 0.037052 (0.010019) | 0.261120 / 0.258489 (0.002631) | 0.287857 / 0.293841 (-0.005984) | 0.029688 / 0.128546 (-0.098858) | 0.012702 / 0.075646 (-0.062944) | 0.204040 / 0.419271 (-0.215231) | 0.036012 / 0.043533 (-0.007521) | 0.244210 / 0.255139 (-0.010929) | 0.267600 / 0.283200 (-0.015599) | 0.019627 / 0.141683 (-0.122056) | 1.103770 / 1.452155 (-0.348385) | 1.197710 / 1.492716 (-0.295006) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.101683 / 0.018006 (0.083677) | 0.311825 / 0.000490 (0.311335) | 0.000236 / 0.000200 (0.000036) | 0.000043 / 0.000054 (-0.000011) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.019642 / 0.037411 (-0.017769) | 0.061618 / 0.014526 (0.047092) | 0.075237 / 0.176557 (-0.101320) | 0.122250 / 0.737135 (-0.614886) | 0.076087 / 0.296338 (-0.220251) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.285120 / 0.215209 (0.069911) | 2.811527 / 2.077655 (0.733872) | 1.457961 / 1.504120 (-0.046159) | 1.333819 / 1.541195 (-0.207376) | 1.387863 / 1.468490 (-0.080627) | 0.730828 / 4.584777 (-3.853949) | 2.417224 / 3.745712 (-1.328488) | 2.994842 / 5.269862 (-2.275020) | 1.922079 / 4.565676 (-2.643598) | 0.087486 / 0.424275 (-0.336789) | 0.005211 / 0.007607 (-0.002396) | 0.335585 / 0.226044 (0.109541) | 3.297664 / 2.268929 (1.028735) | 1.809391 / 55.444624 (-53.635233) | 1.501646 / 6.876477 (-5.374831) | 1.567573 / 2.142072 (-0.574500) | 0.800816 / 4.805227 (-4.004411) | 0.134204 / 6.500664 (-6.366460) | 0.043156 / 0.075469 (-0.032313) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.982955 / 1.841788 (-0.858833) | 12.256850 / 8.074308 (4.182542) | 9.821500 / 10.191392 (-0.369892) | 0.143739 / 0.680424 (-0.536685) | 0.014425 / 0.534201 (-0.519776) | 0.302718 / 0.579283 (-0.276565) | 0.267746 / 0.434364 (-0.166618) | 0.340036 / 0.540337 (-0.200301) | 0.436211 / 1.386936 (-0.950725) |

PyArrow==latest

Show updated benchmarks!

### Benchmark: benchmark_array_xd.json

| metric | read_batch_formatted_as_numpy after write_array2d | read_batch_formatted_as_numpy after write_flattened_sequence | read_batch_formatted_as_numpy after write_nested_sequence | read_batch_unformated after write_array2d | read_batch_unformated after write_flattened_sequence | read_batch_unformated after write_nested_sequence | read_col_formatted_as_numpy after write_array2d | read_col_formatted_as_numpy after write_flattened_sequence | read_col_formatted_as_numpy after write_nested_sequence | read_col_unformated after write_array2d | read_col_unformated after write_flattened_sequence | read_col_unformated after write_nested_sequence | read_formatted_as_numpy after write_array2d | read_formatted_as_numpy after write_flattened_sequence | read_formatted_as_numpy after write_nested_sequence | read_unformated after write_array2d | read_unformated after write_flattened_sequence | read_unformated after write_nested_sequence | write_array2d | write_flattened_sequence | write_nested_sequence |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.006136 / 0.011353 (-0.005217) | 0.004125 / 0.011008 (-0.006883) | 0.050341 / 0.038508 (0.011833) | 0.034547 / 0.023109 (0.011438) | 0.270237 / 0.275898 (-0.005661) | 0.294503 / 0.323480 (-0.028977) | 0.004528 / 0.007986 (-0.003458) | 0.003103 / 0.004328 (-0.001225) | 0.048817 / 0.004250 (0.044566) | 0.041301 / 0.037052 (0.004249) | 0.279461 / 0.258489 (0.020972) | 0.319376 / 0.293841 (0.025535) | 0.032733 / 0.128546 (-0.095813) | 0.012426 / 0.075646 (-0.063221) | 0.060543 / 0.419271 (-0.358729) | 0.034015 / 0.043533 (-0.009518) | 0.267387 / 0.255139 (0.012248) | 0.288590 / 0.283200 (0.005390) | 0.019697 / 0.141683 (-0.121986) | 1.145994 / 1.452155 (-0.306161) | 1.198122 / 1.492716 (-0.294595) |

### Benchmark: benchmark_getitem\_100B.json

| metric | get_batch_of\_1024\_random_rows | get_batch_of\_1024\_rows | get_first_row | get_last_row |
|--------|---|---|---|---|
| new / old (diff) | 0.099091 / 0.018006 (0.081085) | 0.313767 / 0.000490 (0.313277) | 0.000220 / 0.000200 (0.000020) | 0.000054 / 0.000054 (-0.000001) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.023219 / 0.037411 (-0.014192) | 0.083609 / 0.014526 (0.069084) | 0.089529 / 0.176557 (-0.087028) | 0.131025 / 0.737135 (-0.606110) | 0.091947 / 0.296338 (-0.204391) |

### Benchmark: benchmark_iterating.json

| metric | read 5000 | read 50000 | read_batch 50000 10 | read_batch 50000 100 | read_batch 50000 1000 | read_formatted numpy 5000 | read_formatted pandas 5000 | read_formatted tensorflow 5000 | read_formatted torch 5000 | read_formatted_batch numpy 5000 10 | read_formatted_batch numpy 5000 1000 | shuffled read 5000 | shuffled read 50000 | shuffled read_batch 50000 10 | shuffled read_batch 50000 100 | shuffled read_batch 50000 1000 | shuffled read_formatted numpy 5000 | shuffled read_formatted_batch numpy 5000 10 | shuffled read_formatted_batch numpy 5000 1000 |
|--------|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 0.283711 / 0.215209 (0.068502) | 2.811702 / 2.077655 (0.734047) | 1.577720 / 1.504120 (0.073600) | 1.415700 / 1.541195 (-0.125495) | 1.436097 / 1.468490 (-0.032393) | 0.732090 / 4.584777 (-3.852687) | 0.990552 / 3.745712 (-2.755160) | 2.887319 / 5.269862 (-2.382543) | 1.923707 / 4.565676 (-2.641969) | 0.079361 / 0.424275 (-0.344915) | 0.005520 / 0.007607 (-0.002087) | 0.336684 / 0.226044 (0.110639) | 3.325342 / 2.268929 (1.056413) | 1.911853 / 55.444624 (-53.532771) | 1.621450 / 6.876477 (-5.255027) | 1.807964 / 2.142072 (-0.334109) | 0.813958 / 4.805227 (-3.991269) | 0.137564 / 6.500664 (-6.363100) | 0.043151 / 0.075469 (-0.032318) |

### Benchmark: benchmark_map_filter.json

| metric | filter | map fast-tokenizer batched | map identity | map identity batched | map no-op batched | map no-op batched numpy | map no-op batched pandas | map no-op batched pytorch | map no-op batched tensorflow |
|--------|---|---|---|---|---|---|---|---|---|
| new / old (diff) | 1.002775 / 1.841788 (-0.839013) | 12.526367 / 8.074308 (4.452058) | 10.426992 / 10.191392 (0.235600) | 0.134902 / 0.680424 (-0.545522) | 0.016726 / 0.534201 (-0.517475) | 0.303549 / 0.579283 (-0.275734) | 0.129334 / 0.434364 (-0.305030) | 0.339254 / 0.540337 (-0.201084) | 0.456845 / 1.386936 (-0.930091) |

![](https://cml.dev/watermark.png#c5464b32ce03739431235c13f314732201abcfac "CML watermark")

set the right behavior of skip/take depending on whether it's called after or before shuffle/split_by_node