lhoestq HF staff commited on
Commit
41704f8
1 Parent(s): aad5542

Use audio feature in ASR task template (#4006)

Browse files

* use audio feature in ASR task template

* update datasets

* update tests

* typo

* update dataset_infos.json

Commit from https://github.com/huggingface/datasets/commit/32e0e79aa57b36a269b6f2ee38449a043a393e50

Files changed (2) hide show
  1. dataset_infos.json +1 -1
  2. lj_speech.py +1 -1
dataset_infos.json CHANGED
@@ -1 +1 @@
1
- {"main": {"description": "This is a public domain speech dataset consisting of 13,100 short audio clips of a single speaker reading \npassages from 7 non-fiction books in English. A transcription is provided for each clip. Clips vary in length \nfrom 1 to 10 seconds and have a total length of approximately 24 hours.\n\nNote that in order to limit the required storage for preparing this dataset, the audio\nis stored in the .wav format and is not converted to a float32 array. To convert the audio\nfile to a float32 array, please make use of the `.map()` function as follows:\n\n\n```python\nimport soundfile as sf\n\ndef map_to_array(batch):\n speech_array, _ = sf.read(batch[\"file\"])\n batch[\"speech\"] = speech_array\n return batch\n\ndataset = dataset.map(map_to_array, remove_columns=[\"file\"])\n```\n", "citation": "@misc{ljspeech17,\n author = {Keith Ito and Linda Johnson},\n title = {The LJ Speech Dataset},\n howpublished = {\\url{https://keithito.com/LJ-Speech-Dataset/}},\n year = 2017\n}\n", "homepage": "https://keithito.com/LJ-Speech-Dataset/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "file": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "normalized_text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "file", "output": "text"}, "task_templates": [{"task": "automatic-speech-recognition", "audio_file_path_column": "file", "transcription_column": "text"}], "builder_name": "lj_speech", "config_name": "main", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4667022, "num_examples": 13100, "dataset_name": "lj_speech"}}, "download_checksums": {"https://data.keithito.com/data/speech/LJSpeech-1.1.tar.bz2": {"num_bytes": 2748572632, "checksum": "be1a30453f28eb8dd26af4101ae40cbf2c50413b1bb21936cbcdc6fae3de8aa5"}}, "download_size": 2748572632, "post_processing_size": null, "dataset_size": 4667022, "size_in_bytes": 2753239654}}
 
1
+ {"main": {"description": "This is a public domain speech dataset consisting of 13,100 short audio clips of a single speaker reading \npassages from 7 non-fiction books in English. A transcription is provided for each clip. Clips vary in length \nfrom 1 to 10 seconds and have a total length of approximately 24 hours.\n\nNote that in order to limit the required storage for preparing this dataset, the audio\nis stored in the .wav format and is not converted to a float32 array. To convert the audio\nfile to a float32 array, please make use of the `.map()` function as follows:\n\n\n```python\nimport soundfile as sf\n\ndef map_to_array(batch):\n speech_array, _ = sf.read(batch[\"file\"])\n batch[\"speech\"] = speech_array\n return batch\n\ndataset = dataset.map(map_to_array, remove_columns=[\"file\"])\n```\n", "citation": "@misc{ljspeech17,\n author = {Keith Ito and Linda Johnson},\n title = {The LJ Speech Dataset},\n howpublished = {\\url{https://keithito.com/LJ-Speech-Dataset/}},\n year = 2017\n}\n", "homepage": "https://keithito.com/LJ-Speech-Dataset/", "license": "", "features": {"id": {"dtype": "string", "id": null, "_type": "Value"}, "audio": {"sampling_rate": 22050, "mono": true, "decode": true, "id": null, "_type": "Audio"}, "file": {"dtype": "string", "id": null, "_type": "Value"}, "text": {"dtype": "string", "id": null, "_type": "Value"}, "normalized_text": {"dtype": "string", "id": null, "_type": "Value"}}, "post_processed": null, "supervised_keys": {"input": "file", "output": "text"}, "task_templates": [{"task": "automatic-speech-recognition", "audio_column": "audio", "transcription_column": "text"}], "builder_name": "lj_speech", "config_name": "main", "version": {"version_str": "1.1.0", "description": null, "major": 1, "minor": 1, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 4667022, "num_examples": 13100, "dataset_name": "lj_speech"}}, "download_checksums": {"https://data.keithito.com/data/speech/LJSpeech-1.1.tar.bz2": {"num_bytes": 2748572632, "checksum": "be1a30453f28eb8dd26af4101ae40cbf2c50413b1bb21936cbcdc6fae3de8aa5"}}, "download_size": 2748572632, "post_processing_size": null, "dataset_size": 4667022, "size_in_bytes": 2753239654}}
lj_speech.py CHANGED
@@ -83,7 +83,7 @@ class LJSpeech(datasets.GeneratorBasedBuilder):
83
  supervised_keys=("file", "text"),
84
  homepage=_URL,
85
  citation=_CITATION,
86
- task_templates=[AutomaticSpeechRecognition(audio_file_path_column="file", transcription_column="text")],
87
  )
88
 
89
  def _split_generators(self, dl_manager):
 
83
  supervised_keys=("file", "text"),
84
  homepage=_URL,
85
  citation=_CITATION,
86
+ task_templates=[AutomaticSpeechRecognition(audio_column="audio", transcription_column="text")],
87
  )
88
 
89
  def _split_generators(self, dl_manager):