diff options
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", |
