Datasets:

Modalities:
Audio
Text
ArXiv:
Libraries:
Datasets
License:
polinaeterna HF staff commited on
Commit
858a490
1 Parent(s): 28cc287

process all examples

Browse files
Files changed (1) hide show
  1. voxpopuli.py +3 -3
voxpopuli.py CHANGED
@@ -2,7 +2,6 @@ from collections import defaultdict
2
  import os
3
  import glob
4
  import csv
5
- from pathlib import Path
6
  from tqdm.auto import tqdm
7
 
8
  import datasets
@@ -67,7 +66,7 @@ class Voxpopuli(datasets.GeneratorBasedBuilder):
67
  for name in _LANGUAGES + ["10k", "100k", "400k"]
68
  ]
69
  # DEFAULT_CONFIG_NAME = "400k"
70
- # DEFAULT_WRITER_BATCH_SIZE = 1
71
 
72
  def _info(self):
73
  features = datasets.Features(
@@ -137,7 +136,7 @@ class Voxpopuli(datasets.GeneratorBasedBuilder):
137
  metadata = self._read_metadata(metadata_path)
138
 
139
  for data_dir in data_dirs:
140
- for file in glob.glob(f"{data_dir}/**/*.ogg", recursive=True)[:5]:
141
  path_components = file.split(os.sep)
142
  language, year, audio_filename = path_components[-3:]
143
  audio_id, _ = os.path.splitext(audio_filename)
@@ -146,6 +145,7 @@ class Voxpopuli(datasets.GeneratorBasedBuilder):
146
  waveform, sr = torchaudio.load(file)
147
  duration = waveform.size(1)
148
 
 
149
  for segment_id, (start, stop) in enumerate(timestamps):
150
  segment = waveform[:, int(start * sr): min(int(stop * sr), duration)]
151
 
 
2
  import os
3
  import glob
4
  import csv
 
5
  from tqdm.auto import tqdm
6
 
7
  import datasets
 
66
  for name in _LANGUAGES + ["10k", "100k", "400k"]
67
  ]
68
  # DEFAULT_CONFIG_NAME = "400k"
69
+ # DEFAULT_WRITER_BATCH_SIZE = 256
70
 
71
  def _info(self):
72
  features = datasets.Features(
 
136
  metadata = self._read_metadata(metadata_path)
137
 
138
  for data_dir in data_dirs:
139
+ for file in glob.glob(f"{data_dir}/**/*.ogg", recursive=True):
140
  path_components = file.split(os.sep)
141
  language, year, audio_filename = path_components[-3:]
142
  audio_id, _ = os.path.splitext(audio_filename)
 
145
  waveform, sr = torchaudio.load(file)
146
  duration = waveform.size(1)
147
 
148
+ # split audio on the fly and write segments as arrays
149
  for segment_id, (start, stop) in enumerate(timestamps):
150
  segment = waveform[:, int(start * sr): min(int(stop * sr), duration)]
151