Datasets:
Commit ·
86e37b9
1
Parent(s): c3a0ff1
trying again by getting rid of dataset class script
Browse files- README.md +6 -20
- dataset.py +0 -62
README.md
CHANGED
|
@@ -5,28 +5,14 @@ task_categories:
|
|
| 5 |
language:
|
| 6 |
- pt
|
| 7 |
pretty_name: LapsBenchmark
|
| 8 |
-
annotations_creators:
|
| 9 |
-
- found
|
| 10 |
-
language_creators:
|
| 11 |
-
- found
|
| 12 |
multilinguality:
|
| 13 |
- monolingual
|
| 14 |
size_categories:
|
| 15 |
- 10K<n<100K
|
| 16 |
-
|
| 17 |
-
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
audio:
|
| 23 |
-
sampling_rate: 16000
|
| 24 |
-
- name: text
|
| 25 |
-
dtype: string
|
| 26 |
-
splits:
|
| 27 |
-
- name: train
|
| 28 |
-
num_bytes: 3621471
|
| 29 |
-
num_examples: 20
|
| 30 |
-
download_size: 3739136
|
| 31 |
-
dataset_size: 3621471
|
| 32 |
---
|
|
|
|
| 5 |
language:
|
| 6 |
- pt
|
| 7 |
pretty_name: LapsBenchmark
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
multilinguality:
|
| 9 |
- monolingual
|
| 10 |
size_categories:
|
| 11 |
- 10K<n<100K
|
| 12 |
+
configs:
|
| 13 |
+
- config_name: default
|
| 14 |
+
data_files:
|
| 15 |
+
- split: test
|
| 16 |
+
path:
|
| 17 |
+
- "data/LapsBM-F004.tar"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
---
|
dataset.py
DELETED
|
@@ -1,62 +0,0 @@
|
|
| 1 |
-
import io
|
| 2 |
-
import os
|
| 3 |
-
import tarfile
|
| 4 |
-
|
| 5 |
-
import datasets
|
| 6 |
-
import soundfile as sf
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
class LapsBenchmarkDataset(datasets.GeneratorBasedBuilder):
|
| 10 |
-
BUILDER_CONFIGS = [
|
| 11 |
-
datasets.BuilderConfig(name="default", version=datasets.Version("1.0.0"))
|
| 12 |
-
]
|
| 13 |
-
DEFAULT_CONFIG_NAME = "default"
|
| 14 |
-
|
| 15 |
-
def _info(self):
|
| 16 |
-
return datasets.DatasetInfo(
|
| 17 |
-
features=datasets.Features({
|
| 18 |
-
"audio": datasets.Audio(sampling_rate=16_000),
|
| 19 |
-
"text": datasets.Value("string")
|
| 20 |
-
}),
|
| 21 |
-
)
|
| 22 |
-
|
| 23 |
-
def _split_generators(self, dl_manager):
|
| 24 |
-
archive_path = dl_manager.download("data/LapsBM-F004.tar")
|
| 25 |
-
return [
|
| 26 |
-
datasets.SplitGenerator(
|
| 27 |
-
name=datasets.Split.TRAIN,
|
| 28 |
-
gen_kwargs={"archive_path": archive_path}
|
| 29 |
-
)
|
| 30 |
-
]
|
| 31 |
-
|
| 32 |
-
def _generate_examples(self, archive_path):
|
| 33 |
-
with tarfile.open(archive_path) as tar:
|
| 34 |
-
wav, txt = {}, {}
|
| 35 |
-
for member in tar.getmembers():
|
| 36 |
-
uttid, _ = os.path.splitext(os.path.basename(member.name))
|
| 37 |
-
if not os.path.basename(member.name).startswith("LapsBM"):
|
| 38 |
-
continue
|
| 39 |
-
if member.name.endswith(".wav"):
|
| 40 |
-
audio_bytes = tar.extractfile(member).read()
|
| 41 |
-
audio_array, _ = sf.read(io.BytesIO(audio_bytes))
|
| 42 |
-
wav[uttid] = audio_array
|
| 43 |
-
elif member.name.endswith(".txt"):
|
| 44 |
-
text_bytes = tar.extractfile(member).read()
|
| 45 |
-
text_string = text_bytes.decode("utf-8").strip()
|
| 46 |
-
txt[uttid] = text_string
|
| 47 |
-
for uttid in sorted(set(list(wav.keys()) + list(txt.keys()))):
|
| 48 |
-
samples = wav[uttid]
|
| 49 |
-
text = txt[uttid]
|
| 50 |
-
yield uttid, {
|
| 51 |
-
"audio": {
|
| 52 |
-
"array": samples,
|
| 53 |
-
"sampling_rate": 16000,
|
| 54 |
-
},
|
| 55 |
-
"text": text
|
| 56 |
-
}
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
if __name__ == "__main__":
|
| 60 |
-
d = LapsBenchmarkDataset()
|
| 61 |
-
egs = d._generate_examples("data/LapsBM-F004.tar")
|
| 62 |
-
print(next(egs))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|