Create DefunctDatasetError
State: closed | Author: albertvillanova (MEMBER)

Create `DefunctDatasetError` as a specific error to be raised when a dataset is defunct and no longer accessible.

See Hub discussion: https://huggingface.co/datasets/the_pile_books3/discussions/7#6523c13a94f3a1a2092d251b

Comments: <details>
<summary>Show benchmarks</summary>

PyArrow==8.0.0

<details>
<summary>Show updated benchmarks!</summary>

### 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.009157 / 0.011353 (-0.002195) | 0.004275 / 0.011008 (-0.006734) | 0.099341 / 0.038508 (0.060833) | 0.080634 / 0.023109 (0.057525) | 0.373598 / 0.275898 (0.097700) | 0.445048 / 0.323480 (0.121568) | 0.006541 / 0.007986 (-0.001444) | 0.003550 / 0.004328 (-0.000779) | 0.071034 / 0.004250 (0.066784) | 0.062637 / 0.037052 (0.025585) | 0.379110 / 0.258489 (0.120621) | 0.447896 / 0.293841 (0.154055) | 0.047739 / 0.128546 (-0.080807) | 0.012575 / 0.075646 (-0.063071) | 0.332314 / 0.419271 (-0.086957) | 0.065500 / 0.043533 (0.021967) | 0.365919 / 0.255139 (0.110780) | 0.438611 / 0.283200 (0.155412) | 0.034243 / 0.141683 (-0.107440) | 1.628034 / 1.452155 (0.175880) | 1.802970 / 1.492716 (0.310253) |

### 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.224528 / 0.018006 (0.206522) | 0.482094 / 0.000490 (0.481604) | 0.012752 / 0.000200 (0.012552) | 0.000570 / 0.000054 (0.000515) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.025456 / 0.037411 (-0.011956) | 0.082281 / 0.014526 (0.067756) | 0.100050 / 0.176557 (-0.076506) | 0.156931 / 0.737135 (-0.580204) | 0.108229 / 0.296338 (-0.188110) |

### 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.560688 / 0.215209 (0.345479) | 5.171711 / 2.077655 (3.094056) | 2.273178 / 1.504120 (0.769058) | 1.948158 / 1.541195 (0.406963) | 1.879744 / 1.468490 (0.411254) | 0.789216 / 4.584777 (-3.795561) | 4.529370 / 3.745712 (0.783658) | 4.008743 / 5.269862 (-1.261118) | 2.633555 / 4.565676 (-1.932121) | 0.085411 / 0.424275 (-0.338864) | 0.007256 / 0.007607 (-0.000351) | 0.623254 / 0.226044 (0.397209) | 6.327256 / 2.268929 (4.058327) | 2.911787 / 55.444624 (-52.532837) | 2.240610 / 6.876477 (-4.635867) | 2.352811 / 2.142072 (0.210738) | 0.930114 / 4.805227 (-3.875114) | 0.185028 / 6.500664 (-6.315636) | 0.062115 / 0.075469 (-0.013354) |

### 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.394261 / 1.841788 (-0.447527) | 19.689376 / 8.074308 (11.615067) | 17.242289 / 10.191392 (7.050897) | 0.209122 / 0.680424 (-0.471302) | 0.027205 / 0.534201 (-0.506996) | 0.408613 / 0.579283 (-0.170670) | 0.503836 / 0.434364 (0.069472) | 0.485179 / 0.540337 (-0.055158) | 0.674333 / 1.386936 (-0.712603) |

</details>
PyArrow==latest

<details>
<summary>Show updated benchmarks!</summary>

### 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.007506 / 0.011353 (-0.003847) | 0.004683 / 0.011008 (-0.006325) | 0.067584 / 0.038508 (0.029076) | 0.065635 / 0.023109 (0.042525) | 0.458814 / 0.275898 (0.182916) | 0.477549 / 0.323480 (0.154069) | 0.005212 / 0.007986 (-0.002774) | 0.003393 / 0.004328 (-0.000936) | 0.075307 / 0.004250 (0.071057) | 0.051989 / 0.037052 (0.014937) | 0.484229 / 0.258489 (0.225740) | 0.470889 / 0.293841 (0.177048) | 0.043528 / 0.128546 (-0.085018) | 0.014685 / 0.075646 (-0.060962) | 0.084199 / 0.419271 (-0.335073) | 0.053970 / 0.043533 (0.010437) | 0.432362 / 0.255139 (0.177223) | 0.467472 / 0.283200 (0.184272) | 0.031109 / 0.141683 (-0.110574) | 1.525938 / 1.452155 (0.073784) | 1.631993 / 1.492716 (0.139276) |

