system HF staff commited on
Commit
bc51ffc
1 Parent(s): cf54b2f

Update files from the datasets library (from 1.14.0)

Browse files

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

Files changed (2) hide show
  1. README.md +31 -6
  2. superb.py +21 -5
README.md CHANGED
@@ -73,7 +73,7 @@ SUPERB is a leaderboard to benchmark the performance of a shared model across a
73
 
74
  ### Supported Tasks and Leaderboards
75
 
76
- The SUPERB leaderboard can be found here **ADD LINK WHEN LIVE** and consists of the following tasks:
77
 
78
  #### pr
79
 
@@ -205,6 +205,9 @@ An example from each split looks like:
205
  ```python
206
  {'chapter_id': 1240,
207
  'file': 'path/to/file.flac',
 
 
 
208
  'id': '103-1240-0000',
209
  'speaker_id': 103,
210
  'text': 'CHAPTER ONE MISSUS RACHEL LYNDE IS SURPRISED MISSUS RACHEL LYNDE '
@@ -220,6 +223,9 @@ An example from each split looks like:
220
  ```python
221
  {
222
  'file': '/path/yes/af7a8296_nohash_1.wav',
 
 
 
223
  'label': 0 # 'yes'
224
  }
225
  ```
@@ -234,6 +240,9 @@ An example from each split looks like:
234
  ```python
