feat: Integrate IndexTTS2 model and update related schemas and frontend components

This commit is contained in:
2026-03-12 13:30:53 +08:00
parent e5b5a16364
commit 8aec4f6f44
151 changed files with 40077 additions and 85 deletions

View File

@@ -121,3 +121,40 @@ class ModelManager:
}
for name, path in self.MODEL_PATHS.items()
}
class IndexTTS2ModelManager:
_instance = None
_lock = asyncio.Lock()
def __init__(self):
self.tts = None
@classmethod
async def get_instance(cls):
if cls._instance is None:
async with cls._lock:
if cls._instance is None:
cls._instance = cls()
return cls._instance
async def get_model(self):
if self.tts is None:
await self._load()
return self.tts
async def _load(self):
from indextts.infer_indextts2 import IndexTTS2
from pathlib import Path
model_dir = Path(settings.MODEL_BASE_PATH) / "IndexTTS2"
loop = asyncio.get_event_loop()
self.tts = await loop.run_in_executor(
None,
lambda: IndexTTS2(
cfg_path=str(model_dir / "config.yaml"),
model_dir=str(model_dir),
is_fp16=False,
use_cuda_kernel=False,
use_deepspeed=False,
)
)