-
Notifications
You must be signed in to change notification settings - Fork 3.1k
VIVOS dataset for Vietnamese ASR #2780
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e9b63e8
Add VIVOS dataset
binh234 6793fc7
Update VIVOS dataset and dataset card for Vietnamese ASR
binh234 6df51e3
Merge remote-tracking branch 'upstream/master' into vivos
binh234 e58311d
Update dataset_infos.json file
binh234 9b6e097
Correct task_categories and task_ids tags in dataset card
binh234 612bbb0
Apply suggestions from code review
binh234 0fbe818
Merge branch 'huggingface:master' into vivos
binh234 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"default": {"description": "VIVOS is a free Vietnamese speech corpus consisting of 15 hours of recording speech prepared for VietnameseAutomatic Speech Recognition task.\nThe corpus was prepared by AILAB, a computer science lab of VNUHCM - University of Science, with Prof. Vu Hai Quan is the head of.\nWe publish this corpus in hope to attract more scientists to solve Vietnamese speech recognition problems. The corpus should only be used for academic purposes.\n", "citation": "@InProceedings{vivos:2016,\nAddress = {Ho Chi Minh, Vietnam}\ntitle = {VIVOS: 15 hours of recording speech prepared for Vietnamese Automatic Speech Recognition},\nauthor={Prof. Vu Hai Quan},\nyear={2016}\n}\n", "homepage": "https://ailab.hcmus.edu.vn/vivos", "license": "cc-by-sa-4.0", "features": {"sentence": {"dtype": "string", "id": null, "_type": "Value"}, "path": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "vivos_dataset", "config_name": "default", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 2894725, "num_examples": 11660, "dataset_name": "vivos_dataset"}, "test": {"name": "test", "num_bytes": 174254, "num_examples": 760, "dataset_name": "vivos_dataset"}}, "download_checksums": {"https://ailab.hcmus.edu.vn/assets/vivos.tar.gz": {"num_bytes": 1474408300, "checksum": "147477f7a7702cbafc2ee3808d1c142989d0dbc8d9fce8e07d5f329d5119e4ca"}}, "download_size": 1474408300, "post_processing_size": null, "dataset_size": 3068979, "size_in_bytes": 1477477279}} |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| # coding=utf-8 | ||
| # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor. | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| import os | ||
| import datasets | ||
|
|
||
| # Find for instance the citation on arxiv or on the dataset repo/website | ||
| _CITATION = """\ | ||
| @InProceedings{vivos:2016, | ||
| Address = {Ho Chi Minh, Vietnam} | ||
| title = {VIVOS: 15 hours of recording speech prepared for Vietnamese Automatic Speech Recognition}, | ||
| author={Prof. Vu Hai Quan}, | ||
| year={2016} | ||
| } | ||
| """ | ||
|
|
||
| _DESCRIPTION = """\ | ||
| VIVOS is a free Vietnamese speech corpus consisting of 15 hours of recording speech prepared for VietnameseAutomatic Speech Recognition task. | ||
| The corpus was prepared by AILAB, a computer science lab of VNUHCM - University of Science, with Prof. Vu Hai Quan is the head of. | ||
| We publish this corpus in hope to attract more scientists to solve Vietnamese speech recognition problems. The corpus should only be used for academic purposes. | ||
| """ | ||
|
|
||
| _HOMEPAGE = "https://ailab.hcmus.edu.vn/vivos" | ||
|
|
||
| _LICENSE = "cc-by-sa-4.0" | ||
|
|
||
| _DATA_URL = "https://ailab.hcmus.edu.vn/assets/vivos.tar.gz" | ||
|
|
||
|
|
||
| # TODO: Name of the dataset usually match the script name with CamelCase instead of snake_case | ||
| class VivosDataset(datasets.GeneratorBasedBuilder): | ||
| """VIVOS is a free Vietnamese speech corpus consisting of 15 hours of recording speech prepared for Vietnamese Automatic Speech Recognition task.""" | ||
|
|
||
| VERSION = datasets.Version("1.1.0") | ||
|
|
||
| # This is an example of a dataset with multiple configurations. | ||
| # If you don't want/need to define several sub-sets in your dataset, | ||
| # just remove the BUILDER_CONFIG_CLASS and the BUILDER_CONFIGS attributes. | ||
|
|
||
| # If you need to make complex sub-parts in the datasets with configurable options | ||
| # You can create your own builder configuration class to store attribute, inheriting from datasets.BuilderConfig | ||
| # BUILDER_CONFIG_CLASS = MyBuilderConfig | ||
|
|
||
| # You will be able to load one or the other configurations in the following list with | ||
| # data = datasets.load_dataset('my_dataset', 'first_domain') | ||
| # data = datasets.load_dataset('my_dataset', 'second_domain') | ||
|
|
||
| def _info(self): | ||
| # TODO: This method specifies the datasets.DatasetInfo object which contains informations and typings for the dataset | ||
| features = datasets.Features( | ||
| { | ||
| "sentence": datasets.Value("string"), | ||
| "path": datasets.Value("string"), | ||
| } | ||
| ) | ||
| return datasets.DatasetInfo( | ||
| # This is the description that will appear on the datasets page. | ||
| description=_DESCRIPTION, | ||
| # This defines the different columns of the dataset and their types | ||
| features=features, # Here we define them above because they are different between the two configurations | ||
| # If there's a common (input, target) tuple from the features, | ||
| # specify them here. They'll be used if as_supervised=True in | ||
| # builder.as_dataset. | ||
| supervised_keys=None, | ||
| # Homepage of the dataset for documentation | ||
| homepage=_HOMEPAGE, | ||
| # License for the dataset if available | ||
| license=_LICENSE, | ||
| # Citation for the dataset | ||
| citation=_CITATION, | ||
| ) | ||
|
|
||
| def _split_generators(self, dl_manager): | ||
| """Returns SplitGenerators.""" | ||
| # TODO: This method is tasked with downloading/extracting the data and defining the splits depending on the configuration | ||
| # If several configurations are possible (listed in BUILDER_CONFIGS), the configuration selected by the user is in self.config.name | ||
|
|
||
| # dl_manager is a datasets.download.DownloadManager that can be used to download and extract URLs | ||
| # It can accept any type or nested list/dict and will give back the same structure with the url replaced with path to local files. | ||
| # By default the archives will be extracted and a path to a cached folder where they are extracted is returned instead of the archive | ||
| dl_path = dl_manager.download_and_extract(_DATA_URL.format(self.config.name)) | ||
| data_dir = os.path.join(dl_path, 'vivos') | ||
| train_dir = os.path.join(data_dir, 'train') | ||
| test_dir = os.path.join(data_dir, 'test') | ||
| return [ | ||
| datasets.SplitGenerator( | ||
| name=datasets.Split.TRAIN, | ||
| # These kwargs will be passed to _generate_examples | ||
| gen_kwargs={ | ||
| "filepath": os.path.join(train_dir, "prompts.txt"), | ||
| "path_to_clips": os.path.join(train_dir, "waves") | ||
| }, | ||
| ), | ||
| datasets.SplitGenerator( | ||
| name=datasets.Split.TEST, | ||
| # These kwargs will be passed to _generate_examples | ||
| gen_kwargs={ | ||
| "filepath": os.path.join(test_dir, "prompts.txt"), | ||
| "path_to_clips": os.path.join(test_dir, "waves") | ||
| }, | ||
| ) | ||
| ] | ||
|
|
||
| def _generate_examples( | ||
| self, filepath, path_to_clips # method parameters are unpacked from `gen_kwargs` as given in `_split_generators` | ||
| ): | ||
| """ Yields examples as (key, example) tuples. """ | ||
| # This method handles input defined in _split_generators to yield (key, example) tuples from the dataset. | ||
| # The `key` is here for legacy reason (tfds) and is not important in itself. | ||
|
|
||
| with open(filepath, encoding="utf-8") as f: | ||
| lines = f.readlines() | ||
| for id_, row in enumerate(lines): | ||
albertvillanova marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| data = row.strip().split(" ", 1) | ||
| yield id_, { | ||
| "path": os.path.join(path_to_clips, data[0] + ".wav"), | ||
| "sentence": data[1], | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is no need of the
.format(self.config.name)part of the code.