SergeiGKS/huggingface-dataset-issues huggingface dataset:
Issue: Dataset librispeech_asr fails to load

Comment:
Another thing, but maybe this should be a separate issue: As I see from the code, it would try to use up to 16 simultaneous downloads? This is problematic for Librispeech or anything on OpenSLR. On [the homepage](https://www.openslr.org/), it says:

> If you want to download things from this site, please download them one at a time, and please don't use any fancy software-- just download things from your browser or use 'wget'. We have a firewall rule to drop connections from hosts with more than 5 simultaneous connections, and certain types of download software may activate this rule.

Related: https://github.com/tensorflow/datasets/issues/3885
Issue: Dataset librispeech_asr fails to load

Comment:
Sorry maybe the docs haven't been super clear here. By `split` we mean one of `train.500`, `train.360`, `train.100`, `validation`, `test`. For Librispeech, you'll have to specific a config (either `other` or `clean`) though:

```py
datasets.load_dataset("librispeech_asr", "clean")
```

should work and give you all splits (being "train", "test", ...) for the clean config of the dataset.
Issue: Dataset librispeech_asr fails to load

Comment:
If you need both `"clean"` and `"other"` I think you'll have to do concatenate them as follows: 

```py
from datasets import concatenate_datasets, load_dataset

other = load_dataset("librispeech_asr", "other")
clean = load_dataset("librispeech_asr", "clean")

librispeech = concatenate_datasets([other, clean])
```

See https://huggingface.co/docs/datasets/v2.1.0/en/process#concatenate
Issue: Dataset librispeech_asr fails to load

Comment:
Downloading one split would be:

```py
from datasets import load_dataset

other = load_dataset("librispeech_asr", "other", split="train.500")
```
Issue: Dataset librispeech_asr fails to load

Comment:
Ah thanks. But wouldn't it be easier/nicer (and more canonical) to just make it in a way that simply `load_dataset("librispeech_asr")` works?
Issue: Dataset librispeech_asr fails to load

Comment:
Pinging @lhoestq here, think this could make sense! Not sure however how the dictionary would then look like
Issue: Dataset librispeech_asr fails to load

Comment:
Would it make sense to have `clean` as the default config ?

Also I think `load_dataset("librispeech_asr")` should have raised you an error that says that you need to specify a config

I also opened a PR to improve the doc: https://github.com/huggingface/datasets/pull/4183
Issue: Dataset librispeech_asr fails to load

Comment:
> Would it make sense to have `clean` as the default config ?

I think a user would expect that the default would give you the full dataset.

> Also I think `load_dataset("librispeech_asr")` should have raised you an error that says that you need to specify a config

It does raise an error, but this error confused me because I did not understand why I needed a config, or why I could not simply download the whole dataset, which is what people usually do with Librispeech.
Issue: Dataset librispeech_asr fails to load

Comment:
+1 for @albertz. Also think lots of people download the whole dataset (`"clean"` + `"other"`) for Librispeech.

Think there are also some people though who:
- a) Don't have the memory to store the whole dataset
- b) Just want to evaluate on one of the two configs
Issue: Dataset librispeech_asr fails to load

Comment:
Ok ! Adding the "all" configuration would do the job then, thanks ! In the "all" configuration we can merge all the train.xxx splits into one "train" split, or keep them separate depending on what's the most practical to use (probably put everything in "train" no ?)
Issue: Dataset librispeech_asr fails to load

Comment:
I'm not too familiar with how to work with HuggingFace datasets, but people often do some curriculum learning scheme, where they start with train.100, later go over to train.100 + train.360, and then later use the whole train (960h). It would be good if this is easily possible.
Issue: Dataset librispeech_asr fails to load

Comment:
Hey @albertz, 

opened a PR here. Think by adding the "subdataset" class to each split "train", "dev", "other" as shown here: https://github.com/huggingface/datasets/pull/4184/files#r853272727 it should be easily possible (e.g. with the filter function https://huggingface.co/docs/datasets/v2.1.0/en/package_reference/main_classes#datasets.Dataset.filter )
Issue: Dataset librispeech_asr fails to load

Comment:
But also since everything is cached one could also just do:

```python
load_dataset("librispeech", "clean", "train.100")
load_dataset("librispeech", "clean", "train.100+train.360")
load_dataset("librispeech" "all", "train") 
```
Issue: Dataset librispeech_asr fails to load

Comment:
Hi @patrickvonplaten ,

load_dataset("librispeech_asr", "clean", "train.100") actually downloads the whole dataset and not the 100 hr split, is this a bug?
Issue: Dataset librispeech_asr fails to load

