Upload folder using huggingface_hub
Browse files- .DS_Store +0 -0
- data/.DS_Store +0 -0
- data/files.zip +3 -0
- data/metadata.zip +3 -0
- testing.py +57 -0
.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
data/.DS_Store
ADDED
|
Binary file (6.15 kB). View file
|
|
|
data/files.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:eef1883310f1e0395ee1e281f80a48acda6e5b768172b9926d8421b700a1fb95
|
| 3 |
+
size 616441
|
data/metadata.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7f0370148620408f520f39c454fe343845701644537bee790360741efa10d6ae
|
| 3 |
+
size 2379
|
testing.py
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import datasets
|
| 3 |
+
import pandas as pd
|
| 4 |
+
|
| 5 |
+
_DESCRIPTION = """\
|
| 6 |
+
This dataset is collected from Commonvoice for testing purposes.
|
| 7 |
+
"""
|
| 8 |
+
|
| 9 |
+
_CITATION = "Some citation"
|
| 10 |
+
|
| 11 |
+
_data_dir = "data"
|
| 12 |
+
|
| 13 |
+
class ASRTesting(datasets.GeneratorBasedBuilder):
|
| 14 |
+
|
| 15 |
+
def _info(self):
|
| 16 |
+
return datasets.DatasetInfo(
|
| 17 |
+
description=_DESCRIPTION,
|
| 18 |
+
features=datasets.Features(
|
| 19 |
+
{
|
| 20 |
+
"path": datasets.Value("string"),
|
| 21 |
+
"audio": datasets.Audio(sampling_rate=16_000),
|
| 22 |
+
"transcript": datasets.Value("string"),
|
| 23 |
+
}
|
| 24 |
+
),
|
| 25 |
+
supervised_keys=None,
|
| 26 |
+
citation=_CITATION,
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
+
def _split_generators(self, dl_manager):
|
| 30 |
+
download_dir = dl_manager.download_and_extract(
|
| 31 |
+
{
|
| 32 |
+
"files": os.path.join(_data_dir, "files.zip"),
|
| 33 |
+
"metadata": os.path.join(_data_dir, "metadata.zip")
|
| 34 |
+
}
|
| 35 |
+
)
|
| 36 |
+
|
| 37 |
+
return [
|
| 38 |
+
datasets.SplitGenerator(
|
| 39 |
+
name=datasets.Split.TRAIN,
|
| 40 |
+
gen_kwargs={
|
| 41 |
+
"split": datasets.Split.TRAIN,
|
| 42 |
+
"data_dir": os.path.join(download_dir["files"], "files"),
|
| 43 |
+
"metapath": os.path.join(download_dir["metadata"], "metadata", "dataset.tsv"),
|
| 44 |
+
|
| 45 |
+
},
|
| 46 |
+
)
|
| 47 |
+
]
|
| 48 |
+
|
| 49 |
+
def _generate_examples(self, data_dir, metapath, split):
|
| 50 |
+
metadata = pd.read_csv(metapath)
|
| 51 |
+
for key, row in metadata.iterrows():
|
| 52 |
+
audio_path = os.path.join(data_dir, row["audio"])
|
| 53 |
+
yield key, {
|
| 54 |
+
"audio": audio_path,
|
| 55 |
+
"transcript": row["transcript"],
|
| 56 |
+
"path": audio_path,
|
| 57 |
+
}
|