Explorar el Código

Fix | in text for vits format

Lengyue hace 2 años
padre
commit
938787726c
Se han modificado 1 ficheros con 6 adiciones y 1 borrados
  1. 6 1
      fish_speech/utils/file.py

+ 6 - 1
fish_speech/utils/file.py

@@ -85,7 +85,12 @@ def load_filelist(path: Path | str) -> list[tuple[Path, str, str, str]]:
 
     with open(path, "r", encoding="utf-8") as f:
         for line in f.readlines():
-            filename, speaker, language, text = line.strip().split("|")
+            splits = line.strip().split("|", maxsplit=3)
+            if len(splits) != 4:
+                logger.warning(f"Invalid line: {line}")
+                continue
+
+            filename, speaker, language, text = splits
             file = Path(filename)
             language = language.strip().lower()