Comment:
Hmm, I don't really see how that's possible: https://github.com/huggingface/datasets/blob/d22e39a0693d4be7410cf9a5d41fd5aac22be3cc/datasets/librispeech_asr/librispeech_asr.py#L51

Note that all datasets related to `"clean"` are downloaded, but only `"train.100"` should be used. 

cc @lhoestq @albertvillanova @mariosasko can we do anything against download dataset links that are not related to the "split" that one actually needs. E.g. why should the split `"train.360"` be downloaded if for the user executes the above command:

```py
load_dataset("librispeech_asr", "clean", "train.100")
```
Issue: Dataset librispeech_asr fails to load

Comment:
@patrickvonplaten This problem is a bit harder than it may seem, and it has to do with how our scripts are structured - `_split_generators` downloads data for a split before its definition. There was an attempt to fix this in https://github.com/huggingface/datasets/pull/2249, but it wasn't flexible enough. Luckily, I have a plan of attack, and this issue is on our short-term roadmap, so I'll work on it soon.

In the meantime, one can use streaming or manually download a dataset script, remove unwanted splits and load a dataset via `load_dataset`.
Issue: Dataset librispeech_asr fails to load

Comment:
> load_dataset("librispeech_asr", "clean", "train.100") actually downloads the whole dataset and not the 100 hr split, is this a bug?

Since this bug is still there and google led me here when I was searching for a solution, I am writing down how to quickly fix it (as suggested by @mariosasko) for whoever else is not familiar with how the HF Hub works.

