Datasets:
Upload ./fleurs-hs.py with huggingface_hub
Browse files- fleurs-hs.py +20 -26
fleurs-hs.py
CHANGED
@@ -59,20 +59,19 @@ class FLEURSHSDataset(GeneratorBasedBuilder):
|
|
59 |
self,
|
60 |
split: str,
|
61 |
) -> Path:
|
62 |
-
return Path(
|
63 |
|
64 |
def _info(self) -> DatasetInfo:
|
65 |
return DatasetInfo(
|
66 |
-
description="FLEURS Human-Synthetic
|
67 |
features=Features(
|
68 |
{
|
69 |
-
"path": Value("string"),
|
70 |
"audio": Audio(sampling_rate=16000),
|
71 |
"label": Value("string"),
|
72 |
}
|
73 |
),
|
74 |
supervised_keys=None,
|
75 |
-
homepage="https://huggingface.co/datasets/
|
76 |
license="CC BY 4.0",
|
77 |
citation="\n".join(
|
78 |
(
|
@@ -84,7 +83,7 @@ class FLEURSHSDataset(GeneratorBasedBuilder):
|
|
84 |
"volume={}",
|
85 |
"number={}",
|
86 |
"pages={1-5}",
|
87 |
-
"keywords={
|
88 |
"doi={}", # TODO: Add DOI once known
|
89 |
"}",
|
90 |
)
|
@@ -135,26 +134,21 @@ class FLEURSHSDataset(GeneratorBasedBuilder):
|
|
135 |
archive_iterable: ArchiveIterable,
|
136 |
) -> Iterable[Tuple[int, Dict[str, Any]]]:
|
137 |
current_index = 0
|
138 |
-
for
|
139 |
-
|
140 |
-
path
|
141 |
-
|
|
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
# - 'human'
|
150 |
-
# - 'synthetic`
|
151 |
-
#
|
152 |
-
# Therefore the label is the name of their parent folder
|
153 |
-
label = path.parent.name
|
154 |
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
current_index += 1
|
|
|
59 |
self,
|
60 |
split: str,
|
61 |
) -> Path:
|
62 |
+
return Path("data") / self.config.name / "splits" / f"{split}.tar.gz"
|
63 |
|
64 |
def _info(self) -> DatasetInfo:
|
65 |
return DatasetInfo(
|
66 |
+
description="FLEURS Human-Synthetic classification dataset",
|
67 |
features=Features(
|
68 |
{
|
|
|
69 |
"audio": Audio(sampling_rate=16000),
|
70 |
"label": Value("string"),
|
71 |
}
|
72 |
),
|
73 |
supervised_keys=None,
|
74 |
+
homepage="https://huggingface.co/datasets/realnetworks-kontxt/fleurs-hs",
|
75 |
license="CC BY 4.0",
|
76 |
citation="\n".join(
|
77 |
(
|
|
|
83 |
"volume={}",
|
84 |
"number={}",
|
85 |
"pages={1-5}",
|
86 |
+
"keywords={Synthetic speech detection;text-to-speech;wav2vec 2.0;spoofing attack;multilingualism}",
|
87 |
"doi={}", # TODO: Add DOI once known
|
88 |
"}",
|
89 |
)
|
|
|
134 |
archive_iterable: ArchiveIterable,
|
135 |
) -> Iterable[Tuple[int, Dict[str, Any]]]:
|
136 |
current_index = 0
|
137 |
+
for audio_path, audio_file in archive_iterable:
|
138 |
+
audio = {
|
139 |
+
"path": audio_path,
|
140 |
+
"bytes": audio_file.read(),
|
141 |
+
}
|
142 |
|
143 |
+
# Samples are located in one of 2 folders:
|
144 |
+
# - 'human'
|
145 |
+
# - 'synthetic`
|
146 |
+
#
|
147 |
+
# Therefore the label is the name of their parent folder
|
148 |
+
label = Path(audio_path).parent.name
|
|
|
|
|
|
|
|
|
|
|
149 |
|
150 |
+
yield current_index, {
|
151 |
+
"audio": audio,
|
152 |
+
"label": label,
|
153 |
+
}
|
154 |
+
current_index += 1
|
|