### 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.200196 / 0.018006 (0.182190) | 0.479316 / 0.000490 (0.478827) | 0.010146 / 0.000200 (0.009947) | 0.000118 / 0.000054 (0.000063) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.027911 / 0.037411 (-0.009500) | 0.089720 / 0.014526 (0.075194) | 0.097000 / 0.176557 (-0.079557) | 0.157549 / 0.737135 (-0.579587) | 0.098247 / 0.296338 (-0.198092) |

### 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.581401 / 0.215209 (0.366192) | 5.703829 / 2.077655 (3.626174) | 2.688272 / 1.504120 (1.184152) | 2.321691 / 1.541195 (0.780496) | 2.355987 / 1.468490 (0.887497) | 0.759109 / 4.584777 (-3.825668) | 4.711288 / 3.745712 (0.965576) | 4.093019 / 5.269862 (-1.176843) | 2.648240 / 4.565676 (-1.917437) | 0.087839 / 0.424275 (-0.336436) | 0.007060 / 0.007607 (-0.000547) | 0.702783 / 0.226044 (0.476739) | 6.986924 / 2.268929 (4.717996) | 3.365970 / 55.444624 (-52.078654) | 2.670876 / 6.876477 (-4.205600) | 2.776431 / 2.142072 (0.634358) | 0.920005 / 4.805227 (-3.885222) | 0.197521 / 6.500664 (-6.303143) | 0.069974 / 0.075469 (-0.005495) |

### 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.596947 / 1.841788 (-0.244841) | 20.606007 / 8.074308 (12.531699) | 18.437425 / 10.191392 (8.246033) | 0.222445 / 0.680424 (-0.457978) | 0.028610 / 0.534201 (-0.505591) | 0.419748 / 0.579283 (-0.159535) | 0.513409 / 0.434364 (0.079045) | 0.487517 / 0.540337 (-0.052820) | 0.706637 / 1.386936 (-0.680299) |

</details>
</details>

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


<details>
<summary>Show benchmarks</summary>

PyArrow==8.0.0

<details>
<summary>Show updated benchmarks!</summary>

### 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.007744 / 0.011353 (-0.003609) | 0.004678 / 0.011008 (-0.006330) | 0.101243 / 0.038508 (0.062735) | 0.085653 / 0.023109 (0.062543) | 0.383772 / 0.275898 (0.107874) | 0.422151 / 0.323480 (0.098671) | 0.004566 / 0.007986 (-0.003419) | 0.003900 / 0.004328 (-0.000429) | 0.077778 / 0.004250 (0.073528) | 0.063761 / 0.037052 (0.026709) | 0.385505 / 0.258489 (0.127016) | 0.436186 / 0.293841 (0.142345) | 0.036172 / 0.128546 (-0.092374) | 0.009935 / 0.075646 (-0.065711) | 0.341434 / 0.419271 (-0.077837) | 0.061866 / 0.043533 (0.018333) | 0.385020 / 0.255139 (0.129881) | 0.399455 / 0.283200 (0.116256) | 0.029324 / 0.141683 (-0.112358) | 1.784749 / 1.452155 (0.332594) | 1.845926 / 1.492716 (0.353209) |

### 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.266322 / 0.018006 (0.248316) | 0.508708 / 0.000490 (0.508218) | 0.013680 / 0.000200 (0.013480) | 0.000868 / 0.000054 (0.000814) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.033887 / 0.037411 (-0.003525) | 0.096709 / 0.014526 (0.082183) | 0.109472 / 0.176557 (-0.067084) | 0.174422 / 0.737135 (-0.562713) | 0.110830 / 0.296338 (-0.185509) |