Download the [librispeech_asr.py](https://huggingface.co/datasets/librispeech_asr/blob/main/librispeech_asr.py) script and remove the unwanted splits both from the [`_DL_URLS` dictionary](https://huggingface.co/datasets/librispeech_asr/blob/main/librispeech_asr.py#L47-L68) and from the [`_split_generators` function](https://huggingface.co/datasets/librispeech_asr/blob/main/librispeech_asr.py#L121-L241).
[Here ](https://huggingface.co/datasets/andreagasparini/librispeech_test_only) I made an example with only the test sets.

Then either save the script locally and load the dataset via 
```python
load_dataset("${local_path}/librispeech_asr.py")
```

or [create a new dataset repo on the hub](https://huggingface.co/new-dataset) named "librispeech_asr" and upload the script there, then you can just run
```python
load_dataset("${hugging_face_username}/librispeech_asr")
```
Issue: Timit_asr dataset cannot be previewed recently

Comment:
Thanks for reporting. The bug has already been detected, and we hope to fix it soon.
Issue: Timit_asr dataset cannot be previewed recently

Comment:
TIMIT is now a dataset that requires manual download, see #4145 

Therefore it might take a bit more time to fix it
Issue: Timit_asr dataset cannot be previewed recently

Comment:
> TIMIT is now a dataset that requires manual download, see #4145
> 
> Therefore it might take a bit more time to fix it

Thank you for your quickly response. Exactly, I also found the manual download issue in the morning. But when I used *list_datasets()* to check the available datasets, *'timit_asr'* is still in the list. So I am a little bit confused. If *'timit_asr'* need to be manually downloaded, does that mean we can **not** automatically download it **any more** in the future?
Issue: Timit_asr dataset cannot be previewed recently

Comment:
Yes exactly. If you try to load the dataset it will ask you to download it manually first, and to pass the downloaded and extracted data like `load_dataset("timir_asr", data_dir="path/to/extracted/data")`

The URL we were using was coming from a host that doesn't have the permission to redistribute the data, and the dataset owners (LDC) notified us about it.
Issue: Timit_asr dataset cannot be previewed recently

Comment:
I downloaded the timit_asr data and unzipped. But I can't run my code. Could you resolve this problem for me? Thanks

          import soundfile as sf
          import torch
          from datasets import load_dataset
          dataset = load_dataset("timit_asr", data_dir="/Users/nguyenvannham/Documents/test_case/data")
          
          
          Generating train split: 0 examples [00:00, ? examples/s]

Generating train split: 0 examples [00:00, ? examples/s]Traceback (most recent call last):

  File "/opt/anaconda3/envs/audio/lib/python3.9/site-packages/datasets/builder.py", line 1571, in _prepare_split_single
    for key, record in generator:

  File "/Users/nguyenvannham/.cache/huggingface/modules/datasets_modules/datasets/timit_asr/43f9448dd5db58e95ee48a277f466481b151f112ea53e27f8173784da9254fb2/timit_asr.py", line 138, in _generate_examples
    with txt_path.open(encoding="utf-8") as op:

  File "/opt/anaconda3/envs/audio/lib/python3.9/pathlib.py", line 1252, in open
    return io.open(self, mode, buffering, encoding, errors, newline,

  File "/opt/anaconda3/envs/audio/lib/python3.9/pathlib.py", line 1120, in _opener
    return self._accessor.open(self, flags, mode)

FileNotFoundError: [Errno 2] No such file or directory: '/Users/nguyenvannham/Documents/test_case/data/train/DR1/FCJF0/SA1.WAV.TXT'


The above exception was the direct cause of the following exception:

Traceback (most recent call last):

  File "/var/folders/t9/l8d3rwpn1k33_gjtqs732lzc0000gn/T/ipykernel_3891/1203313828.py", line 1, in <module>
    dataset = load_dataset("timit_asr", data_dir="/Users/nguyenvannham/Documents/test_case/data")

  File "/opt/anaconda3/envs/audio/lib/python3.9/site-packages/datasets/load.py", line 1758, in load_dataset
    builder_instance.download_and_prepare(

  File "/opt/anaconda3/envs/audio/lib/python3.9/site-packages/datasets/builder.py", line 860, in download_and_prepare
    self._download_and_prepare(

  File "/opt/anaconda3/envs/audio/lib/python3.9/site-packages/datasets/builder.py", line 1612, in _download_and_prepare
    super()._download_and_prepare(

  File "/opt/anaconda3/envs/audio/lib/python3.9/site-packages/datasets/builder.py", line 953, in _download_and_prepare
    self._prepare_split(split_generator, **prepare_split_kwargs)

  File "/opt/anaconda3/envs/audio/lib/python3.9/site-packages/datasets/builder.py", line 1450, in _prepare_split
    for job_id, done, content in self._prepare_split_single(

  File "/opt/anaconda3/envs/audio/lib/python3.9/site-packages/datasets/builder.py", line 1607, in _prepare_split_single
    raise DatasetGenerationError("An error occurred while generating the dataset") from e

DatasetGenerationError: An error occurred while generating the dataset
Issue: Optional Content Warning for Datasets

Comment:
Hi! You can use the `extra_gated_prompt` YAML field in a dataset card for displaying custom messages/warnings that the user must accept before gaining access to the actual dataset. This option also keeps the viewer hidden until the user agrees to terms.
Issue: Optional Content Warning for Datasets

Comment:
Hi @mariosasko, thanks for explaining how to add this feature. 

If the current dataset yaml is:
```
---
annotations_creators:
- expert
language_creators:
- expert-generated
languages:
- en
license:
- cc-by-4.0
multilinguality:
- monolingual
pretty_name: HatemojiBuild
size_categories:
- 1K<n<10K
source_datasets:
- original
task_categories:
- text-classification
task_ids:
- hate-speech-detection
---
```

Can you provide a minimal working example of how to added the gated prompt?

Thanks!
Issue: Optional Content Warning for Datasets

Comment:
```
---
annotations_creators:
- expert
language_creators:
- expert-generated
languages:
- en
license:
- cc-by-4.0
multilinguality:
- monolingual
pretty_name: HatemojiBuild
size_categories:
- 1K<n<10K
source_datasets:
- original
task_categories:
- text-classification
task_ids:
- hate-speech-detection
extra_gated_prompt: "This repository contains harmful content."
---
```
\+ enable `User Access requests` under the Settings pane.

There's a brief guide here https://discuss.huggingface.co/t/how-to-customize-the-user-access-requests-message/13953 , and you can see the field in action here, https://huggingface.co/datasets/mozilla-foundation/common_voice_7_0/blob/main/README.md (you need to agree the terms in the Dataset Card pane to be able to access the files pane, so this comes up 403 at first).

And a working example here! https://huggingface.co/datasets/DDSC/dkhate :) Great to be able to mitigate harms in text.
Issue: Optional Content Warning for Datasets

Comment:
-- is there a way to gate content anonymously, i.e. without registering which users access it?
Issue: Optional Content Warning for Datasets

Comment:
+1 to @leondz's question. One scenario is if you don't want the dataset to be indexed by search engines or viewed in browser b/c of upstream conditions on data, but don't want to collect emails. Some ability to turn off the dataset viewer or add a gating mechanism without emails would be fantastic.
Issue: ArrayND error in pyarrow 5

Comment:
Where do we bump the required pyarrow version? Any inputs on how I fix this issue?
Issue: ArrayND error in pyarrow 5

Comment:
We need to bump it in `setup.py` as well as update some CI job to use pyarrow 6 instead of 5 in `.circleci/config.yaml` and `.github/workflows/benchmarks.yaml`
Issue: load_dataset for winoground returning decoding error

Comment:
I thought I had fixed it with this after some helpful hints from @severo
```python
import datasets 
token = 'hf_XXXXX'
dataset = datasets.load_dataset(
    'facebook/winoground', 
    name='facebook--winoground', 
    split='train', 
    streaming=True,
    use_auth_token=token,
)
```
but I found out that wasn't the case
```python
[x for x in dataset]
...
ClientResponseError: 401, message='Unauthorized', url=URL('https://huggingface.co/datasets/facebook/winoground/resolve/a86a60456fbbd242e9a744199071a6bd3e7fd9de/examples.jsonl')
```
Issue: load_dataset for winoground returning decoding error

Comment:
Hi ! This dataset structure (image + labels in a JSON file) is not supported yet, though we're adding support for this in  in #4069 

The following structure will be supported soon:
```
metadata.json
images/
     image0.png
     image1.png
    ...
```
Where `metadata.json` is a JSON Lines file with labels or other metadata, and each line must have a "file_name" field with the name of the image file.

For the moment are only supported:
- JSON files only
- image files only

Since this dataset is a mix of the two, at the moment it fails trying to read the images as JSON.

Therefore to be able to load this dataset we need to wait for the new structure to be supported (very soon ^^), or add a dataset script in the repository that reads both the JSON and the images cc @TristanThrush
Issue: load_dataset for winoground returning decoding error

Comment:
We'll also investigate the issue with the streaming download manager in https://github.com/huggingface/datasets/issues/4139 ;) thanks for reporting
Issue: load_dataset for winoground returning decoding error

Comment:
In the meantime, anyone can always download the images.zip and examples.jsonl files directly from huggingface.co - let me know if anyone has issues with that.
Issue: load_dataset for winoground returning decoding error

Comment:
I mirrored the files at https://huggingface.co/datasets/facebook/winoground in a folder on my local machine `winground`
and when I tried
```python
import datasets
ds = datasets.load_from_disk('./winoground')
```
I get the following error
```python
--------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 ds = datasets.load_from_disk('./winoground')

File ~/.local/lib/python3.8/site-packages/datasets/load.py:1759, in load_from_disk(dataset_path, fs, keep_in_memory)
   1757     return DatasetDict.load_from_disk(dataset_path, fs, keep_in_memory=keep_in_memory)
   1758 else:
-> 1759     raise FileNotFoundError(
   1760         f"Directory {dataset_path} is neither a dataset directory nor a dataset dict directory."
   1761     )

FileNotFoundError: Directory ./winoground is neither a dataset directory nor a dataset dict directory.
```
so still some work to be done on the backend imo.
Issue: load_dataset for winoground returning decoding error

Comment:
Note that `load_from_disk` is the function that reloads an Arrow dataset saved with `my_dataset.save_to_disk`.

Once we do support images with metadata you'll be able to use `load_dataset("facebook/winoground")` directly (or `load_dataset("./winoground")` of you've cloned the winoground repository locally).
Issue: load_dataset for winoground returning decoding error

Comment:
Apologies for the delay. I added a custom dataset loading script for winoground. It should work now, with an auth token:

`examples = load_dataset('facebook/winoground', use_auth_token=<your auth token>)`

Let me know if there are any issues
Issue: load_dataset for winoground returning decoding error

Comment:
Adding the dataset loading script definitely didn't take as long as I thought it would 😅
Issue: SAMSum dataset viewer not working

Comment:
Currently, only the datasets that can be streamed support the dataset viewer. Maybe @lhoestq @albertvillanova or @mariosasko could give more details about why the dataset cannot be streamed.
Issue: SAMSum dataset viewer not working

Comment:
It looks like the host (https://arxiv.org) doesn't allow HTTP Range requests, which is what we use to stream data.

This can be fix if we host the data ourselves, which is ok since the dataset is under CC BY-NC-ND 4.0
Issue: Unable to download `Wikepedia` 20220301.en version

Comment:
Hi! We've recently updated the Wikipedia script, so these changes are only available on master and can be fetched as follows:
```python
dataset_wikipedia = load_dataset("wikipedia", "20220301.en", revision="master")
```
Issue: Unable to download `Wikepedia` 20220301.en version

Comment:
Hi, how can I load the previous "20200501.en" version of wikipedia which had been downloaded to the default path? Thanks!
Issue: Error loading arxiv data set

Comment:
Hi! I think this error may be related to using an older version of the library. I was able to load the dataset without any issues using the latest version of `datasets`.  Can you upgrade to the latest version of `datasets` and try again? :)
Issue: Error loading arxiv data set

Comment:
Hi! As @stevhliu suggested, to fix the issue, update the lib to the newest version with:
```
pip install -U datasets
```
and download the dataset as follows:
```python
from datasets import load_dataset
dset =  load_dataset('scientific_papers', 'arxiv', download_mode="force_redownload")
```
Issue: Error loading arxiv data set

Comment:
Thanks for the quick response! It works now. The problem is that I used nlp. load_dataset instead of datasets. load_dataset.
Issue: Dataset viewer issue for Winoground

Comment:
I thought this issue was related to the error I was seeing, but upon consideration I'd think the dataset viewer would return a 500 (unable to create the split like me) or a 404 (unable to load split b/c it was never created) error if it was having the issue I was seeing in #4149. 401 message makes it look like dataset viewer isn't passing through the identity of the user who has signed the licensing agreement when making the request to GET [examples.jsonl](https://huggingface.co/datasets/facebook/winoground/resolve/a86a60456fbbd242e9a744199071a6bd3e7fd9de/examples.jsonl).
Issue: Dataset viewer issue for Winoground

Comment:
~~Using your command to replicate and changing `use_token` to `use_auth_token` fixes the problem I was seeing in #4149.~~
Nevermind it gave me an iterator to a method returning the same 401s. Changing `use_token` to `use_auth_token` does not fix the issue.
Issue: Dataset viewer issue for Winoground

Comment:
After investigation with @severo , we found a potential culprit: https://github.com/huggingface/datasets/blob/3cd0a009a43f9f174056d70bfa2ca32216181926/src/datasets/utils/streaming_download_manager.py#L610-L624

The streaming manager does not seem to pass `use_auth_token` to `fsspec` when streaming and not iterating content of a zip archive

cc @albertvillanova @lhoestq
Issue: Dataset viewer issue for Winoground

Comment:
I was able to reproduce it on a private dataset, let me work on a fix
Issue: Dataset viewer issue for Winoground

Comment:
Thanks for the heads up, I still need to fix some tests that are failing in the CI before merging ;)
Issue: Dataset viewer issue for Winoground

Comment:
The fix has been merged, we'll do a new release soon, and update the dataset viewer
Issue: Incorrect Russian filenames encoding after extraction by datasets.DownloadManager.download_and_extract()

Comment:
To reproduce:

```python
>>> import datasets
>>> datasets.get_dataset_split_names('MalakhovIlya/RuREBus', config_name='raw_txt')
Traceback (most recent call last):
  File "/home/slesage/hf/datasets-preview-backend/.venv/lib/python3.9/site-packages/datasets/inspect.py", line 280, in get_dataset_config_info
    for split_generator in builder._split_generators(
  File "/home/slesage/.cache/huggingface/modules/datasets_modules/datasets/MalakhovIlya--RuREBus/21046f5f1a0cf91187d68c30918d78d934ec7113ec435e146776d4f28f12c4ed/RuREBus.py", line 101, in _split_generators
    decode_file_names(folder)
  File "/home/slesage/.cache/huggingface/modules/datasets_modules/datasets/MalakhovIlya--RuREBus/21046f5f1a0cf91187d68c30918d78d934ec7113ec435e146776d4f28f12c4ed/RuREBus.py", line 26, in decode_file_names
    for root, dirs, files in os.walk(folder, topdown=False):
  File "/home/slesage/hf/datasets-preview-backend/.venv/lib/python3.9/site-packages/datasets/streaming.py", line 66, in wrapper
    return function(*args, use_auth_token=use_auth_token, **kwargs)
TypeError: xwalk() got an unexpected keyword argument 'topdown'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/slesage/hf/datasets-preview-backend/.venv/lib/python3.9/site-packages/datasets/inspect.py", line 323, in get_dataset_split_names
    info = get_dataset_config_info(
  File "/home/slesage/hf/datasets-preview-backend/.venv/lib/python3.9/site-packages/datasets/inspect.py", line 285, in get_dataset_config_info
    raise SplitsNotFoundError("The split names could not be parsed from the dataset config.") from err
datasets.inspect.SplitsNotFoundError: The split names could not be parsed from the dataset config.
```

It's not related to the dataset viewer. Maybe @albertvillanova or @lhoestq could help more on this issue.