Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make several audio datasets streamable #3290

Merged
merged 47 commits into from
Nov 19, 2021
Merged

Make several audio datasets streamable #3290

merged 47 commits into from
Nov 19, 2021

Conversation

lhoestq
Copy link
Member

@lhoestq lhoestq commented Nov 17, 2021

Needs #3129 to be merged first

Make those audio datasets streamable:

  • common_voice
  • openslr
  • vivos
  • librispeech_asr (still has some issues to read FLAC) actually it's ok
  • multilingual_librispeech (yet to be converted) TODO in a separate PR

albertvillanova and others added 30 commits October 21, 2021 10:37
@lhoestq lhoestq changed the title Stream tar audio Make several audio datasets streamable Nov 17, 2021
@albertvillanova
Copy link
Member

Reading FLAC (for librispeech_asr) works OK for me (soundfile version: 0.10.3):

In [2]: ds = load_dataset("datasets/librispeech_asr/librispeech_asr.py", "clean", streaming=True, split="train.100")

In [3]: item = next(iter(ds))

In [4]: item.keys()
Out[4]: dict_keys(['file', 'audio', 'text', 'speaker_id', 'chapter_id', 'id'])

In [5]: item["file"]
Out[5]: '374-180298-0000.flac'

In [6]: item["audio"].keys()
Out[6]: dict_keys(['path', 'array', 'sampling_rate'])

In [7]: item["audio"]["sampling_rate"]
Out[7]: 16000

In [8]: item["audio"]["path"]
Out[8]: '374-180298-0000.flac'

In [9]: item["audio"]["array"].shape
Out[9]: (232480,)

@lhoestq
Copy link
Member Author

lhoestq commented Nov 18, 2021

Oh cool ! I think this might have come from an issue with my local soundfile installation then

@lhoestq
Copy link
Member Author

lhoestq commented Nov 18, 2021

I'll do multilingual_librispeech in a separate PR since it requires the data to be in another format (in particular separate the train/dev/test splits in different files)

@lhoestq lhoestq marked this pull request as ready for review November 19, 2021 15:08
@lhoestq lhoestq merged commit 0534a87 into master Nov 19, 2021
@lhoestq lhoestq deleted the stream-tar-audio branch November 19, 2021 15:08
@patrickvonplaten
Copy link
Contributor

@lhoestq @albertvillanova - think it would have been nice to have added a big message at the top stating that this is a breaking change and ping transformers people a bit more here.

"filepath": os.path.join(abs_path_to_data, "train.tsv"),
"path_to_clips": abs_path_to_clips,
"files": dl_manager.iter_archive(archive),
"filepath": "/".join([path_to_data, "train.tsv"]),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is breaking no?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants