andreagasparini
commited on
Commit
•
75c382e
1
Parent(s):
be1d1a3
Update librispeech_test_only.py
Browse files- librispeech_test_only.py +4 -105
librispeech_test_only.py
CHANGED
@@ -46,24 +46,14 @@ _DL_URL = "http://www.openslr.org/resources/12/"
|
|
46 |
|
47 |
_DL_URLS = {
|
48 |
"clean": {
|
49 |
-
"
|
50 |
-
"test": _DL_URL + "test-clean.tar.gz",
|
51 |
-
# "train.100": _DL_URL + "train-clean-100.tar.gz",
|
52 |
-
# "train.360": _DL_URL + "train-clean-360.tar.gz",
|
53 |
},
|
54 |
"other": {
|
55 |
-
"test": _DL_URL + "test-other.tar.gz"
|
56 |
-
"dev": _DL_URL + "dev-other.tar.gz",
|
57 |
-
# "train.500": _DL_URL + "train-other-500.tar.gz",
|
58 |
},
|
59 |
"all": {
|
60 |
-
"dev.clean": _DL_URL + "dev-clean.tar.gz",
|
61 |
-
"dev.other": _DL_URL + "dev-other.tar.gz",
|
62 |
"test.clean": _DL_URL + "test-clean.tar.gz",
|
63 |
-
"test.other": _DL_URL + "test-other.tar.gz"
|
64 |
-
# "train.clean.100": _DL_URL + "train-clean-100.tar.gz",
|
65 |
-
# "train.clean.360": _DL_URL + "train-clean-360.tar.gz",
|
66 |
-
# "train.other.500": _DL_URL + "train-other-500.tar.gz",
|
67 |
},
|
68 |
}
|
69 |
|
@@ -117,38 +107,8 @@ class LibrispeechASR(datasets.GeneratorBasedBuilder):
|
|
117 |
archive_path = dl_manager.download(_DL_URLS[self.config.name])
|
118 |
# (Optional) In non-streaming mode, we can extract the archive locally to have actual local audio files:
|
119 |
local_extracted_archive = dl_manager.extract(archive_path) if not dl_manager.is_streaming else {}
|
120 |
-
|
121 |
-
train_splits = list()
|
122 |
-
dev_splits = list()
|
123 |
|
124 |
if self.config.name == "clean":
|
125 |
-
"""
|
126 |
-
train_splits = [
|
127 |
-
datasets.SplitGenerator(
|
128 |
-
name="train.100",
|
129 |
-
gen_kwargs={
|
130 |
-
"local_extracted_archive": local_extracted_archive.get("train.100"),
|
131 |
-
"files": dl_manager.iter_archive(archive_path["train.100"]),
|
132 |
-
},
|
133 |
-
),
|
134 |
-
datasets.SplitGenerator(
|
135 |
-
name="train.360",
|
136 |
-
gen_kwargs={
|
137 |
-
"local_extracted_archive": local_extracted_archive.get("train.360"),
|
138 |
-
"files": dl_manager.iter_archive(archive_path["train.360"]),
|
139 |
-
},
|
140 |
-
),
|
141 |
-
]
|
142 |
-
dev_splits = [
|
143 |
-
datasets.SplitGenerator(
|
144 |
-
name=datasets.Split.VALIDATION,
|
145 |
-
gen_kwargs={
|
146 |
-
"local_extracted_archive": local_extracted_archive.get("dev"),
|
147 |
-
"files": dl_manager.iter_archive(archive_path["dev"]),
|
148 |
-
},
|
149 |
-
)
|
150 |
-
]
|
151 |
-
"""
|
152 |
test_splits = [
|
153 |
datasets.SplitGenerator(
|
154 |
name=datasets.Split.TEST,
|
@@ -159,26 +119,6 @@ class LibrispeechASR(datasets.GeneratorBasedBuilder):
|
|
159 |
)
|
160 |
]
|
161 |
elif self.config.name == "other":
|
162 |
-
"""
|
163 |
-
train_splits = [
|
164 |
-
datasets.SplitGenerator(
|
165 |
-
name="train.500",
|
166 |
-
gen_kwargs={
|
167 |
-
"local_extracted_archive": local_extracted_archive.get("train.500"),
|
168 |
-
"files": dl_manager.iter_archive(archive_path["train.500"]),
|
169 |
-
},
|
170 |
-
)
|
171 |
-
]
|
172 |
-
dev_splits = [
|
173 |
-
datasets.SplitGenerator(
|
174 |
-
name=datasets.Split.VALIDATION,
|
175 |
-
gen_kwargs={
|
176 |
-
"local_extracted_archive": local_extracted_archive.get("dev"),
|
177 |
-
"files": dl_manager.iter_archive(archive_path["dev"]),
|
178 |
-
},
|
179 |
-
)
|
180 |
-
]
|
181 |
-
"""
|
182 |
test_splits = [
|
183 |
datasets.SplitGenerator(
|
184 |
name=datasets.Split.TEST,
|
@@ -189,47 +129,6 @@ class LibrispeechASR(datasets.GeneratorBasedBuilder):
|
|
189 |
)
|
190 |
]
|
191 |
elif self.config.name == "all":
|
192 |
-
"""
|
193 |
-
train_splits = [
|
194 |
-
datasets.SplitGenerator(
|
195 |
-
name="train.clean.100",
|
196 |
-
gen_kwargs={
|
197 |
-
"local_extracted_archive": local_extracted_archive.get("train.clean.100"),
|
198 |
-
"files": dl_manager.iter_archive(archive_path["train.clean.100"]),
|
199 |
-
},
|
200 |
-
),
|
201 |
-
datasets.SplitGenerator(
|
202 |
-
name="train.clean.360",
|
203 |
-
gen_kwargs={
|
204 |
-
"local_extracted_archive": local_extracted_archive.get("train.clean.360"),
|
205 |
-
"files": dl_manager.iter_archive(archive_path["train.clean.360"]),
|
206 |
-
},
|
207 |
-
),
|
208 |
-
datasets.SplitGenerator(
|
209 |
-
name="train.other.500",
|
210 |
-
gen_kwargs={
|
211 |
-
"local_extracted_archive": local_extracted_archive.get("train.other.500"),
|
212 |
-
"files": dl_manager.iter_archive(archive_path["train.other.500"]),
|
213 |
-
},
|
214 |
-
),
|
215 |
-
]
|
216 |
-
dev_splits = [
|
217 |
-
datasets.SplitGenerator(
|
218 |
-
name="validation.clean",
|
219 |
-
gen_kwargs={
|
220 |
-
"local_extracted_archive": local_extracted_archive.get("validation.clean"),
|
221 |
-
"files": dl_manager.iter_archive(archive_path["dev.clean"]),
|
222 |
-
},
|
223 |
-
),
|
224 |
-
datasets.SplitGenerator(
|
225 |
-
name="validation.other",
|
226 |
-
gen_kwargs={
|
227 |
-
"local_extracted_archive": local_extracted_archive.get("validation.other"),
|
228 |
-
"files": dl_manager.iter_archive(archive_path["dev.other"]),
|
229 |
-
},
|
230 |
-
),
|
231 |
-
]
|
232 |
-
"""
|
233 |
test_splits = [
|
234 |
datasets.SplitGenerator(
|
235 |
name="test.clean",
|
@@ -247,7 +146,7 @@ class LibrispeechASR(datasets.GeneratorBasedBuilder):
|
|
247 |
),
|
248 |
]
|
249 |
|
250 |
-
return
|
251 |
|
252 |
def _generate_examples(self, files, local_extracted_archive):
|
253 |
"""Generate examples from a LibriSpeech archive_path."""
|
|
|
46 |
|
47 |
_DL_URLS = {
|
48 |
"clean": {
|
49 |
+
"test": _DL_URL + "test-clean.tar.gz"
|
|
|
|
|
|
|
50 |
},
|
51 |
"other": {
|
52 |
+
"test": _DL_URL + "test-other.tar.gz"
|
|
|
|
|
53 |
},
|
54 |
"all": {
|
|
|
|
|
55 |
"test.clean": _DL_URL + "test-clean.tar.gz",
|
56 |
+
"test.other": _DL_URL + "test-other.tar.gz"
|
|
|
|
|
|
|
57 |
},
|
58 |
}
|
59 |
|
|
|
107 |
archive_path = dl_manager.download(_DL_URLS[self.config.name])
|
108 |
# (Optional) In non-streaming mode, we can extract the archive locally to have actual local audio files:
|
109 |
local_extracted_archive = dl_manager.extract(archive_path) if not dl_manager.is_streaming else {}
|
|
|
|
|
|
|
110 |
|
111 |
if self.config.name == "clean":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
test_splits = [
|
113 |
datasets.SplitGenerator(
|
114 |
name=datasets.Split.TEST,
|
|
|
119 |
)
|
120 |
]
|
121 |
elif self.config.name == "other":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
test_splits = [
|
123 |
datasets.SplitGenerator(
|
124 |
name=datasets.Split.TEST,
|
|
|
129 |
)
|
130 |
]
|
131 |
elif self.config.name == "all":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
test_splits = [
|
133 |
datasets.SplitGenerator(
|
134 |
name="test.clean",
|
|
|
146 |
),
|
147 |
]
|
148 |
|
149 |
+
return test_splits
|
150 |
|
151 |
def _generate_examples(self, files, local_extracted_archive):
|
152 |
"""Generate examples from a LibriSpeech archive_path."""
|