LOAD DATASET WITH STREAM

#10
by Jonnhan - opened

SO: WINDOWS 10


datasets[audio] v2.20.0


CODE:
from datasets import load_dataset

ds = load_dataset("facebook/voxpopuli", name="de", streaming=True)
ds_head = ds['train'].take(3)
example = list(ds_head)[-1]
example


ERROR:
Traceback (most recent call last):
File "c:\Users\Jonnathan\Desktop\Materiais de Estudo - Datascience\8_AUDIO_HUGGING_FACE\UNIT 2. introduction to audio applications\4_.py", line 7, in
example = list(ds_head)[-1]
^^^^^^^^^^^^^
File "C:\Users\Jonnathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\datasets\iterable_dataset.py", line 1388, in iter
for key, example in ex_iterable:
File "C:\Users\Jonnathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\datasets\iterable_dataset.py", line 1044, in iter
yield from islice(self.ex_iterable, self.n)
File "C:\Users\Jonnathan\AppData\Local\Programs\Python\Python311\Lib\site-packages\datasets\iterable_dataset.py", line 234, in iter
yield from self.generate_examples_fn(**self.kwargs)
File "C:\Users\Jonnathan.cache\huggingface\modules\datasets_modules\datasets\facebook--voxpopuli\b5ff837284f0778eefe0f642734e142d8c3f574eba8c9c8a4b13602297f73604\voxpopuli.py", line 221, in _generate_examples
**{feature: metadata[audio_id][feature] for feature in features},
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Jonnathan.cache\huggingface\modules\datasets_modules\datasets\facebook--voxpopuli\b5ff837284f0778eefe0f642734e142d8c3f574eba8c9c8a4b13602297f73604\voxpopuli.py", line 221, in
**{feature: metadata[audio_id][feature] for feature in features},
~~~~~~~~^^^^^^^^^^
KeyError: 'train_part_0/20120315-0900-PLENARY-14-de_20120315-16:29:53_3'

I saw the code, and making the modifications on line 215 in the voxpopuli.py file worked for me:


BEFORE: audio_id = audio_filename.split(os.sep)[-1].split(".wav")[0]


AFTER: audio_id = audio_filename.split(os.sep)[-1].split(".wav")[0].split('/')[-1]

I had the same issue in locally, but not in colab, there works fine. Did you clone whole dataset in your space and then modified voxpopuli.py?

I think Colab uses Linux, and the issue I encountered was in a Windows environment.

I didn't clone the Dataset, I just modified voxpopuli.py to enable streaming mode.

Sign up or log in to comment