RodrigoLimaRFL
commited on
Update NURC-SP_ENTOA_TTS.py
Browse files- NURC-SP_ENTOA_TTS.py +50 -44
NURC-SP_ENTOA_TTS.py
CHANGED
@@ -110,67 +110,73 @@ class EntoaDataset(GeneratorBasedBuilder):
|
|
110 |
|
111 |
def _generate_examples(self, prompts_path, path_to_clips, audio_files):
|
112 |
examples = {}
|
113 |
-
|
114 |
-
# Debug print for prompts path
|
115 |
-
print(f"Reading prompts from: {prompts_path}")
|
116 |
with open(prompts_path, "r") as f:
|
117 |
csv_reader = csv.DictReader(f)
|
118 |
for row in csv_reader:
|
119 |
-
# Debug
|
120 |
print(f"Processing row: {row}")
|
121 |
-
|
122 |
if self.config.name == "prosodic":
|
123 |
-
examples[row[
|
124 |
-
"path": row[
|
125 |
-
"name": row[
|
126 |
-
"speaker": row[
|
127 |
-
"start_time": row[
|
128 |
-
"end_time": row[
|
129 |
-
"normalized_text": row[
|
130 |
-
"text": row[
|
131 |
-
"duration": row[
|
132 |
-
"type": row[
|
133 |
-
"year": row[
|
134 |
-
"gender": row[
|
135 |
-
"age_range": row[
|
136 |
-
"total_duration": row[
|
137 |
-
"quality": row[
|
138 |
-
"theme": row[
|
139 |
}
|
140 |
else: # automatic
|
141 |
-
examples[row[
|
142 |
-
"audio_name": row[
|
143 |
-
"file_path": row[
|
144 |
-
"text": row[
|
145 |
-
"start_time": row[
|
146 |
-
"end_time": row[
|
147 |
-
"duration": row[
|
148 |
-
"quality": row[
|
149 |
-
"speech_genre": row[
|
150 |
-
"speech_style": row[
|
151 |
-
"variety": row[
|
152 |
-
"accent": row[
|
153 |
-
"sex": row[
|
154 |
-
"age_range": row[
|
155 |
-
"num_speakers": row[
|
156 |
-
"speaker_id": row[
|
157 |
}
|
158 |
-
|
159 |
id_ = 0
|
160 |
inside_clips_dir = False
|
|
|
|
|
|
|
|
|
161 |
for path, f in audio_files:
|
|
|
|
|
|
|
162 |
if path.startswith(path_to_clips):
|
163 |
inside_clips_dir = True
|
164 |
-
|
165 |
-
# Debug print for matching audio file
|
166 |
-
print(f"Found matching audio file: {path}")
|
167 |
-
|
168 |
if path in examples:
|
|
|
|
|
169 |
audio = {"path": path, "bytes": f.read()}
|
170 |
yield id_, {**examples[path], "audio": audio}
|
171 |
id_ += 1
|
|
|
|
|
|
|
172 |
elif inside_clips_dir:
|
173 |
break
|
174 |
-
|
175 |
-
# Debug
|
176 |
print(f"Completed generating examples. Total examples: {id_}")
|
|
|
|
110 |
|
111 |
def _generate_examples(self, prompts_path, path_to_clips, audio_files):
|
112 |
examples = {}
|
|
|
|
|
|
|
113 |
with open(prompts_path, "r") as f:
|
114 |
csv_reader = csv.DictReader(f)
|
115 |
for row in csv_reader:
|
116 |
+
# Debug: Print each row being processed
|
117 |
print(f"Processing row: {row}")
|
118 |
+
|
119 |
if self.config.name == "prosodic":
|
120 |
+
examples[row["path"]] = {
|
121 |
+
"path": row["path"],
|
122 |
+
"name": row["name"],
|
123 |
+
"speaker": row["speaker"],
|
124 |
+
"start_time": row["start_time"],
|
125 |
+
"end_time": row["end_time"],
|
126 |
+
"normalized_text": row["normalized_text"],
|
127 |
+
"text": row["text"],
|
128 |
+
"duration": row["duration"],
|
129 |
+
"type": row["type"],
|
130 |
+
"year": row["year"],
|
131 |
+
"gender": row["gender"],
|
132 |
+
"age_range": row["age_range"],
|
133 |
+
"total_duration": row["total_duration"],
|
134 |
+
"quality": row["quality"],
|
135 |
+
"theme": row["theme"],
|
136 |
}
|
137 |
else: # automatic
|
138 |
+
examples[row["file_path"]] = {
|
139 |
+
"audio_name": row["audio_name"],
|
140 |
+
"file_path": row["file_path"],
|
141 |
+
"text": row["text"],
|
142 |
+
"start_time": row["start_time"],
|
143 |
+
"end_time": row["end_time"],
|
144 |
+
"duration": row["duration"],
|
145 |
+
"quality": row["quality"],
|
146 |
+
"speech_genre": row["speech_genre"],
|
147 |
+
"speech_style": row["speech_style"],
|
148 |
+
"variety": row["variety"],
|
149 |
+
"accent": row["accent"],
|
150 |
+
"sex": row["sex"],
|
151 |
+
"age_range": row["age_range"],
|
152 |
+
"num_speakers": row["num_speakers"],
|
153 |
+
"speaker_id": row["speaker_id"],
|
154 |
}
|
155 |
+
|
156 |
id_ = 0
|
157 |
inside_clips_dir = False
|
158 |
+
|
159 |
+
# Debug: Print path_to_clips for reference
|
160 |
+
print(f"Expected path_to_clips: {path_to_clips}")
|
161 |
+
|
162 |
for path, f in audio_files:
|
163 |
+
# Debug: Print each file in the archive
|
164 |
+
print(f"Audio file in archive: {path}")
|
165 |
+
|
166 |
if path.startswith(path_to_clips):
|
167 |
inside_clips_dir = True
|
|
|
|
|
|
|
|
|
168 |
if path in examples:
|
169 |
+
# Debug: Match found
|
170 |
+
print(f"Match found for: {path}")
|
171 |
audio = {"path": path, "bytes": f.read()}
|
172 |
yield id_, {**examples[path], "audio": audio}
|
173 |
id_ += 1
|
174 |
+
else:
|
175 |
+
# Debug: No match for this file
|
176 |
+
print(f"No match for: {path}")
|
177 |
elif inside_clips_dir:
|
178 |
break
|
179 |
+
|
180 |
+
# Debug: Print total examples generated
|
181 |
print(f"Completed generating examples. Total examples: {id_}")
|
182 |
+
|