diff options
| author | historia <historiavg@proton.me> | 2026-09-02 01:26:09 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-09-02 01:26:09 -0400 |
| commit | 8579517a35ef1865fc9b428899d73d52dcb27a14 (patch) | |
| tree | dba52f8d99cfe4014e0b787367de99f238e5a0db /app/backends/__init__.py | |
| parent | 391f50da7a085bec75155c0eb9b47910266058cc (diff) | |
| download | tts-audiobook-generator-8579517a35ef1865fc9b428899d73d52dcb27a14.tar.gz | |
feat: sglang backend support
Diffstat (limited to 'app/backends/__init__.py')
| -rw-r--r-- | app/backends/__init__.py | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/app/backends/__init__.py b/app/backends/__init__.py index 89d95e2..5a1a602 100644 --- a/app/backends/__init__.py +++ b/app/backends/__init__.py @@ -1,12 +1,12 @@ """Registry of the TTS backends the audiobook generator can talk to. -Each backend (audio.cpp, qwen, faster) lives in its own module and owns -its setup wizard, its status detection, its uninstaller, and the launch -command it prints once configured. This package aggregates them into a single -registry so ``audiobook.py``'s TUI hub and future tools can iterate backends -without hardcoding their names: ``backends.detect_all()`` reports which are set -up (and whether their server is currently running), and the registry -drives the hub's "Configure Backends" menu. +Each backend (audio.cpp, qwen, faster, SGLang-Omni) lives in its own module +and owns its setup wizard, its status detection, its uninstaller, and the +launch command it prints once configured. This package aggregates them into +a single registry so ``audiobook.py``'s TUI hub and future tools can iterate +backends without hardcoding their names: ``backends.detect_all()`` reports +which are set up (and whether their server is currently running), and the +registry drives the hub's "Configure Backends" menu. The registry is built lazily on the first call to ``get``/``detect_all``/ ``detect`` (not at package import time), because the backend modules pull @@ -59,12 +59,19 @@ class ServerSpec: waits for the server to answer HTTP with that identity — not merely to accept TCP connections — so "listening but still starting" servers are caught. None keeps the plain TCP-connect readiness check. + + START_TIMEOUT overrides the shared ``servers.SERVER_START_TIMEOUT`` for + this spec (seconds): the sglang-omni pipeline (preprocessing, TTS + generation, vocoder stages) boots far slower than the single-process + servers, and its first start may also pull companion weights from the + HuggingFace cache. None uses the shared default. """ name: str url: str argv: List[str] cwd: Optional[Path] = None identity: Optional[str] = None + start_timeout: Optional[int] = None @dataclass @@ -189,7 +196,7 @@ def _build_registry() -> None: """Import the backend modules and wire up REGISTRY (once).""" if REGISTRY: return - from . import audiocpp, faster, qwen + from . import audiocpp, faster, qwen, sglomni REGISTRY.append(BackendInfo( key="audiocpp", @@ -216,6 +223,15 @@ def _build_registry() -> None: uninstall=faster.uninstall, update=faster.update, )) + REGISTRY.append(BackendInfo( + key="sglomni", + label="SGLang-Omni", + detect=sglomni.detect, + setup_screen=sglomni.setup_screen, + uninstall=sglomni.uninstall, + update=sglomni.update, + configure_screen=sglomni.models_screen, + )) for info in REGISTRY: _BY_KEY[info.key] = info |
