Issue: Fix reload cache with data dir
State: closed
Author: lhoestq

The cache used to only check for the latest cache directory with a given config_name, but it was wrong (e.g. `default-data_dir=data%2Ffortran-data_dir=data%2Ffortran` instead of `default-data_dir=data%2Ffortran`)

I fixed this by not passing the `config_kwargs` to the parent Builder `__init__`, and passing the config_id forged from the `config_kwargs` directly

close https://github.com/huggingface/datasets/issues/6609

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

<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.004913 / 0.011353 (-0.006440) | 0.003595 / 0.011008 (-0.007413) | 0.068385 / 0.038508 (0.029876) | 0.028612 / 0.023109 (0.005503) | 0.236590 / 0.275898 (-0.039308) | 0.261890 / 0.323480 (-0.061590) | 0.003027 / 0.007986 (-0.004958) | 0.002674 / 0.004328 (-0.001654) | 0.049255 / 0.004250 (0.045004) | 0.040500 / 0.037052 (0.003447) | 0.248759 / 0.258489 (-0.009730) | 0.280299 / 0.293841 (-0.013542) | 0.027300 / 0.128546 (-0.101247) | 0.010475 / 0.075646 (-0.065171) | 0.208744 / 0.419271 (-0.210527) | 0.035214 / 0.043533 (-0.008319) | 0.251922 / 0.255139 (-0.003217) | 0.263582 / 0.283200 (-0.019618) | 0.018738 / 0.141683 (-0.122945) | 1.150940 / 1.452155 (-0.301215) | 1.187240 / 1.492716 (-0.305476) |

### 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.093505 / 0.018006 (0.075499) | 0.301101 / 0.000490 (0.300611) | 0.000232 / 0.000200 (0.000032) | 0.000067 / 0.000054 (0.000012) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.017779 / 0.037411 (-0.019632) | 0.061412 / 0.014526 (0.046886) | 0.074353 / 0.176557 (-0.102203) | 0.118717 / 0.737135 (-0.618418) | 0.074214 / 0.296338 (-0.222125) |

### 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.281722 / 0.215209 (0.066513) | 2.716867 / 2.077655 (0.639212) | 1.423379 / 1.504120 (-0.080741) | 1.315379 / 1.541195 (-0.225816) | 1.294638 / 1.468490 (-0.173852) | 0.549658 / 4.584777 (-4.035119) | 2.349889 / 3.745712 (-1.395823) | 2.722354 / 5.269862 (-2.547507) | 1.700271 / 4.565676 (-2.865406) | 0.061099 / 0.424275 (-0.363176) | 0.004931 / 0.007607 (-0.002677) | 0.339181 / 0.226044 (0.113136) | 3.242467 / 2.268929 (0.973538) | 1.777929 / 55.444624 (-53.666696) | 1.498380 / 6.876477 (-5.378097) | 1.511482 / 2.142072 (-0.630590) | 0.627076 / 4.805227 (-4.178151) | 0.115936 / 6.500664 (-6.384729) | 0.041791 / 0.075469 (-0.033678) |

### 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.983132 / 1.841788 (-0.858656) | 11.431810 / 8.074308 (3.357502) | 10.298918 / 10.191392 (0.107526) | 0.139754 / 0.680424 (-0.540670) | 0.013984 / 0.534201 (-0.520217) | 0.283627 / 0.579283 (-0.295656) | 0.264970 / 0.434364 (-0.169393) | 0.323896 / 0.540337 (-0.216441) | 0.420132 / 1.386936 (-0.966804) |

</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.005323 / 0.011353 (-0.006030) | 0.003725 / 0.011008 (-0.007283) | 0.050191 / 0.038508 (0.011683) | 0.032196 / 0.023109 (0.009087) | 0.265037 / 0.275898 (-0.010861) | 0.289573 / 0.323480 (-0.033907) | 0.004345 / 0.007986 (-0.003640) | 0.002794 / 0.004328 (-0.001534) | 0.048955 / 0.004250 (0.044705) | 0.045421 / 0.037052 (0.008369) | 0.279792 / 0.258489 (0.021303) | 0.307374 / 0.293841 (0.013533) | 0.046997 / 0.128546 (-0.081549) | 0.010531 / 0.075646 (-0.065115) | 0.058921 / 0.419271 (-0.360351) | 0.033620 / 0.043533 (-0.009912) | 0.268138 / 0.255139 (0.012999) | 0.285941 / 0.283200 (0.002742) | 0.018396 / 0.141683 (-0.123287) | 1.151089 / 1.452155 (-0.301066) | 1.209351 / 1.492716 (-0.283365) |

### 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.092258 / 0.018006 (0.074252) | 0.300893 / 0.000490 (0.300403) | 0.000212 / 0.000200 (0.000013) | 0.000052 / 0.000054 (-0.000003) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.022233 / 0.037411 (-0.015178) | 0.075220 / 0.014526 (0.060694) | 0.085901 / 0.176557 (-0.090656) | 0.125080 / 0.737135 (-0.612056) | 0.086978 / 0.296338 (-0.209361) |

### 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.292877 / 0.215209 (0.077667) | 2.841005 / 2.077655 (0.763350) | 1.555168 / 1.504120 (0.051048) | 1.420801 / 1.541195 (-0.120394) | 1.431475 / 1.468490 (-0.037015) | 0.569803 / 4.584777 (-4.014974) | 2.451731 / 3.745712 (-1.293981) | 2.662825 / 5.269862 (-2.607036) | 1.732260 / 4.565676 (-2.833416) | 0.063030 / 0.424275 (-0.361245) | 0.004971 / 0.007607 (-0.002637) | 0.345250 / 0.226044 (0.119206) | 3.390909 / 2.268929 (1.121980) | 1.908666 / 55.444624 (-53.535959) | 1.628976 / 6.876477 (-5.247501) | 1.719270 / 2.142072 (-0.422803) | 0.653712 / 4.805227 (-4.151515) | 0.116423 / 6.500664 (-6.384241) | 0.040835 / 0.075469 (-0.034634) |

### 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.005538 / 1.841788 (-0.836250) | 12.105381 / 8.074308 (4.031073) | 10.656295 / 10.191392 (0.464903) | 0.131850 / 0.680424 (-0.548574) | 0.016297 / 0.534201 (-0.517904) | 0.285566 / 0.579283 (-0.293717) | 0.276086 / 0.434364 (-0.158278) | 0.326663 / 0.540337 (-0.213675) | 0.410639 / 1.386936 (-0.976297) |

</details>
</details>

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