Implement get dataset default config name
Opened by albertvillanova (closed)

Implement `get_dataset_default_config_name`.

Now that we support setting a configuration as default in `push_to_hub` (see #6500), we need a programmatically way to know in advance which is the default configuration. This will be used in the Space to convert script-datasets to Parquet: https://huggingface.co/spaces/albertvillanova/convert-dataset-to-parquet

Follow-up of:
- #6500

CC: @severo 

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

@huggingface/datasets, this PR is ready for review.

<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.005343 / 0.011353 (-0.006010) | 0.003521 / 0.011008 (-0.007487) | 0.061835 / 0.038508 (0.023327) | 0.052633 / 0.023109 (0.029524) | 0.243897 / 0.275898 (-0.032001) | 0.272961 / 0.323480 (-0.050519) | 0.003013 / 0.007986 (-0.004973) | 0.002692 / 0.004328 (-0.001636) | 0.050099 / 0.004250 (0.045848) | 0.045381 / 0.037052 (0.008329) | 0.249981 / 0.258489 (-0.008508) | 0.276789 / 0.293841 (-0.017052) | 0.027929 / 0.128546 (-0.100617) | 0.010933 / 0.075646 (-0.064714) | 0.206757 / 0.419271 (-0.212514) | 0.035334 / 0.043533 (-0.008199) | 0.249411 / 0.255139 (-0.005728) | 0.268893 / 0.283200 (-0.014306) | 0.019175 / 0.141683 (-0.122507) | 1.106932 / 1.452155 (-0.345223) | 1.177819 / 1.492716 (-0.314897) |

### 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.092895 / 0.018006 (0.074889) | 0.303658 / 0.000490 (0.303169) | 0.000214 / 0.000200 (0.000014) | 0.000050 / 0.000054 (-0.000005) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.018978 / 0.037411 (-0.018434) | 0.060459 / 0.014526 (0.045934) | 0.072900 / 0.176557 (-0.103657) | 0.119803 / 0.737135 (-0.617332) | 0.074349 / 0.296338 (-0.221989) |

### 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.283715 / 0.215209 (0.068505) | 2.752394 / 2.077655 (0.674739) | 1.446619 / 1.504120 (-0.057501) | 1.319612 / 1.541195 (-0.221582) | 1.374769 / 1.468490 (-0.093721) | 0.571543 / 4.584777 (-4.013234) | 2.389106 / 3.745712 (-1.356607) | 2.797837 / 5.269862 (-2.472025) | 1.737615 / 4.565676 (-2.828062) | 0.063268 / 0.424275 (-0.361007) | 0.005118 / 0.007607 (-0.002489) | 0.340238 / 0.226044 (0.114193) | 3.366207 / 2.268929 (1.097278) | 1.845934 / 55.444624 (-53.598690) | 1.540640 / 6.876477 (-5.335837) | 1.585489 / 2.142072 (-0.556584) | 0.641178 / 4.805227 (-4.164049) | 0.118701 / 6.500664 (-6.381964) | 0.042719 / 0.075469 (-0.032750) |

### 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.946706 / 1.841788 (-0.895082) | 11.846230 / 8.074308 (3.771921) | 10.459268 / 10.191392 (0.267876) | 0.130557 / 0.680424 (-0.549867) | 0.014292 / 0.534201 (-0.519909) | 0.287455 / 0.579283 (-0.291828) | 0.265213 / 0.434364 (-0.169151) | 0.325670 / 0.540337 (-0.214667) | 0.422800 / 1.386936 (-0.964136) |

</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.005454 / 0.011353 (-0.005899) | 0.003567 / 0.011008 (-0.007441) | 0.048696 / 0.038508 (0.010188) | 0.058844 / 0.023109 (0.035735) | 0.277011 / 0.275898 (0.001113) | 0.302544 / 0.323480 (-0.020936) | 0.004077 / 0.007986 (-0.003908) | 0.002720 / 0.004328 (-0.001609) | 0.058251 / 0.004250 (0.054001) | 0.040946 / 0.037052 (0.003893) | 0.276261 / 0.258489 (0.017772) | 0.352827 / 0.293841 (0.058986) | 0.029915 / 0.128546 (-0.098632) | 0.010562 / 0.075646 (-0.065084) | 0.057836 / 0.419271 (-0.361436) | 0.033129 / 0.043533 (-0.010404) | 0.276053 / 0.255139 (0.020914) | 0.292045 / 0.283200 (0.008846) | 0.020504 / 0.141683 (-0.121179) | 1.129746 / 1.452155 (-0.322409) | 1.190888 / 1.492716 (-0.301829) |

### 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.095202 / 0.018006 (0.077196) | 0.303956 / 0.000490 (0.303466) | 0.000226 / 0.000200 (0.000026) | 0.000054 / 0.000054 (-0.000001) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.021960 / 0.037411 (-0.015451) | 0.076209 / 0.014526 (0.061683) | 0.088813 / 0.176557 (-0.087744) | 0.129061 / 0.737135 (-0.608074) | 0.091202 / 0.296338 (-0.205136) |

### 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.301394 / 0.215209 (0.086185) | 2.948057 / 2.077655 (0.870403) | 1.591371 / 1.504120 (0.087251) | 1.463515 / 1.541195 (-0.077680) | 1.516477 / 1.468490 (0.047987) | 0.577223 / 4.584777 (-4.007554) | 2.506716 / 3.745712 (-1.238996) | 2.833385 / 5.269862 (-2.436477) | 1.808896 / 4.565676 (-2.756781) | 0.063241 / 0.424275 (-0.361034) | 0.005057 / 0.007607 (-0.002550) | 0.350108 / 0.226044 (0.124063) | 3.470252 / 2.268929 (1.201324) | 1.925689 / 55.444624 (-53.518935) | 1.667521 / 6.876477 (-5.208955) | 1.690909 / 2.142072 (-0.451164) | 0.647070 / 4.805227 (-4.158157) | 0.117596 / 6.500664 (-6.383068) | 0.042431 / 0.075469 (-0.033038) |

### 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.977297 / 1.841788 (-0.864490) | 12.947399 / 8.074308 (4.873091) | 10.964949 / 10.191392 (0.773557) | 0.130905 / 0.680424 (-0.549518) | 0.015207 / 0.534201 (-0.518994) | 0.288151 / 0.579283 (-0.291132) | 0.281817 / 0.434364 (-0.152547) | 0.326398 / 0.540337 (-0.213940) | 0.421354 / 1.386936 (-0.965582) |

</details>
</details>

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