diff options
| author | historia <historiavg@proton.me> | 2026-09-02 19:13:24 -0400 |
|---|---|---|
| committer | historia <historiavg@proton.me> | 2026-09-02 19:13:24 -0400 |
| commit | 6804c785c6b506c47b45264398728d0a609310be (patch) | |
| tree | 0b95361d84a32d5b26e94f54530437a48f34d1c8 /app/backends/sglomni/catalog.py | |
| parent | 268b6734b22cc251bf340882ea9debbd079b9a48 (diff) | |
| download | tts-audiobook-generator-6804c785c6b506c47b45264398728d0a609310be.tar.gz | |
feat: sglang-omni model picker on manual server launch
Diffstat (limited to 'app/backends/sglomni/catalog.py')
| -rw-r--r-- | app/backends/sglomni/catalog.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/app/backends/sglomni/catalog.py b/app/backends/sglomni/catalog.py index 5ff0c81..61cb11c 100644 --- a/app/backends/sglomni/catalog.py +++ b/app/backends/sglomni/catalog.py @@ -96,6 +96,26 @@ _DAC_EXTRAS: Tuple[Extra, ...] = ( ("descript-audiotools==0.7.2", False), ("descript-audio-codec==1.0.0", False)) +# Companion distributions whose top-level import name differs from the pip +# name's plain dash-to-underscore normalization (verified against their +# top_level.txt). Anything absent here normalizes: qwen-tts -> qwen_tts. +_EXTRA_IMPORT_OVERRIDES = { + "descript-audiotools": "audiotools", + "descript-audio-codec": "dac", +} + + +def extra_import_name(spec: str) -> str: + """The Python module an extras requirement SPEC provides. + + Takes the distribution name portion of the pip requirement (so + ``qwen-tts==0.1.1`` -> ``qwen_tts``) — the name a venv probe must + import to prove the companion is installed.""" + base = spec.split("=")[0].split("<")[0].split(">")[0].strip() + if base in _EXTRA_IMPORT_OVERRIDES: + return _EXTRA_IMPORT_OVERRIDES[base] + return base.replace("-", "_") + ENTRIES: Tuple[ModelEntry, ...] = ( ModelEntry( key="qwen3_tts_0_6b_customvoice", |
