Spaces:
Runtime error
Runtime error
Update finetune_xtts_hf.py
Browse files- finetune_xtts_hf.py +8 -10
finetune_xtts_hf.py
CHANGED
|
@@ -111,9 +111,13 @@ if os.path.exists(json_path):
|
|
| 111 |
print("🔄 Convirtiendo metadata.json → metadata.csv...")
|
| 112 |
with open(json_path, "r", encoding="utf-8") as f:
|
| 113 |
data = json.load(f)
|
| 114 |
-
|
| 115 |
-
with open(csv_path, "w", encoding="utf-8") as f:
|
| 116 |
-
writer = csv.writer(f, delimiter="
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
for entry in data:
|
| 118 |
path = entry["audio_filepath"]
|
| 119 |
# Quitar prefijo "voxpopuli_es_500/" si existe
|
|
@@ -122,13 +126,7 @@ if os.path.exists(json_path):
|
|
| 122 |
text = entry["text"].replace("\n", " ").strip()
|
| 123 |
speaker = entry.get("speaker", "spk1")
|
| 124 |
writer.writerow([path, text, speaker])
|
| 125 |
-
|
| 126 |
-
print(f"path: {path}")
|
| 127 |
-
es_primera_vuelta = False # Cambia la bandera
|
| 128 |
-
path_muestra = os.path.join(VOXPOPULI_PATH, path)
|
| 129 |
-
existe = os.path.exists(path_muestra)
|
| 130 |
-
print(f"existe: {existe}")
|
| 131 |
-
|
| 132 |
print(f"✅ metadata.csv generado en {csv_path}")
|
| 133 |
else:
|
| 134 |
raise FileNotFoundError(f"❌ No se encontró {json_path}. Verifica el zip.")
|
|
|
|
| 111 |
print("🔄 Convirtiendo metadata.json → metadata.csv...")
|
| 112 |
with open(json_path, "r", encoding="utf-8") as f:
|
| 113 |
data = json.load(f)
|
| 114 |
+
|
| 115 |
+
with open(csv_path, "w", encoding="utf-8", newline="") as f:
|
| 116 |
+
writer = csv.writer(f, delimiter=",", quoting=csv.QUOTE_MINIMAL)
|
| 117 |
+
|
| 118 |
+
# Escribir cabecera
|
| 119 |
+
writer.writerow(["wav_filename", "transcript", "speaker_id"])
|
| 120 |
+
|
| 121 |
for entry in data:
|
| 122 |
path = entry["audio_filepath"]
|
| 123 |
# Quitar prefijo "voxpopuli_es_500/" si existe
|
|
|
|
| 126 |
text = entry["text"].replace("\n", " ").strip()
|
| 127 |
speaker = entry.get("speaker", "spk1")
|
| 128 |
writer.writerow([path, text, speaker])
|
| 129 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
print(f"✅ metadata.csv generado en {csv_path}")
|
| 131 |
else:
|
| 132 |
raise FileNotFoundError(f"❌ No se encontró {json_path}. Verifica el zip.")
|