### 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.457533 / 0.215209 (0.242324) | 4.615229 / 2.077655 (2.537575) | 2.418820 / 1.504120 (0.914700) | 2.181079 / 1.541195 (0.639884) | 2.229164 / 1.468490 (0.760674) | 0.554861 / 4.584777 (-4.029916) | 4.323787 / 3.745712 (0.578075) | 3.769396 / 5.269862 (-1.500466) | 2.376850 / 4.565676 (-2.188826) | 0.065030 / 0.424275 (-0.359245) | 0.008397 / 0.007607 (0.000790) | 0.541109 / 0.226044 (0.315065) | 5.477540 / 2.268929 (3.208612) | 2.957049 / 55.444624 (-52.487576) | 2.511732 / 6.876477 (-4.364744) | 2.703953 / 2.142072 (0.561881) | 0.660822 / 4.805227 (-4.144405) | 0.147035 / 6.500664 (-6.353630) | 0.066045 / 0.075469 (-0.009424) |

### 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.526481 / 1.841788 (-0.315307) | 22.020256 / 8.074308 (13.945948) | 16.854566 / 10.191392 (6.663174) | 0.192958 / 0.680424 (-0.487466) | 0.021505 / 0.534201 (-0.512696) | 0.462867 / 0.579283 (-0.116416) | 0.514813 / 0.434364 (0.080449) | 0.546147 / 0.540337 (0.005809) | 0.767853 / 1.386936 (-0.619083) |

</details>
PyArrow==latest

<details>
<summary>Show updated benchmarks!</summary>

### 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.007770 / 0.011353 (-0.003583) | 0.004671 / 0.011008 (-0.006337) | 0.080862 / 0.038508 (0.042354) | 0.087049 / 0.023109 (0.063940) | 0.479497 / 0.275898 (0.203599) | 0.559787 / 0.323480 (0.236307) | 0.007168 / 0.007986 (-0.000818) | 0.003829 / 0.004328 (-0.000500) | 0.079018 / 0.004250 (0.074768) | 0.067359 / 0.037052 (0.030307) | 0.516140 / 0.258489 (0.257651) | 0.547000 / 0.293841 (0.253159) | 0.037955 / 0.128546 (-0.090591) | 0.010007 / 0.075646 (-0.065639) | 0.087673 / 0.419271 (-0.331598) | 0.059309 / 0.043533 (0.015777) | 0.473920 / 0.255139 (0.218781) | 0.529216 / 0.283200 (0.246017) | 0.028236 / 0.141683 (-0.113447) | 1.771127 / 1.452155 (0.318972) | 1.918878 / 1.492716 (0.426162) |

### 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.242010 / 0.018006 (0.224004) | 0.494944 / 0.000490 (0.494454) | 0.006319 / 0.000200 (0.006119) | 0.000111 / 0.000054 (0.000056) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.039220 / 0.037411 (0.001809) | 0.113805 / 0.014526 (0.099279) | 0.125704 / 0.176557 (-0.050853) | 0.189198 / 0.737135 (-0.547937) | 0.126334 / 0.296338 (-0.170004) |

### 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.502226 / 0.215209 (0.287017) | 5.039133 / 2.077655 (2.961478) | 2.782352 / 1.504120 (1.278232) | 2.587654 / 1.541195 (1.046460) | 2.692588 / 1.468490 (1.224098) | 0.585672 / 4.584777 (-3.999105) | 4.553078 / 3.745712 (0.807366) | 3.864739 / 5.269862 (-1.405123) | 2.536109 / 4.565676 (-2.029567) | 0.069567 / 0.424275 (-0.354708) | 0.008749 / 0.007607 (0.001142) | 0.620645 / 0.226044 (0.394601) | 6.247286 / 2.268929 (3.978357) | 3.345293 / 55.444624 (-52.099332) | 2.873970 / 6.876477 (-4.002507) | 3.123190 / 2.142072 (0.981118) | 0.687391 / 4.805227 (-4.117837) | 0.159046 / 6.500664 (-6.341618) | 0.071019 / 0.075469 (-0.004450) |

### 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.728724 / 1.841788 (-0.113064) | 22.828390 / 8.074308 (14.754082) | 17.305225 / 10.191392 (7.113833) | 0.176571 / 0.680424 (-0.503853) | 0.023837 / 0.534201 (-0.510364) | 0.467935 / 0.579283 (-0.111348) | 0.503701 / 0.434364 (0.069337) | 0.558140 / 0.540337 (0.017803) | 0.789326 / 1.386936 (-0.597610) |

</details>
</details>

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