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

Simplify Common Voice code #3817

Merged
merged 2 commits into from
Mar 4, 2022
Merged

Simplify Common Voice code #3817

merged 2 commits into from
Mar 4, 2022

Conversation

lhoestq
Copy link
Member

@lhoestq lhoestq commented Mar 3, 2022

In #3736 we introduced one method to generate examples when streaming, that is different from the one when not streaming.

In this PR I propose a new implementation which is simpler: it only has one function, based on iter_archive. And you still have access to local audio files when loading the dataset in non-streaming mode.

cc @patrickvonplaten @polinaeterna @anton-l @albertvillanova since this will become the template for many audio datasets to come.

This change can also trivially be applied to the other audio datasets that already exist. Using this line, you can get access to local files in non-streaming mode:

local_extracted_archive = dl_manager.extract(archive_path) if not dl_manager.is_streaming else None

@polinaeterna
Copy link
Contributor

I think the script looks pretty clean and readable now! cool!

Copy link
Contributor

@polinaeterna polinaeterna left a comment

Choose a reason for hiding this comment

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

🎉🤗

Copy link
Contributor

@patrickvonplaten patrickvonplaten left a comment

Choose a reason for hiding this comment

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

Very nice!

@lhoestq lhoestq merged commit f592998 into master Mar 4, 2022
@lhoestq lhoestq deleted the simplify-common_voice branch March 4, 2022 12:39
Copy link
Member

@albertvillanova albertvillanova left a comment

Choose a reason for hiding this comment

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

Much cleaner!!! 👍

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.

4 participants