system HF staff commited on
Commit
ad31813
1 Parent(s): 00947c0

Update files from the datasets library (from 1.13.3)

Browse files

Release notes: https://github.com/huggingface/datasets/releases/tag/1.13.3

Files changed (2) hide show
  1. README.md +7 -1
  2. librispeech_asr.py +2 -0
README.md CHANGED
@@ -80,6 +80,10 @@ A typical data point comprises the path to the audio file, usually called `file`
80
  ```
81
  {'chapter_id': 141231,
82
  'file': '/home/patrick/.cache/huggingface/datasets/downloads/extracted/b7ded9969e09942ab65313e691e6fc2e12066192ee8527e21d634aca128afbe2/dev_clean/1272/141231/1272-141231-0000.flac',
 
 
 
 
83
  'id': '1272-141231-0000',
84
  'speaker_id': 1272,
85
  'text': 'A MAN SAID TO THE UNIVERSE SIR I EXIST'}
@@ -90,6 +94,8 @@ A typical data point comprises the path to the audio file, usually called `file`
90
 
91
  - file: A path to the downloaded audio file in .flac format.
92
 
 
 
93
  - text: the transcription of the audio file.
94
 
95
  - id: unique id of the data sample.
@@ -195,4 +201,4 @@ CC BY 4.0
195
 
196
  ### Contributions
197
 
198
- Thanks to [@patrickvonplaten](https://github.com/patrickvonplaten) for adding this dataset.
 
80
  ```
81
  {'chapter_id': 141231,
82
  'file': '/home/patrick/.cache/huggingface/datasets/downloads/extracted/b7ded9969e09942ab65313e691e6fc2e12066192ee8527e21d634aca128afbe2/dev_clean/1272/141231/1272-141231-0000.flac',
83
+ 'audio': {'path': '/home/patrick/.cache/huggingface/datasets/downloads/extracted/b7ded9969e09942ab65313e691e6fc2e12066192ee8527e21d634aca128afbe2/dev_clean/1272/141231/1272-141231-0000.flac',
84
+ 'array': array([-0.00048828, -0.00018311, -0.00137329, ..., 0.00079346,
85
+ 0.00091553, 0.00085449], dtype=float32),
86
+ 'sampling_rate': 16000},
87
  'id': '1272-141231-0000',
88
  'speaker_id': 1272,
89
  'text': 'A MAN SAID TO THE UNIVERSE SIR I EXIST'}
 
94
 
95
  - file: A path to the downloaded audio file in .flac format.
96
 
97
+ - audio: A dictionary containing the path to the downloaded audio file, the decoded audio array, and the sampling rate. Note that when accessing the audio column: `dataset[0]["audio"]` the audio file is automatically decoded and resampled to `dataset.features["audio"].sampling_rate`. Decoding and resampling of a large number of audio files might take a significant amount of time. Thus it is important to first query the sample index before the `"audio"` column, *i.e.* `dataset[0]["audio"]` should **always** be preferred over `dataset["audio"][0]`.
98
+
99
  - text: the transcription of the audio file.
100
 
101
  - id: unique id of the data sample.
 
201
 
202
  ### Contributions
203
 
204
+ Thanks to [@patrickvonplaten](https://github.com/patrickvonplaten) for adding this dataset.
librispeech_asr.py CHANGED
@@ -104,6 +104,7 @@ class LibrispeechASR(datasets.GeneratorBasedBuilder):
104
  features=datasets.Features(
105
  {
106
  "file": datasets.Value("string"),
 
107
  "text": datasets.Value("string"),
108
  "speaker_id": datasets.Value("int64"),
109
  "chapter_id": datasets.Value("int64"),
@@ -151,6 +152,7 @@ class LibrispeechASR(datasets.GeneratorBasedBuilder):
151
  "speaker_id": speaker_id,
152
  "chapter_id": chapter_id,
153
  "file": os.path.join(transcript_dir_path, audio_file),
 
154
  "text": transcript,
155
  }
156
  key += 1
 
104
  features=datasets.Features(
105
  {
106
  "file": datasets.Value("string"),
107
+ "audio": datasets.features.Audio(sampling_rate=16_000),
108
  "text": datasets.Value("string"),
109
  "speaker_id": datasets.Value("int64"),
110
  "chapter_id": datasets.Value("int64"),
 
152
  "speaker_id": speaker_id,
153
  "chapter_id": chapter_id,
154
  "file": os.path.join(transcript_dir_path, audio_file),
155
+ "audio": os.path.join(transcript_dir_path, audio_file),
156
  "text": transcript,
157
  }
158
  key += 1