Skip to content

SOTA Open Source TTS

Use natsort for better data packing

Lengyue74ec1db16685
diff --git a/fish_speech/utils/file.py b/fish_speech/utils/file.py
index ad45e32..f5e7d1c 100644
--- a/fish_speech/utils/file.py
+++ b/fish_speech/utils/file.py
@@ -4,6 +4,7 @@ from pathlib import Path
from typing import Union
from loguru import logger
+from natsort import natsorted
AUDIO_EXTENSIONS = {
".mp3",
@@ -49,7 +50,7 @@ def list_files(
files = [f for f in files if f.suffix in extensions]
if sort:
- files = sorted(files)
+ files = natsorted(files)
return files
diff --git a/pyproject.toml b/pyproject.toml
index a688ae9..87ca201 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -34,7 +34,8 @@ dependencies = [
"zibai-server>=0.9.0",
"loguru>=0.6.0",
"WeTextProcessing>=0.1.10",
- "loralib>=0.1.2"
+ "loralib>=0.1.2",
+ "natsort>=8.4.0"
]
[project.optional-dependencies]