Dataset Viewer issue for asapp/slue
State: closed

### Link

https://huggingface.co/datasets/asapp/slue/viewer/

### Description

Hi,

I wonder how to get the dataset viewer of our slue dataset to work.

Best,
Felix

### Owner

Yes

<img width="519" alt="Capture d’écran 2022-09-20 à 22 33 47" src="https://user-images.githubusercontent.com/1676121/191358952-1220cb7d-745a-4203-a66b-3c707b25038f.png">

```
Not found.

Error code:   SplitsResponseNotFound
```

https://datasets-server.huggingface.co/splits?dataset=asapp/slue

```json
{"error":"Not found."}
```

I just launched a refresh. It's weird, I don't see any entry for this dataset in the cache, it's a bug on our side. In order to try to understand what happened, did you change the visibility status from private to public, by any chance?

The dataset is being refreshed, please retry later.

<img width="802" alt="Capture d’écran 2022-09-20 à 22 39 46" src="https://user-images.githubusercontent.com/1676121/191360072-7cc86486-4e84-4b47-8f9a-4a69fe84a5ac.png">


OK. We now have an issue because the dataset cannot be streamed, and the dataset viewer relies on it.

Maybe @huggingface/datasets can help:

```
Error code:   StreamingRowsError
Exception:    NotImplementedError
Message:      Extraction protocol for TAR archives like 'https://public-dataset-model-store.awsdev.asapp.com/users/sshon/public/slue/slue-voxpopuli_v0.2_blind.tar.gz' is not implemented in streaming mode. Please use `dl_manager.iter_archive` instead.
Traceback:    Traceback (most recent call last):
               File "/src/services/worker/src/worker/responses/first_rows.py", line 337, in get_first_rows_response
                 rows = get_rows(dataset, config, split, streaming=True, rows_max_number=rows_max_number, hf_token=hf_token)
               File "/src/services/worker/src/worker/utils.py", line 123, in decorator
                 return func(*args, **kwargs)
               File "/src/services/worker/src/worker/responses/first_rows.py", line 65, in get_rows
                 ds = load_dataset(
               File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/load.py", line 1739, in load_dataset
                 return builder_instance.as_streaming_dataset(split=split)
               File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1025, in as_streaming_dataset
                 splits_generators = {sg.name: sg for sg in self._split_generators(dl_manager)}
               File "/tmp/modules-cache/datasets_modules/datasets/asapp--slue/adaa0c78233e1a1df9c2f054e690ec5fc3eaf453bd76b80fe5cbe5728e55d9b1/slue.py", line 189, in _split_generators
                 dl_dir = dl_manager.download_and_extract(_DL_URLS[config_name])
               File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/download/streaming_download_manager.py", line 944, in download_and_extract
                 return self.extract(self.download(url_or_urls))
               File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/download/streaming_download_manager.py", line 907, in extract
                 urlpaths = map_nested(self._extract, path_or_paths, map_tuple=True)
               File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/utils/py_utils.py", line 385, in map_nested
                 return function(data_struct)
               File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/download/streaming_download_manager.py", line 912, in _extract
                 protocol = _get_extraction_protocol(urlpath, use_auth_token=self.download_config.use_auth_token)
               File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/download/streaming_download_manager.py", line 390, in _get_extraction_protocol
                 raise NotImplementedError(
             NotImplementedError: Extraction protocol for TAR archives like 'https://public-dataset-model-store.awsdev.asapp.com/users/sshon/public/slue/slue-voxpopuli_v0.2_blind.tar.gz' is not implemented in streaming mode. Please use `dl_manager.iter_archive` instead.
```

Thanks @severo, 

Do I have to modify the python script to support streaming so that it can be previewed?
Is there a document somewhere that I can follow?


Hi @fwu-asapp thanks for reporting, and thanks @severo for the investigation.

As explained by @severo, the preview requires that your dataset loading script supports streaming.

There are several options here:
- the easiest would be to replace the source files, archived using ZIP instead TAR: the TAR format does not allow random access while streaming, but only sequential access; the ZIP files support streaming out of the box.
- alternatively, to stream TAR archives you can use `dl_manager.iter_archive`: the only prerequisite is that your "index" files (.tsv) should have been archived before their corresponding audio files, so while iterating the content of the TAR archive, the metadata files appear first. I think this is the case for voxpopuli tar but not for voxceleb.
- if your .tsv files were not archived before their corresponding audio files (I think this is the case for voxceleb), then you should extract the .tsv files and host them separately (you can host them on the same Hugging Face Hub).
  - you can take as example, e.g.: https://huggingface.co/datasets/vivos/blob/main/vivos.py

As an advanced approach, you can handle both streaming and non-streaming cases separately.
- as for example: https://huggingface.co/datasets/librispeech_asr/blob/main/librispeech_asr.py or https://huggingface.co/datasets/google/fleurs/blob/main/fleurs.py

See related discussion:
- https://github.com/huggingface/datasets/issues/4697#issuecomment-1191502492

Thanks @albertvillanova for your clarification. I'll talk to my collaborators to see if we can replace those files. Let me just close this issue for now.

FYI, after replacing the source files with the ZIP ones, the dataset viewer works well. Thanks again to @severo  and @albertvillanova for your help!

Great! And thank you for sharing that interesting dataset!