PerSets commited on
Commit
9a10e37
·
1 Parent(s): 265066d

fix: trying to pair metadata and tarfile audios

Browse files
__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
- for path, f in audio_files:
116
- if path.startswith(path_to_clips):
117
- audio_path2 = "/".join([path_to_clips, path])
118
- inside_clips_dir = True
119
- if audio_path2 in examples:
120
- audio = {"path": audio_path2, "bytes": f.read()}
121
- yield id_, {**examples[audio_path2], "audio": audio}
122
- id_ += 1
123
- elif inside_clips_dir:
124
- break
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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}