235
  {
236
  'file': "/path/wavs/speakers/2BqVo8kVB2Skwgyb/063aa8f0-4479-11e9-a9a5-5dbec3b8816a.wav",
 
 
 
237
  'speaker_id': '2BqVo8kVB2Skwgyb',
238
  'text': 'Turn the bedroom lights off',
239
  'action': 3, # 'deactivate'
@@ -252,6 +261,9 @@ An example from each split looks like:
252
  ```python
253
  {
254
  'file': '/path/wav/id10003/na8-QEFmj44/00003.wav',
 
 
 
255
  'label': 2 # 'id10003'
256
  }
257
  ```
@@ -268,6 +280,9 @@ An example from each split looks like:
268
  {
269
  'record_id': '1578-6379-0038_6415-111615-0009',
270
  'file': 'path/to/file.wav',
 
 
 
271
  'start': 0,
272
  'end': 1590,
273
  'speakers': [
@@ -287,6 +302,10 @@ An example from each split looks like:
287
 
288
  ### Data Fields
289
 
 
 
 
 
290
  #### pr
291
 
292
  [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
@@ -294,15 +313,17 @@ An example from each split looks like:
294
 
295
  #### asr
296
 
297
- - `file`: a `string` feature.
298
- - `text`: a `string` feature.
299
- - `speaker_id`: a `int64` feature.
300
- - `chapter_id`: a `int64` feature.
301
- - `id`: a `string` feature.
 
302
 
303
  #### ks
304
 
305
  - `file` (`string`): Path to the WAV audio file.
 
306
  - `label` (`ClassLabel`): Label of the spoken command. Possible values:
307
  - `0: "yes", 1: "no", 2: "up", 3: "down", 4: "left", 5: "right", 6: "on", 7: "off", 8: "stop", 9: "go", 10: "_silence_", 11: "_unknown_"`
308
 
@@ -313,6 +334,7 @@ An example from each split looks like:
313
  #### ic
314
 
315
  - `file` (`string`): Path to the WAV audio file.
 
316
  - `speaker_id` (`string`): ID of the speaker.
317
  - `text` (`string`): Transcription of the spoken command.
318
  - `action` (`ClassLabel`): Label of the command's action. Possible values:
@@ -330,6 +352,7 @@ An example from each split looks like:
330
  #### si
331
 
332
  - `file` (`string`): Path to the WAV audio file.
 
333
  - `label` (`ClassLabel`): Label (ID) of the speaker. Possible values:
334
  - `0: "id10001", 1: "id10002", 2: "id10003", ..., 1250: "id11251"`
335
 
@@ -343,6 +366,7 @@ An example from each split looks like:
343
  The data fields in all splits are:
344
  - `record_id` (`string`): ID of the record.
345
  - `file` (`string`): Path to the WAV audio file.
 
346
  - `start` (`integer`): Start frame of the audio.
347
  - `end` (`integer`): End frame of the audio.
348
  - `speakers` (`list` of `dict`): List of speakers in the audio. Each item contains the fields:
@@ -353,6 +377,7 @@ The data fields in all splits are:
353
  #### er
354
 
355
  - `file` (`string`): Path to the WAV audio file.
 
356
  - `label` (`ClassLabel`): Label of the speech emotion. Possible values:
357
  - `0: "neu", 1: "hap", 2: "ang", 3: "sad"`
358
 
 
73
 
74
  ### Supported Tasks and Leaderboards
75
 
76
+ The SUPERB leaderboard can be found here https://superbbenchmark.org/leaderboard and consists of the following tasks:
77
 
78
  #### pr
79
 
 
205
  ```python
206
  {'chapter_id': 1240,
207
  'file': 'path/to/file.flac',
208
+ 'audio': {'path': 'path/to/file.flac',
209
+ 'array': array([-0.00048828, -0.00018311, -0.00137329, ..., 0.00079346, 0.00091553, 0.00085449], dtype=float32),
210
+ 'sampling_rate': 16000},
211
  'id': '103-1240-0000',
212
  'speaker_id': 103,
213
  'text': 'CHAPTER ONE MISSUS RACHEL LYNDE IS SURPRISED MISSUS RACHEL LYNDE '
 
223
  ```python
224
  {
225
  'file': '/path/yes/af7a8296_nohash_1.wav',
226
+ 'audio': {'path': '/path/yes/af7a8296_nohash_1.wav',
227
+ 'array': array([-0.00048828, -0.00018311, -0.00137329, ..., 0.00079346, 0.00091553, 0.00085449], dtype=float32),
228
+ 'sampling_rate': 16000},
229
  'label': 0 # 'yes'
230
  }
231
  ```
 
240
  ```python
241
  {
242
  'file': "/path/wavs/speakers/2BqVo8kVB2Skwgyb/063aa8f0-4479-11e9-a9a5-5dbec3b8816a.wav",
243
+ 'audio': {'path': '/path/wavs/speakers/2BqVo8kVB2Skwgyb/063aa8f0-4479-11e9-a9a5-5dbec3b8816a.wav',
244
+ 'array': array([-0.00048828, -0.00018311, -0.00137329, ..., 0.00079346, 0.00091553, 0.00085449], dtype=float32),
245
+ 'sampling_rate': 16000},
246
  'speaker_id': '2BqVo8kVB2Skwgyb',
247
  'text': 'Turn the bedroom lights off',
248
  'action': 3, # 'deactivate'
 
261
  ```python
262
  {
263
  'file': '/path/wav/id10003/na8-QEFmj44/00003.wav',
264
+ 'audio': {'path': '/path/wav/id10003/na8-QEFmj44/00003.wav',
265
+ 'array': array([-0.00048828, -0.00018311, -0.00137329, ..., 0.00079346, 0.00091553, 0.00085449], dtype=float32),
266
+ 'sampling_rate': 16000},
267
  'label': 2 # 'id10003'
268
  }
269
  ```
 
280
  {
281
  'record_id': '1578-6379-0038_6415-111615-0009',
282
  'file': 'path/to/file.wav',
283
+ 'audio': {'path': 'path/to/file.wav',
284
+ 'array': array([-0.00048828, -0.00018311, -0.00137329, ..., 0.00079346, 0.00091553, 0.00085449], dtype=float32),
285
+ 'sampling_rate': 16000},
286
  'start': 0,
287
  'end': 1590,
288
  'speakers': [
 
302
 
303
  ### Data Fields
304
 
305
+ ####Note abouth the `audio` fields
306
+
307
+ 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]`.
308
+
309
  #### pr
310
 
311
  [More Information Needed](https://github.com/huggingface/datasets/blob/master/CONTRIBUTING.md#how-to-contribute-to-the-dataset-cards)
 
313
 
314
  #### asr
315
 
316
+ - `file` (`string`): Path to the WAV audio file.
317
+ - `audio` (`dict`): A dictionary containing the path to the downloaded audio file, the decoded audio array, and the sampling rate.
318
+ - `text` (`string`): The transcription of the audio file.
319
+ - `speaker_id` (`integer`): A unique ID of the speaker. The same speaker id can be found for multiple data samples.
320
+ - `chapter_id` (`integer`): ID of the audiobook chapter which includes the transcription.
321
+ - `id` (`string`): A unique ID of the data sample.
322
 
323
  #### ks
324
 
325
  - `file` (`string`): Path to the WAV audio file.
326
+ - `audio` (`dict`): A dictionary containing the path to the downloaded audio file, the decoded audio array, and the sampling rate.
327
  - `label` (`ClassLabel`): Label of the spoken command. Possible values:
328
  - `0: "yes", 1: "no", 2: "up", 3: "down", 4: "left", 5: "right", 6: "on", 7: "off", 8: "stop", 9: "go", 10: "_silence_", 11: "_unknown_"`
329
 
 
334
  #### ic
335
 
336
  - `file` (`string`): Path to the WAV audio file.
337
+ - `audio` (`dict`): A dictionary containing the path to the downloaded audio file, the decoded audio array, and the sampling rate.
338
  - `speaker_id` (`string`): ID of the speaker.
339
  - `text` (`string`): Transcription of the spoken command.
340
  - `action` (`ClassLabel`): Label of the command's action. Possible values:
 
352
  #### si
353
 
354
  - `file` (`string`): Path to the WAV audio file.
355
+ - `audio` (`dict`): A dictionary containing the path to the downloaded audio file, the decoded audio array, and the sampling rate.
356
  - `label` (`ClassLabel`): Label (ID) of the speaker. Possible values:
357
  - `0: "id10001", 1: "id10002", 2: "id10003", ..., 1250: "id11251"`
358
 
 
366
  The data fields in all splits are:
367
  - `record_id` (`string`): ID of the record.
368
  - `file` (`string`): Path to the WAV audio file.
369
+ - `audio` (`dict`): A dictionary containing the path to the downloaded audio file, the decoded audio array, and the sampling rate.
370
  - `start` (`integer`): Start frame of the audio.
371
  - `end` (`integer`): End frame of the audio.
372
  - `speakers` (`list` of `dict`): List of speakers in the audio. Each item contains the fields:
 
377
  #### er
378
 
379
  - `file` (`string`): Path to the WAV audio file.
380
+ - `audio` (`dict`): A dictionary containing the path to the downloaded audio file, the decoded audio array, and the sampling rate.
381
  - `label` (`ClassLabel`): Label of the speech emotion. Possible values:
382
  - `0: "neu", 1: "hap", 2: "ang", 3: "sad"`
383
 
superb.py CHANGED
@@ -137,6 +137,7 @@ class Superb(datasets.GeneratorBasedBuilder):
137
  features=datasets.Features(
138
  {
139
  "file": datasets.Value("string"),
 
140
  "text": datasets.Value("string"),
141
  "speaker_id": datasets.Value("int64"),
142
  "chapter_id": datasets.Value("int64"),
@@ -161,6 +162,7 @@ class Superb(datasets.GeneratorBasedBuilder):
161
  features=datasets.Features(
162
  {
163
  "file": datasets.Value("string"),
 
164
  "label": datasets.ClassLabel(
165
  names=[
166
  "yes",
@@ -194,6 +196,7 @@ class Superb(datasets.GeneratorBasedBuilder):
194
  features=datasets.Features(
195
  {
196
  "file": datasets.Value("string"),
 
197
  "speaker_id": datasets.Value("string"),
198
  "text": datasets.Value("string"),
199
  "action": datasets.ClassLabel(
@@ -235,6 +238,7 @@ class Superb(datasets.GeneratorBasedBuilder):
235
  features=datasets.Features(
236
  {
237
  "file": datasets.Value("string"),
 
238
  # VoxCeleb1 contains 1251 speaker IDs in range ["id10001",..."id11251"]
239
  "label": datasets.ClassLabel(names=[f"id{i + 10001}" for i in range(1251)]),
240
  }
@@ -257,6 +261,7 @@ class Superb(datasets.GeneratorBasedBuilder):
257
  {
258
  "record_id": datasets.Value("string"),
259
  "file": datasets.Value("string"),
 
260
  "start": datasets.Value("int64"),
261
  "end": datasets.Value("int64"),
262
  "speakers": [
@@ -284,6 +289,7 @@ class Superb(datasets.GeneratorBasedBuilder):
284
  features=datasets.Features(
285
  {
286
  "file": datasets.Value("string"),
 
287
  "label": datasets.ClassLabel(names=["neu", "hap", "ang", "sad"]),
288
  }
289
  ),
@@ -440,11 +446,13 @@ class Superb(datasets.GeneratorBasedBuilder):
440
  id_, transcript = line.split(" ", 1)
441
  audio_file = f"{id_}.flac"
442
  speaker_id, chapter_id = [int(el) for el in id_.split("-")[:2]]
 
443
  yield key, {
444
  "id": id_,
445
  "speaker_id": speaker_id,
446
  "chapter_id": chapter_id,
447
- "file": os.path.join(transcript_dir_path, audio_file),
 
448
  "text": transcript,
449
  }
450
  key += 1
@@ -460,7 +468,7 @@ class Superb(datasets.GeneratorBasedBuilder):
460
  label = "_silence_"
461
  else:
462
  label = "_unknown_"
463
- yield key, {"file": audio_file, "label": label}
464
  elif self.config.name == "ic":
465
  root_path = os.path.join(archive_path, "fluent_speech_commands_dataset")
466
  csv_path = os.path.join(root_path, "data", f"{split}_data.csv")
@@ -469,8 +477,10 @@ class Superb(datasets.GeneratorBasedBuilder):
469
  next(csv_reader)
470
  for row in csv_reader:
471
  key, file_path, speaker_id, text, action, object_, location = row
 
472
  yield key, {
473
- "file": os.path.join(root_path, file_path),
 
474
  "speaker_id": speaker_id,
475
  "text": text,
476
  "action": action,
@@ -486,8 +496,10 @@ class Superb(datasets.GeneratorBasedBuilder):
486
  if int(split_id) != split:
487
  continue
488
  speaker_id = file_path.split("/")[0]
 
489
  yield key, {
490
- "file": os.path.join(wav_path, file_path),
 
491
  "label": speaker_id,
492
  }
493
  elif self.config.name == "sd":
@@ -500,6 +512,7 @@ class Superb(datasets.GeneratorBasedBuilder):
500
  yield key, {
501
  "record_id": rec,
502
  "file": data.wavs[rec],
 
503
  "start": st,
504
  "end": ed,
505
  "speakers": speakers,
@@ -512,6 +525,7 @@ class Superb(datasets.GeneratorBasedBuilder):
512
  yield key, {
513
  "record_id": rec,
514
  "file": data.wavs[rec],
 
515
  "start": st,
516
  "end": ed,
517
  "speakers": speakers,
@@ -533,8 +547,10 @@ class Superb(datasets.GeneratorBasedBuilder):
533
  continue
534
  wav_subdir = filename.rsplit("_", 1)[0]
535
  filename = f"{filename}.wav"
 
536
  yield key, {
537
- "file": os.path.join(wav_path, wav_subdir, filename),
 
538
  "label": emo.replace("exc", "hap"),
539
  }
540
  key += 1
 
137
  features=datasets.Features(
138
  {
139
  "file": datasets.Value("string"),
140
+ "audio": datasets.features.Audio(sampling_rate=16_000),
141
  "text": datasets.Value("string"),
142
  "speaker_id": datasets.Value("int64"),
143
  "chapter_id": datasets.Value("int64"),
 
162
  features=datasets.Features(
163
  {
164
  "file": datasets.Value("string"),
165
+ "audio": datasets.features.Audio(sampling_rate=16_000),
166
  "label": datasets.ClassLabel(
167
  names=[
168
  "yes",
 
196
  features=datasets.Features(
197
  {
198
  "file": datasets.Value("string"),
199
+ "audio": datasets.features.Audio(sampling_rate=16_000),
200
  "speaker_id": datasets.Value("string"),
201
  "text": datasets.Value("string"),
202
  "action": datasets.ClassLabel(
 
238
  features=datasets.Features(
239
  {
240
  "file": datasets.Value("string"),
241
+ "audio": datasets.features.Audio(sampling_rate=16_000),
242
  # VoxCeleb1 contains 1251 speaker IDs in range ["id10001",..."id11251"]
243
  "label": datasets.ClassLabel(names=[f"id{i + 10001}" for i in range(1251)]),
244
  }
 
261
  {
262
  "record_id": datasets.Value("string"),
263
  "file": datasets.Value("string"),
264
+ "audio": datasets.features.Audio(sampling_rate=16_000),
265
  "start": datasets.Value("int64"),
266
  "end": datasets.Value("int64"),
267
  "speakers": [
 
289
  features=datasets.Features(
290
  {
291
  "file": datasets.Value("string"),
292
+ "audio": datasets.features.Audio(sampling_rate=16_000),
293
  "label": datasets.ClassLabel(names=["neu", "hap", "ang", "sad"]),
294
  }
295
  ),
 
446
  id_, transcript = line.split(" ", 1)
447
  audio_file = f"{id_}.flac"
448
  speaker_id, chapter_id = [int(el) for el in id_.split("-")[:2]]
449
+ audio_path = os.path.join(transcript_dir_path, audio_file)
450
  yield key, {
451
  "id": id_,
452
  "speaker_id": speaker_id,
453
  "chapter_id": chapter_id,
454
+ "file": audio_path,
455
+ "audio": audio_path,
456
  "text": transcript,
457
  }
458
  key += 1
 
468
  label = "_silence_"
469
  else:
470
  label = "_unknown_"
471
+ yield key, {"file": audio_file, "audio": audio_file, "label": label}
472
  elif self.config.name == "ic":
473
  root_path = os.path.join(archive_path, "fluent_speech_commands_dataset")
474
  csv_path = os.path.join(root_path, "data", f"{split}_data.csv")
 
477
  next(csv_reader)
478
  for row in csv_reader:
479
  key, file_path, speaker_id, text, action, object_, location = row
480
+ audio_path = os.path.join(root_path, file_path)
481
  yield key, {
482
+ "file": audio_path,
483
+ "audio": audio_path,
484
  "speaker_id": speaker_id,
485
  "text": text,
486
  "action": action,
 
496
  if int(split_id) != split:
497
  continue
498
  speaker_id = file_path.split("/")[0]
499
+ audio_path = os.path.join(wav_path, file_path)
500
  yield key, {
501
+ "file": audio_path,
502
+ "audio": audio_path,
503
  "label": speaker_id,
504
  }
505
  elif self.config.name == "sd":
 
512
  yield key, {
513
  "record_id": rec,
514
  "file": data.wavs[rec],
515
+ "audio": data.wavs[rec],
516
  "start": st,
517
  "end": ed,
518
  "speakers": speakers,
 
525
  yield key, {
526
  "record_id": rec,
527
  "file": data.wavs[rec],
528
+ "audio": data.wavs[rec],
529
  "start": st,
530
  "end": ed,
531
  "speakers": speakers,
 
547
  continue
548
  wav_subdir = filename.rsplit("_", 1)[0]
549
  filename = f"{filename}.wav"
550
+ audio_path = os.path.join(wav_path, wav_subdir, filename)
551
  yield key, {
552
+ "file": audio_path,
553
+ "audio": audio_path,
554
  "label": emo.replace("exc", "hap"),
555
  }
556
  key += 1