fix: trying to pair metadata and tarfile audios
Browse files- __pycache__/asr_dataset.cpython-312.pyc +0 -0
- asr_dataset.py +31 -10
__pycache__/asr_dataset.cpython-312.pyc
CHANGED
Binary files a/__pycache__/asr_dataset.cpython-312.pyc and b/__pycache__/asr_dataset.cpython-312.pyc differ
|
|
asr_dataset.py
CHANGED
@@ -112,13 +112,34 @@ class ASRDataset(datasets.GeneratorBasedBuilder):
|
|
112 |
}
|
113 |
inside_clips_dir = False
|
114 |
id_ = 0
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
}
|
113 |
inside_clips_dir = False
|
114 |
id_ = 0
|
115 |
+
|
116 |
+
tar_files = [
|
117 |
+
"clips/clips_001.tar",
|
118 |
+
"clips/clips_002.tar",
|
119 |
+
"clips/clips_003.tar",
|
120 |
+
"clips/clips_004.tar",
|
121 |
+
"clips/clips_005.tar",
|
122 |
+
"clips/clips_006.tar",
|
123 |
+
"clips/clips_007.tar",
|
124 |
+
"clips/clips_008.tar",
|
125 |
+
"clips/clips_009.tar",
|
126 |
+
"clips/clips_010.tar",
|
127 |
+
"clips/clips_011.tar",
|
128 |
+
"clips/clips_012.tar",
|
129 |
+
"clips/clips_013.tar",
|
130 |
+
"clips/clips_014.tar",
|
131 |
+
"clips/clips_015.tar",
|
132 |
+
"clips/clips_016.tar",
|
133 |
+
"clips/clips_017.tar",
|
134 |
+
"clips/clips_018.tar",
|
135 |
+
"clips/clips_019.tar",
|
136 |
+
"clips/clips_020.tar",
|
137 |
+
"clips/clips_021.tar",
|
138 |
+
]
|
139 |
+
for tar_file in tar_files:
|
140 |
+
with tarfile.open(tar_file, 'r') as tar:
|
141 |
+
for member in tar.getmembers():
|
142 |
+
path = "/".join([path_to_clips, member.name])
|
143 |
+
audio_file =tar.extractfile(member)
|
144 |
+
audio = {"path": path, "bytes": audio_file.read()}
|
145 |
+
yield id_, {**examples[path], "audio": audio}
|