KELONMYOSA
commited on
Commit
•
918abe7
1
Parent(s):
6d3f4f4
fixed examples generation
Browse files
dusha.py
CHANGED
@@ -44,7 +44,7 @@ class Dusha(datasets.GeneratorBasedBuilder):
|
|
44 |
)]
|
45 |
|
46 |
def _generate_examples(self, audio_files: Union[str, os.PathLike], metadata: str):
|
47 |
-
examples =
|
48 |
|
49 |
with open(metadata) as f:
|
50 |
for row in f:
|
@@ -54,11 +54,11 @@ class Dusha(datasets.GeneratorBasedBuilder):
|
|
54 |
res = dict()
|
55 |
res["path"] = os.path.join(audio_files, audio_path)
|
56 |
res["label"] = label
|
57 |
-
examples
|
58 |
|
59 |
key = 0
|
60 |
-
for
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
|
|
44 |
)]
|
45 |
|
46 |
def _generate_examples(self, audio_files: Union[str, os.PathLike], metadata: str):
|
47 |
+
examples = dict()
|
48 |
|
49 |
with open(metadata) as f:
|
50 |
for row in f:
|
|
|
54 |
res = dict()
|
55 |
res["path"] = os.path.join(audio_files, audio_path)
|
56 |
res["label"] = label
|
57 |
+
examples[audio_path] = res
|
58 |
|
59 |
key = 0
|
60 |
+
for path, f in audio_files:
|
61 |
+
if path in examples:
|
62 |
+
audio = {"path": path, "bytes": f.read()}
|
63 |
+
yield key, {**examples[path], "audio": audio}
|
64 |
+
key += 1
|