Improve error message for gated datasets on load
State: closed

Internal Slack discussion: https://huggingface.slack.com/archives/C02V51Q3800/p1708424971135029

Thank you ! Should we also add the link to the dataset page ?

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

> Thank you ! Should we also add the link to the dataset page ?

Good idea! Done in https://github.com/huggingface/datasets/pull/6684/commits/4ab55210dca1815b6c2f23901598bfb29fc92a47

Looks like a test is failing: `test_load_dataset_cached_local_script `.

Apparently your new message is also shown for datasets that don't exist, which is maybe not ideal

Ah let me take a look!

> Looks like a test is failing: `test_load_dataset_cached_local_script `.
> 
> Apparently your new message is also shown for datasets that don't exist, which is maybe not ideal

Fixed by reverting the error message root + added a small clarifying part

<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.005634 / 0.011353 (-0.005719) | 0.003786 / 0.011008 (-0.007222) | 0.064245 / 0.038508 (0.025737) | 0.031228 / 0.023109 (0.008119) | 0.248162 / 0.275898 (-0.027736) | 0.273454 / 0.323480 (-0.050026) | 0.003176 / 0.007986 (-0.004809) | 0.002814 / 0.004328 (-0.001515) | 0.049234 / 0.004250 (0.044984) | 0.046075 / 0.037052 (0.009023) | 0.262410 / 0.258489 (0.003921) | 0.290597 / 0.293841 (-0.003244) | 0.028545 / 0.128546 (-0.100001) | 0.010881 / 0.075646 (-0.064766) | 0.212098 / 0.419271 (-0.207173) | 0.036406 / 0.043533 (-0.007127) | 0.244571 / 0.255139 (-0.010568) | 0.269537 / 0.283200 (-0.013663) | 0.019574 / 0.141683 (-0.122109) | 1.120369 / 1.452155 (-0.331785) | 1.170188 / 1.492716 (-0.322529) |

### 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.108088 / 0.018006 (0.090082) | 0.299836 / 0.000490 (0.299346) | 0.000204 / 0.000200 (0.000004) | 0.000043 / 0.000054 (-0.000012) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.020881 / 0.037411 (-0.016531) | 0.065290 / 0.014526 (0.050764) | 0.074283 / 0.176557 (-0.102274) | 0.122189 / 0.737135 (-0.614947) | 0.077772 / 0.296338 (-0.218566) |

### 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.278329 / 0.215209 (0.063120) | 2.709885 / 2.077655 (0.632230) | 1.428824 / 1.504120 (-0.075296) | 1.314338 / 1.541195 (-0.226857) | 1.349445 / 1.468490 (-0.119045) | 0.571863 / 4.584777 (-4.012914) | 2.358306 / 3.745712 (-1.387407) | 2.873498 / 5.269862 (-2.396364) | 1.779897 / 4.565676 (-2.785779) | 0.062828 / 0.424275 (-0.361447) | 0.005416 / 0.007607 (-0.002191) | 0.337645 / 0.226044 (0.111601) | 3.328868 / 2.268929 (1.059940) | 1.793387 / 55.444624 (-53.651238) | 1.539201 / 6.876477 (-5.337276) | 1.589552 / 2.142072 (-0.552520) | 0.645454 / 4.805227 (-4.159773) | 0.116966 / 6.500664 (-6.383698) | 0.043339 / 0.075469 (-0.032130) |

### 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.995743 / 1.841788 (-0.846045) | 12.096551 / 8.074308 (4.022243) | 10.214299 / 10.191392 (0.022907) | 0.133025 / 0.680424 (-0.547399) | 0.014393 / 0.534201 (-0.519808) | 0.289018 / 0.579283 (-0.290266) | 0.267879 / 0.434364 (-0.166485) | 0.324362 / 0.540337 (-0.215976) | 0.425596 / 1.386936 (-0.961340) |

</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.005739 / 0.011353 (-0.005614) | 0.003992 / 0.011008 (-0.007017) | 0.051362 / 0.038508 (0.012854) | 0.031707 / 0.023109 (0.008598) | 0.274807 / 0.275898 (-0.001091) | 0.298897 / 0.323480 (-0.024583) | 0.004363 / 0.007986 (-0.003622) | 0.002862 / 0.004328 (-0.001466) | 0.050462 / 0.004250 (0.046212) | 0.048158 / 0.037052 (0.011106) | 0.282759 / 0.258489 (0.024270) | 0.317766 / 0.293841 (0.023926) | 0.060245 / 0.128546 (-0.068301) | 0.011279 / 0.075646 (-0.064367) | 0.061175 / 0.419271 (-0.358097) | 0.035876 / 0.043533 (-0.007656) | 0.273963 / 0.255139 (0.018824) | 0.288788 / 0.283200 (0.005589) | 0.019690 / 0.141683 (-0.121992) | 1.167074 / 1.452155 (-0.285080) | 1.206344 / 1.492716 (-0.286372) |

### 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.091211 / 0.018006 (0.073205) | 0.299295 / 0.000490 (0.298805) | 0.000216 / 0.000200 (0.000016) | 0.000043 / 0.000054 (-0.000011) |

### Benchmark: benchmark_indices_mapping.json

| metric | select | shard | shuffle | sort | train_test_split |
|--------|---|---|---|---|---|
| new / old (diff) | 0.022718 / 0.037411 (-0.014693) | 0.079483 / 0.014526 (0.064957) | 0.087437 / 0.176557 (-0.089120) | 0.126977 / 0.737135 (-0.610159) | 0.089678 / 0.296338 (-0.206660) |

### 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.294719 / 0.215209 (0.079510) | 2.864505 / 2.077655 (0.786851) | 1.583993 / 1.504120 (0.079873) | 1.455079 / 1.541195 (-0.086115) | 1.504080 / 1.468490 (0.035590) | 0.569040 / 4.584777 (-4.015737) | 2.423472 / 3.745712 (-1.322240) | 2.742848 / 5.269862 (-2.527014) | 1.785244 / 4.565676 (-2.780432) | 0.062655 / 0.424275 (-0.361620) | 0.005027 / 0.007607 (-0.002580) | 0.343863 / 0.226044 (0.117818) | 3.376286 / 2.268929 (1.107358) | 1.933846 / 55.444624 (-53.510779) | 1.667316 / 6.876477 (-5.209161) | 1.815621 / 2.142072 (-0.326451) | 0.639378 / 4.805227 (-4.165850) | 0.116514 / 6.500664 (-6.384150) | 0.042191 / 0.075469 (-0.033279) |

### 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.007103 / 1.841788 (-0.834685) | 12.791193 / 8.074308 (4.716885) | 10.870575 / 10.191392 (0.679183) | 0.131040 / 0.680424 (-0.549384) | 0.016510 / 0.534201 (-0.517691) | 0.288372 / 0.579283 (-0.290911) | 0.275574 / 0.434364 (-0.158790) | 0.327801 / 0.540337 (-0.212536) | 0.415942 / 1.386936 (-0.970994) |

</details>
</details>

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