openspeechapi 0.2.24__tar.gz → 0.2.26__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/PKG-INFO +2 -2
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/core/models.py +4 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/dispatcher.py +11 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/engine_catalog.py +2 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/engine_registry.yaml +7 -4
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/isolated_venv.py +29 -2
- openspeechapi-0.2.26/openspeechapi/local_engines/vllm_gb10_patch.py +100 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/vllm_venv.py +44 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/qwen3_omni_stt.py +167 -25
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/alibaba.py +1 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/baidu.py +1 -0
- openspeechapi-0.2.26/openspeechapi/providers/tts/coqui.py +412 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/cosyvoice.py +1 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/deepgram.py +1 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/iflytek.py +1 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/macos_say.py +1 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/openai.py +1 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/piper.py +6 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/tencent.py +1 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/volcengine.py +1 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/windows_sapi.py +1 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/extras_installer.py +2 -1
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/routes/management.py +77 -17
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/routes/tts.py +15 -8
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/webui/app.js +93 -4
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/webui/index.html +4 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/webui/styles.css +10 -1
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/ws/tts_stream.py +28 -24
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/pyproject.toml +2 -2
- openspeechapi-0.2.24/openspeechapi/providers/tts/coqui.py +0 -63
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/.gitignore +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/README.md +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/__main__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/cli.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/client/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/client/client.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/config.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/core/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/core/base.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/core/enums.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/core/model_hub.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/core/registry.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/core/settings.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/demo.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/aim_provision.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/context.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/executors/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/executors/base.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/executors/in_process.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/executors/remote.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/executors/subprocess_exec.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/fanout.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/filters.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/lifecycle.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/dispatch/watcher.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/exceptions.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/factory.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/aim_resolver.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/backends/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/backends/docker_backend.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/backends/native_backend.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/base.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/engines/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/engines/faster_whisper.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/engines/fish_speech.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/engines/sherpa_onnx.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/engines/whisper.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/engines/whisperlivekit.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/manager.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/models.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/progress.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/registry.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/task_store.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/local_engines/tasks.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/logging_config.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/observe/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/observe/base.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/observe/debug.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/observe/latency.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/observe/metrics.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/observe/tracing.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/observe/usage.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/_template.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/_local_audio.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/alibaba.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/assemblyai.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/azure_speech.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/baidu.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/canary_qwen_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/deepgram.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/dolphin_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/elevenlabs.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/faster_whisper.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/fireredasr_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/funasr_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/gemma4.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/google_cloud.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/iflytek.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/kimi_audio_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/macos_speech.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/mlx_whisper_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/mms_languages.json +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/mms_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/moonshine_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/openai.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/paraformer.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/parakeet_mlx_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/phi4_multimodal_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/qwen3_asr.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/sensevoice.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/sherpa_onnx.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/tencent.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/volcengine.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/vosk_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/voxtral_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/wenet_stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/whisper.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/whisperlivekit.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/stt/windows_speech.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/azure_speech.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/elevenlabs.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/fish_speech.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/google_cloud.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/providers/tts/minimax.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/app.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/auth.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/middleware.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/model_downloads.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/native_installer.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/routes/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/routes/stt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/routes/webui.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/system_metrics.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/ws/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/server/ws/stt_stream.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/telemetry/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/telemetry/perf.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/utils/__init__.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/utils/audio_converter.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/utils/audio_playback.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/openspeechapi/vendor_registry.yaml +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/providers.example.yaml +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/aim_adopt.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/aim_consumers.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/engines/cloud/install.sh +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/engines/faster-whisper/native/install.sh +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/engines/fish-speech/native/install.sh +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/engines/macos-stt/_bundle.sh +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/engines/macos-stt/install.sh +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/engines/macos-stt/macos_stt.swift +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/engines/macos-stt/request_auth.swift +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/engines/sherpa-onnx/native/install.sh +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/engines/sherpa-onnx/native/run_streaming_server.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/engines/whisper/native/install.sh +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/engines/whisperlivekit/native/install.sh +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/gen_mms_languages.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/preload_stt_model.py +0 -0
- {openspeechapi-0.2.24 → openspeechapi-0.2.26}/scripts/release.sh +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: openspeechapi
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.26
|
|
4
4
|
Summary: Unified speech interface for STT/TTS providers
|
|
5
5
|
Requires-Python: >=3.11
|
|
6
6
|
Requires-Dist: httpx>=0.27
|
|
@@ -35,7 +35,7 @@ Provides-Extra: canary-qwen-stt
|
|
|
35
35
|
Provides-Extra: cloud
|
|
36
36
|
Requires-Dist: websockets; extra == 'cloud'
|
|
37
37
|
Provides-Extra: coqui-tts
|
|
38
|
-
Requires-Dist: tts; extra == 'coqui-tts'
|
|
38
|
+
Requires-Dist: coqui-tts[codec,cpu]; extra == 'coqui-tts'
|
|
39
39
|
Provides-Extra: cosyvoice-tts
|
|
40
40
|
Requires-Dist: torchaudio; extra == 'cosyvoice-tts'
|
|
41
41
|
Provides-Extra: deepgram
|
|
@@ -96,3 +96,7 @@ class TTSOptions:
|
|
|
96
96
|
output_format: AudioFormat = AudioFormat.PCM_16K
|
|
97
97
|
model: str | None = None
|
|
98
98
|
stream_transport: str | None = None
|
|
99
|
+
# voice cloning (XTTS / F5 / GPT-SoVITS / CosyVoice2 …): the speaker to clone — raw audio
|
|
100
|
+
# bytes, base64, OR a local path/URL. Ignored by preset-voice engines.
|
|
101
|
+
reference_audio: bytes | str | None = None
|
|
102
|
+
language: str | None = None # cloning engines need an explicit lang code (e.g. "zh", "en")
|
|
@@ -619,6 +619,17 @@ class ServiceDispatcher:
|
|
|
619
619
|
# TTS
|
|
620
620
|
# ------------------------------------------------------------------
|
|
621
621
|
|
|
622
|
+
async def list_voices(self, provider: str, model: str | None = None) -> list[dict]:
|
|
623
|
+
"""Built-in voices of a provider's loaded model, fetched via the executor's invoke path so
|
|
624
|
+
it works for ALL exec modes — SUBPROCESS included (lifecycle.get_instance() returns None
|
|
625
|
+
there, so a direct instance.list_voices() always yielded [] for e.g. coqui). The model is
|
|
626
|
+
lazily loaded first (its speakers can only be enumerated once the model is loaded)."""
|
|
627
|
+
handle = self._get_handle(provider)
|
|
628
|
+
await self._lifecycle.ensure_ready(provider)
|
|
629
|
+
result = await handle.executor.invoke("list_voices", **({"model": model} if model else {}))
|
|
630
|
+
self._lifecycle.touch(provider)
|
|
631
|
+
return list(result or [])
|
|
632
|
+
|
|
622
633
|
async def _synthesize(
|
|
623
634
|
self,
|
|
624
635
|
provider: str,
|
|
@@ -40,6 +40,7 @@ class CatalogEntry:
|
|
|
40
40
|
isolated_venv: bool = False # run this engine's worker from a dedicated per-engine venv
|
|
41
41
|
pip_constraints: list[str] = field(default_factory=list) # version pins applied when building the isolated venv
|
|
42
42
|
vllm_venv: bool = False # build a clean vLLM-Omni serving venv (no openspeechapi) for a service-client engine
|
|
43
|
+
cuda_torch: bool = False # isolated_venv: on a CUDA host, pre-install torch+torchaudio from the CUDA wheel index (default PyPI ships CPU torch on aarch64)
|
|
43
44
|
|
|
44
45
|
@property
|
|
45
46
|
def compatible(self) -> bool:
|
|
@@ -198,6 +199,7 @@ def build_catalog(registry_path: Path | None = None) -> list[CatalogEntry]:
|
|
|
198
199
|
isolated_venv=bool(raw.get("isolated_venv", False)),
|
|
199
200
|
pip_constraints=list(raw.get("pip_constraints", []) or []),
|
|
200
201
|
vllm_venv=bool(raw.get("vllm_venv", False)),
|
|
202
|
+
cuda_torch=bool(raw.get("cuda_torch", False)),
|
|
201
203
|
)
|
|
202
204
|
# Try to enrich with provider code metadata
|
|
203
205
|
entry = _enrich_from_provider(entry)
|
|
@@ -497,7 +497,7 @@ engines:
|
|
|
497
497
|
type: tts
|
|
498
498
|
category: local
|
|
499
499
|
display_name: "CosyVoice"
|
|
500
|
-
description: "CosyVoice — local Chinese TTS (GPU)"
|
|
500
|
+
description: "CosyVoice — local Chinese TTS (GPU)。⚠️ 权重商用条款有争议(上游 issue 未决),研究/内部使用 OK"
|
|
501
501
|
default_alias: cosyvoice_tts
|
|
502
502
|
default_exec_mode: subprocess
|
|
503
503
|
pip_extras: [cosyvoice-tts]
|
|
@@ -506,11 +506,14 @@ engines:
|
|
|
506
506
|
provider: coqui
|
|
507
507
|
type: tts
|
|
508
508
|
category: local
|
|
509
|
-
display_name: "Coqui
|
|
510
|
-
description: "Coqui TTS —
|
|
509
|
+
display_name: "Coqui XTTS-v2"
|
|
510
|
+
description: "Coqui TTS 工具箱 — 71 模型:零样本克隆(XTTS-v2/your_tts,需 reference_audio)+ 多说话人音库(VCTK ~109,选 speaker)+ 单说话人。⚠️ XTTS 权重 CPML 非商用(研究/内部);经典模型(VCTK/LJSpeech 用 espeak phonemizer)需系统装 espeak-ng(brew/apt)并在服务 PATH 上"
|
|
511
511
|
default_alias: coqui_tts
|
|
512
|
-
default_exec_mode:
|
|
512
|
+
default_exec_mode: subprocess # 重 + isolated venv(coqui-tts 钉 torch)
|
|
513
|
+
isolated_venv: true
|
|
514
|
+
cuda_torch: true # CUDA 主机(有 nvidia-smi)装 extras 前先从 cu130 index 预装 torch+torchaudio(aarch64 默认 PyPI 是 CPU 版)
|
|
513
515
|
pip_extras: [coqui-tts]
|
|
516
|
+
pip_constraints: ["transformers>=4.57,<5"] # coqui-tts 0.27.5 声明 >=4.57 但其 tortoise 代码用 isin_mps_friendly(transformers 5.x 已删)→ 封顶 <5 取 4.57.x
|
|
514
517
|
|
|
515
518
|
# ---- macOS Native ----
|
|
516
519
|
- name: macos-stt
|
|
@@ -133,16 +133,43 @@ def create_isolated_venv(repo_root: Path | str, entry, *, timeout: int = 1800) -
|
|
|
133
133
|
else:
|
|
134
134
|
method = "exists"
|
|
135
135
|
|
|
136
|
-
# 2.
|
|
136
|
+
# 2. Install openspeechapi into the venv (base deps incl. msgpack) → IPC compat. From a
|
|
137
|
+
# source/editable checkout (repo_root has pyproject.toml) use ``-e <repo_root>``; from a
|
|
138
|
+
# PyPI/wheel install (no source — repo_root resolves to site-packages) install the SAME
|
|
139
|
+
# version from the index instead, so pickled providers + msgpack dataclass/enum
|
|
140
|
+
# reconstruction resolve to identical classes. This lets a pip-installed OSA build
|
|
141
|
+
# isolated engine venvs too (no source checkout required).
|
|
137
142
|
argv, _ = _installer_argv(str(vpy))
|
|
138
143
|
if argv is None:
|
|
139
144
|
return IsolatedVenvResult(ok=False, method=method,
|
|
140
145
|
log="no pip/uv available to install into the venv")
|
|
141
|
-
|
|
146
|
+
if (Path(repo_root) / "pyproject.toml").exists():
|
|
147
|
+
osa_target = ["-e", str(repo_root)]
|
|
148
|
+
else:
|
|
149
|
+
from importlib.metadata import PackageNotFoundError
|
|
150
|
+
from importlib.metadata import version as _pkg_version
|
|
151
|
+
try:
|
|
152
|
+
osa_target = [f"openspeechapi=={_pkg_version('openspeechapi')}"]
|
|
153
|
+
except PackageNotFoundError: # pragma: no cover - openspeechapi is always importable at runtime
|
|
154
|
+
osa_target = ["openspeechapi"]
|
|
155
|
+
r = _run(argv + osa_target, timeout=timeout)
|
|
142
156
|
logs.append((r.stdout or "") + (r.stderr or ""))
|
|
143
157
|
if r.returncode != 0:
|
|
144
158
|
return IsolatedVenvResult(ok=False, method=method, log="\n".join(logs)[-4000:])
|
|
145
159
|
|
|
160
|
+
# 2.5 CUDA torch pre-install: engines flagged ``cuda_torch`` on a CUDA host get torch+
|
|
161
|
+
# torchaudio from the CUDA wheel index FIRST, so the extras' ``torch>=X`` is satisfied by
|
|
162
|
+
# the GPU build (default PyPI ships CPU-only torch on aarch64 — e.g. the GB10/DGX). Off
|
|
163
|
+
# CUDA hosts (no nvidia-smi, e.g. macOS) this is skipped → extras pull the normal wheel.
|
|
164
|
+
if getattr(entry, "cuda_torch", False) and shutil.which("nvidia-smi"):
|
|
165
|
+
index = os.environ.get(
|
|
166
|
+
"OSA_TORCH_CUDA_INDEX", "https://download.pytorch.org/whl/cu130").strip()
|
|
167
|
+
logs.append(f"[cuda_torch] pre-installing torch+torchaudio+torchcodec from {index}")
|
|
168
|
+
r = _run(argv + ["torch", "torchaudio", "torchcodec", "--index-url", index], timeout=timeout)
|
|
169
|
+
logs.append((r.stdout or "") + (r.stderr or ""))
|
|
170
|
+
if r.returncode != 0:
|
|
171
|
+
return IsolatedVenvResult(ok=False, method=method, log="\n".join(logs)[-4000:])
|
|
172
|
+
|
|
146
173
|
# 3. Engine extras + version pins, installed into the venv.
|
|
147
174
|
res = install_extras(
|
|
148
175
|
repo_root, list(entry.pip_extras or []),
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Canonical GB10/Blackwell vLLM source patches — shared by the venv + docker serving paths.
|
|
2
|
+
|
|
3
|
+
Two idempotent source edits vLLM 0.22 needs on the GB10 (sm_120) for qwen3-omni:
|
|
4
|
+
#1 NVML `get_device_capability` raises NVMLError_InvalidArgument on the unified-memory iGPU
|
|
5
|
+
→ broaden the catch + fall back to `torch.cuda.get_device_capability`.
|
|
6
|
+
#6 qwen3-omni's ViT passes `cu_seqlens` on CPU; flash_attn_varlen_func needs it on CUDA
|
|
7
|
+
→ `cu_seqlens = cu_seqlens.to(q.device)` before the call.
|
|
8
|
+
|
|
9
|
+
Both are **safe no-ops off the GB10**: on a normal CUDA host NVML works (the fallback never runs)
|
|
10
|
+
and cu_seqlens is already on CUDA (`.to` is a no-op); on a vLLM version whose source differs the
|
|
11
|
+
target string isn't found and the file is left untouched. So this can be applied unconditionally —
|
|
12
|
+
including inside a freshly-pulled official `vllm/vllm-omni` container (x86 or arm64).
|
|
13
|
+
|
|
14
|
+
Used by:
|
|
15
|
+
- `vllm_venv.py` (venv install) — patches the venv's site-packages after `uv pip install`.
|
|
16
|
+
- the qwen3-omni docker provider — this file is mounted into the container and run with the
|
|
17
|
+
container's python before `vllm-omni serve` (`python3 <mounted> ` patches /usr/.../vllm).
|
|
18
|
+
|
|
19
|
+
Run standalone (e.g. inside a container): ``python3 vllm_gb10_patch.py`` → patches the running
|
|
20
|
+
interpreter's vllm and prints one status line per file.
|
|
21
|
+
"""
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
import subprocess
|
|
25
|
+
import sys
|
|
26
|
+
from pathlib import Path
|
|
27
|
+
|
|
28
|
+
NVML_OLD = """ major, minor = pynvml.nvmlDeviceGetCudaComputeCapability(handle)
|
|
29
|
+
return DeviceCapability(major=major, minor=minor)
|
|
30
|
+
except RuntimeError:
|
|
31
|
+
return None"""
|
|
32
|
+
NVML_NEW = """ major, minor = pynvml.nvmlDeviceGetCudaComputeCapability(handle)
|
|
33
|
+
return DeviceCapability(major=major, minor=minor)
|
|
34
|
+
except Exception:
|
|
35
|
+
# GB10/DGX Spark: NVML capability query raises NVMLError_InvalidArgument on the
|
|
36
|
+
# unified-memory iGPU. torch reports the capability fine -> fall back to it.
|
|
37
|
+
try:
|
|
38
|
+
import torch
|
|
39
|
+
major, minor = torch.cuda.get_device_capability(device_id)
|
|
40
|
+
return DeviceCapability(major=major, minor=minor)
|
|
41
|
+
except Exception:
|
|
42
|
+
return None"""
|
|
43
|
+
NVML_MARK = "GB10/DGX Spark: NVML capability query"
|
|
44
|
+
|
|
45
|
+
VIT_OLD = """ 0, (batch_size + 1) * q_len, step=q_len, dtype=torch.int32, device=q.device
|
|
46
|
+
)
|
|
47
|
+
max_seqlen = q_len if max_seqlen is None else max_seqlen.item()"""
|
|
48
|
+
VIT_NEW = """ 0, (batch_size + 1) * q_len, step=q_len, dtype=torch.int32, device=q.device
|
|
49
|
+
)
|
|
50
|
+
cu_seqlens = cu_seqlens.to(q.device) # GB10 fix: cu_seqlens may be on CPU; flash-attn needs CUDA
|
|
51
|
+
max_seqlen = q_len if max_seqlen is None else max_seqlen.item()"""
|
|
52
|
+
VIT_MARK = "GB10 fix: cu_seqlens may be on CPU"
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def patch_file(path: Path, old: str, new: str, mark: str) -> str:
|
|
56
|
+
if not path.exists():
|
|
57
|
+
return f"{path.name}: missing(skip)"
|
|
58
|
+
s = path.read_text(encoding="utf-8")
|
|
59
|
+
if mark in s:
|
|
60
|
+
return f"{path.name}: already"
|
|
61
|
+
if old not in s:
|
|
62
|
+
return f"{path.name}: target-not-found(skip)"
|
|
63
|
+
path.write_text(s.replace(old, new, 1), encoding="utf-8")
|
|
64
|
+
return f"{path.name}: patched"
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def apply_to_site_packages(site_packages: Path) -> list[str]:
|
|
68
|
+
"""Apply both patches to a vllm install under ``site_packages``. Idempotent."""
|
|
69
|
+
return [
|
|
70
|
+
patch_file(site_packages / "vllm/platforms/cuda.py", NVML_OLD, NVML_NEW, NVML_MARK),
|
|
71
|
+
patch_file(
|
|
72
|
+
site_packages / "vllm/v1/attention/ops/vit_attn_wrappers.py",
|
|
73
|
+
VIT_OLD, VIT_NEW, VIT_MARK),
|
|
74
|
+
]
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def site_packages_of(python_exe: str) -> Path | None:
|
|
78
|
+
"""site-packages dir of an arbitrary python interpreter (venv / container)."""
|
|
79
|
+
try:
|
|
80
|
+
r = subprocess.run(
|
|
81
|
+
[python_exe, "-c", "import sysconfig;print(sysconfig.get_path('purelib'))"],
|
|
82
|
+
capture_output=True, text=True, timeout=30)
|
|
83
|
+
sp = (r.stdout or "").strip()
|
|
84
|
+
return Path(sp) if sp else None
|
|
85
|
+
except Exception: # noqa: BLE001
|
|
86
|
+
return None
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def main() -> None:
|
|
90
|
+
sp = site_packages_of(sys.executable)
|
|
91
|
+
if sp is None:
|
|
92
|
+
print("site-packages not found")
|
|
93
|
+
return
|
|
94
|
+
print("site-packages:", sp)
|
|
95
|
+
for line in apply_to_site_packages(sp):
|
|
96
|
+
print(line)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
if __name__ == "__main__":
|
|
100
|
+
main()
|
|
@@ -175,3 +175,47 @@ def create_vllm_venv(
|
|
|
175
175
|
emit(f"GB10 patches: {apply_gb10_patches(vpy)}")
|
|
176
176
|
|
|
177
177
|
return VllmVenvResult(ok=True, venv_python=str(vpy), method="uv", log="\n".join(logs)[-4000:])
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
# ── docker serving path (preferred; cross-arch official image) ─────────────────────────────
|
|
181
|
+
def resolve_serve_mode(configured: str) -> str:
|
|
182
|
+
"""``auto`` → 'docker' if docker is on PATH, else 'venv'. Concrete values pass through.
|
|
183
|
+
(At install we then verify the docker image is actually obtainable, else fall back to venv.)"""
|
|
184
|
+
m = (configured or "auto").strip().lower()
|
|
185
|
+
if m in ("docker", "venv"):
|
|
186
|
+
return m
|
|
187
|
+
return "docker" if shutil.which("docker") else "venv"
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def ensure_docker_image(
|
|
191
|
+
image: str, *, timeout: int = 3600, progress: Callable[[str], None] | None = None,
|
|
192
|
+
) -> tuple[bool, str]:
|
|
193
|
+
"""Ensure the vllm-omni docker image is available: present locally → ok; else ``docker pull``.
|
|
194
|
+
|
|
195
|
+
The GB10 source patches are applied at container RUN (entrypoint wrapper, see the provider),
|
|
196
|
+
NOT baked here — so a freshly-pulled official ``vllm/vllm-omni`` image works on the GB10 too,
|
|
197
|
+
and the multi-arch tag pulls the host's arch (amd64 or arm64). Returns (ok, log)."""
|
|
198
|
+
logs: list[str] = []
|
|
199
|
+
|
|
200
|
+
def emit(line: str) -> None:
|
|
201
|
+
line = (line or "").rstrip()
|
|
202
|
+
if not line:
|
|
203
|
+
return
|
|
204
|
+
logs.append(line)
|
|
205
|
+
if progress:
|
|
206
|
+
progress(line)
|
|
207
|
+
|
|
208
|
+
docker = shutil.which("docker")
|
|
209
|
+
if not docker:
|
|
210
|
+
return False, "docker not found on PATH"
|
|
211
|
+
r = _run([docker, "images", "-q", image], timeout=120)
|
|
212
|
+
if (r.stdout or "").strip():
|
|
213
|
+
emit(f"image present locally: {image}")
|
|
214
|
+
return True, "\n".join(logs)
|
|
215
|
+
emit(f"docker pull {image} … (国内需配 docker 镜像加速,否则 DockerHub 超时)")
|
|
216
|
+
r = _run([docker, "pull", image], timeout=timeout)
|
|
217
|
+
emit((r.stdout or "") + (r.stderr or ""))
|
|
218
|
+
if r.returncode != 0:
|
|
219
|
+
emit(f"pull failed — image neither local nor pullable here: {image}")
|
|
220
|
+
return False, "\n".join(logs)[-4000:]
|
|
221
|
+
return True, "\n".join(logs)[-4000:]
|
|
@@ -22,8 +22,10 @@ from __future__ import annotations
|
|
|
22
22
|
import asyncio
|
|
23
23
|
import base64
|
|
24
24
|
import json
|
|
25
|
+
import os
|
|
25
26
|
import shlex
|
|
26
27
|
import shutil
|
|
28
|
+
import signal
|
|
27
29
|
import subprocess
|
|
28
30
|
import time
|
|
29
31
|
from collections.abc import AsyncIterator
|
|
@@ -99,6 +101,17 @@ class Qwen3OmniSTTSettings(BaseSettings):
|
|
|
99
101
|
timeout_s: float = 30.0 # httpx client connect/pool timeout
|
|
100
102
|
request_timeout_s: float = 300.0 # per-request read timeout (heavy model)
|
|
101
103
|
|
|
104
|
+
# ── serve mode: docker (default) or venv (fallback) ────────────────────────
|
|
105
|
+
# "auto" resolves at install to docker if usable, else venv; install persists the concrete
|
|
106
|
+
# value here. docker mode runs the official cross-arch vllm-omni image; venv mode runs the
|
|
107
|
+
# per-engine uv venv (vllm_venv.py). Both speak the same :8901 OpenAI API + use the aim model.
|
|
108
|
+
serve_mode: str = "auto"
|
|
109
|
+
docker_image: str = "vllm/vllm-omni:v0.22.0" # multi-arch (amd64+arm64): docker pulls the host's arch
|
|
110
|
+
docker_container_name: str = "osa-qwen3-omni"
|
|
111
|
+
# host flashinfer cache mounted into the container → reuse compiled MoE kernels (no recompile)
|
|
112
|
+
docker_flashinfer_cache: str = "~/.cache/flashinfer"
|
|
113
|
+
docker_extra_run_args: str = "" # extra `docker run` args, e.g. "--shm-size 16g"
|
|
114
|
+
|
|
102
115
|
|
|
103
116
|
class Qwen3OmniSTT(STTProvider):
|
|
104
117
|
name = "qwen3-omni"
|
|
@@ -116,6 +129,7 @@ class Qwen3OmniSTT(STTProvider):
|
|
|
116
129
|
"hub": ["auto", "hf", "ms"],
|
|
117
130
|
"language": ["auto", "en", "zh", "yue", "ja", "ko", "de", "fr", "es"],
|
|
118
131
|
"moe_backend": ["flashinfer_cutlass", "triton"],
|
|
132
|
+
"serve_mode": ["auto", "docker", "venv"],
|
|
119
133
|
}
|
|
120
134
|
|
|
121
135
|
# Declared at class level too, so an instance reconstructed WITHOUT __init__ — e.g. a
|
|
@@ -127,14 +141,18 @@ class Qwen3OmniSTT(STTProvider):
|
|
|
127
141
|
_service_proc = None
|
|
128
142
|
_owns_service = False
|
|
129
143
|
_service_log_fh = None
|
|
144
|
+
_docker_container = None # name of the container WE started (docker mode), else None
|
|
145
|
+
_served_model_id = None # cached id from GET /v1/models (the request `model` param)
|
|
130
146
|
|
|
131
147
|
def __init__(self, settings: Qwen3OmniSTTSettings | None = None) -> None:
|
|
132
148
|
self.settings = settings or Qwen3OmniSTTSettings()
|
|
133
149
|
self._client: Any = None
|
|
134
150
|
self._owns_client: bool = True
|
|
135
|
-
self._service_proc: subprocess.Popen | None = None # OSA-managed vllm-omni serve
|
|
151
|
+
self._service_proc: subprocess.Popen | None = None # OSA-managed vllm-omni serve (venv mode)
|
|
136
152
|
self._owns_service: bool = False # True only if WE spawned it
|
|
137
153
|
self._service_log_fh: Any = None
|
|
154
|
+
self._docker_container: str | None = None # container WE started (docker mode)
|
|
155
|
+
self._served_model_id: str | None = None # cached /v1/models id
|
|
138
156
|
|
|
139
157
|
def set_http_client(self, client) -> None:
|
|
140
158
|
self._client = client
|
|
@@ -296,19 +314,50 @@ class Qwen3OmniSTT(STTProvider):
|
|
|
296
314
|
return ""
|
|
297
315
|
return f"{cap}a" if major >= 12 else ""
|
|
298
316
|
|
|
317
|
+
def _resolve_serve_mode(self) -> str:
|
|
318
|
+
"""Concrete serve mode. 'auto' → docker if docker is on PATH, else venv. Install normally
|
|
319
|
+
pins a concrete value in config; this is the runtime safety net."""
|
|
320
|
+
m = (self.settings.serve_mode or "auto").strip().lower()
|
|
321
|
+
if m in ("docker", "venv"):
|
|
322
|
+
return m
|
|
323
|
+
return "docker" if shutil.which("docker") else "venv"
|
|
324
|
+
|
|
299
325
|
async def _ensure_service(self) -> None:
|
|
300
|
-
"""Launch
|
|
301
|
-
ready.
|
|
326
|
+
"""Launch the vllm-omni server on api_url if nothing healthy is there, then poll until
|
|
327
|
+
ready. An already-healthy server is reused (never duplicated). docker mode runs the official
|
|
328
|
+
cross-arch image; venv mode runs the per-engine venv binary."""
|
|
302
329
|
if not self.settings.manage_service:
|
|
303
330
|
return
|
|
304
331
|
if await self.health_check():
|
|
305
332
|
logger.info("{}: reusing existing service at {}", self.name, self.settings.api_url)
|
|
306
333
|
return
|
|
334
|
+
if self._resolve_serve_mode() == "docker":
|
|
335
|
+
await self._start_docker()
|
|
336
|
+
else:
|
|
337
|
+
await self._start_venv()
|
|
338
|
+
|
|
339
|
+
async def _poll_until_healthy(self, alive, on_dead: str) -> None:
|
|
340
|
+
"""Shared readiness poll: wait for /v1/models healthy, or fail fast if ``alive()`` is False."""
|
|
341
|
+
timeout = float(self.settings.service_startup_timeout_s)
|
|
342
|
+
deadline = time.monotonic() + timeout
|
|
343
|
+
while time.monotonic() < deadline:
|
|
344
|
+
if not alive():
|
|
345
|
+
self._stop_service()
|
|
346
|
+
raise RuntimeError(on_dead)
|
|
347
|
+
if await self.health_check():
|
|
348
|
+
logger.info("{}: vllm-omni server ready at {}", self.name, self.settings.api_url)
|
|
349
|
+
return
|
|
350
|
+
await asyncio.sleep(2.0)
|
|
351
|
+
self._stop_service()
|
|
352
|
+
raise RuntimeError(
|
|
353
|
+
f"vllm-omni server did not become healthy within {timeout:.0f}s")
|
|
354
|
+
|
|
355
|
+
async def _start_venv(self) -> None:
|
|
307
356
|
try:
|
|
308
357
|
cmd = self._build_service_command()
|
|
309
358
|
except RuntimeError as exc:
|
|
310
359
|
logger.warning(
|
|
311
|
-
"{}: cannot auto-start the service ({}).
|
|
360
|
+
"{}: cannot auto-start the venv service ({}). Engine started, but transcription "
|
|
312
361
|
"will fail until a vllm-omni server is reachable at {}.",
|
|
313
362
|
self.name, exc, self.settings.api_url)
|
|
314
363
|
return
|
|
@@ -316,36 +365,129 @@ class Qwen3OmniSTT(STTProvider):
|
|
|
316
365
|
log_path = Path(self.settings.service_log_path).expanduser()
|
|
317
366
|
log_path.parent.mkdir(parents=True, exist_ok=True)
|
|
318
367
|
self._service_log_fh = log_path.open("ab")
|
|
319
|
-
logger.info("{}: launching vllm-omni
|
|
368
|
+
logger.info("{}: launching vllm-omni (venv) → {}", self.name, " ".join(cmd))
|
|
320
369
|
self._service_proc = subprocess.Popen(
|
|
321
|
-
cmd, stdout=self._service_log_fh, stderr=subprocess.STDOUT, env=env
|
|
370
|
+
cmd, stdout=self._service_log_fh, stderr=subprocess.STDOUT, env=env,
|
|
371
|
+
start_new_session=True) # own process group → _stop_service reaps vLLM's EngineCore children
|
|
322
372
|
self._owns_service = True
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
373
|
+
await self._poll_until_healthy(
|
|
374
|
+
alive=lambda: self._service_proc.poll() is None,
|
|
375
|
+
on_dead=f"vllm-omni (venv) exited early; see {log_path}")
|
|
376
|
+
|
|
377
|
+
async def _start_docker(self) -> None:
|
|
378
|
+
if not shutil.which("docker"):
|
|
379
|
+
logger.warning("{}: docker not found; cannot start docker-mode service.", self.name)
|
|
380
|
+
return
|
|
381
|
+
cmd = self._build_docker_command()
|
|
382
|
+
logger.info("{}: launching vllm-omni (docker) → {}", self.name, " ".join(cmd))
|
|
383
|
+
r = await asyncio.to_thread(subprocess.run, cmd, capture_output=True, text=True)
|
|
384
|
+
if r.returncode != 0:
|
|
385
|
+
raise RuntimeError(f"docker run failed: {(r.stderr or r.stdout or '').strip()[-400:]}")
|
|
386
|
+
self._docker_container = self.settings.docker_container_name
|
|
387
|
+
self._owns_service = True
|
|
388
|
+
await self._poll_until_healthy(
|
|
389
|
+
alive=self._docker_alive,
|
|
390
|
+
on_dead=f"vllm-omni container died on startup; see `docker logs {self._docker_container}`")
|
|
391
|
+
|
|
392
|
+
def _docker_alive(self) -> bool:
|
|
393
|
+
name = self._docker_container
|
|
394
|
+
if not name:
|
|
395
|
+
return False
|
|
396
|
+
try:
|
|
397
|
+
r = subprocess.run(["docker", "ps", "-q", "-f", f"name=^{name}$"],
|
|
398
|
+
capture_output=True, text=True, timeout=10)
|
|
399
|
+
return bool((r.stdout or "").strip())
|
|
400
|
+
except Exception: # noqa: BLE001
|
|
401
|
+
return True # don't false-kill on a transient docker hiccup
|
|
402
|
+
|
|
403
|
+
def _build_docker_command(self) -> list[str]:
|
|
404
|
+
"""`docker run -d` for the official cross-arch vllm-omni image: mount the aim model +
|
|
405
|
+
flashinfer cache + the GB10 patch script, then (patch → serve) via a bash entrypoint."""
|
|
406
|
+
s = self.settings
|
|
407
|
+
host, port = self._service_host_port()
|
|
408
|
+
model_dir = aim_local_path_or(s.model_path, s.model)
|
|
409
|
+
if not Path(model_dir).is_dir():
|
|
410
|
+
raise RuntimeError(
|
|
411
|
+
f"docker mode needs the model on the host first (got '{model_dir}'); "
|
|
412
|
+
"download it (Engine Catalog「下载模型」or aim) then retry.")
|
|
413
|
+
from openspeechapi.local_engines import vllm_gb10_patch
|
|
414
|
+
patch_host = str(Path(vllm_gb10_patch.__file__).resolve())
|
|
415
|
+
cache = str(Path(s.docker_flashinfer_cache).expanduser())
|
|
416
|
+
Path(cache).mkdir(parents=True, exist_ok=True)
|
|
417
|
+
run = ["docker", "run", "-d", "--rm", "--name", s.docker_container_name, "--gpus", "all",
|
|
418
|
+
"-v", f"{model_dir}:/model:ro",
|
|
419
|
+
"-v", f"{cache}:/root/.cache/flashinfer",
|
|
420
|
+
"-v", f"{patch_host}:/tmp/vllm_gb10_patch.py:ro",
|
|
421
|
+
"-e", f"MAX_JOBS={int(s.max_jobs)}"]
|
|
422
|
+
if s.torch_cuda_arch_list.strip():
|
|
423
|
+
run += ["-e", f"TORCH_CUDA_ARCH_LIST={s.torch_cuda_arch_list.strip()}"]
|
|
424
|
+
run += ["-p", f"{port}:{port}"]
|
|
425
|
+
if s.docker_extra_run_args.strip():
|
|
426
|
+
run += shlex.split(s.docker_extra_run_args)
|
|
427
|
+
serve = [f"vllm-omni serve /model --host 0.0.0.0 --port {port}",
|
|
428
|
+
f"--gpu-memory-utilization {s.gpu_memory_utilization}",
|
|
429
|
+
f"--max-num-seqs {int(s.max_num_seqs)} --max-model-len {int(s.max_model_len)}"]
|
|
430
|
+
if s.moe_backend.strip():
|
|
431
|
+
serve.append(f"--moe-backend {s.moe_backend.strip()}")
|
|
432
|
+
if s.extra_serve_args.strip():
|
|
433
|
+
serve.append(s.extra_serve_args.strip())
|
|
434
|
+
# patch is idempotent + a safe no-op off-GB10; `|| true` so a patch hiccup never blocks serve
|
|
435
|
+
entry = f"python3 /tmp/vllm_gb10_patch.py || true; exec {' '.join(serve)}"
|
|
436
|
+
run += ["--entrypoint", "bash", s.docker_image, "-c", entry]
|
|
437
|
+
return run
|
|
438
|
+
|
|
439
|
+
async def _served_model(self, fallback: str) -> str:
|
|
440
|
+
"""The model id the running server actually serves (GET /v1/models; cached). docker mode →
|
|
441
|
+
'/model' (the mount); venv mode → the host path. Always use this as the request `model`."""
|
|
442
|
+
if self._served_model_id:
|
|
443
|
+
return self._served_model_id
|
|
444
|
+
try:
|
|
445
|
+
url = urljoin(self.settings.api_url.rstrip("/") + "/", "v1/models")
|
|
446
|
+
data = (await self._client.get(url)).json().get("data") or []
|
|
447
|
+
if data:
|
|
448
|
+
self._served_model_id = str(data[0].get("id") or fallback)
|
|
449
|
+
return self._served_model_id
|
|
450
|
+
except Exception: # noqa: BLE001
|
|
451
|
+
pass
|
|
452
|
+
return fallback
|
|
338
453
|
|
|
339
454
|
def _stop_service(self) -> None:
|
|
455
|
+
# venv-spawned process
|
|
340
456
|
proc, self._service_proc = self._service_proc, None
|
|
341
457
|
if proc is not None and self._owns_service and proc.poll() is None:
|
|
342
|
-
|
|
458
|
+
# vLLM forks an EngineCore (+ workers) child that holds the GPU; killing only the
|
|
459
|
+
# parent orphans it (VRAM leak — the classic "Stop didn't free memory"). Started with
|
|
460
|
+
# start_new_session → signal the whole process GROUP so children are reaped too.
|
|
461
|
+
try:
|
|
462
|
+
pgid = os.getpgid(proc.pid)
|
|
463
|
+
except Exception: # noqa: BLE001 - no pgid (already gone / not a real proc) → single-proc fallback
|
|
464
|
+
pgid = None
|
|
465
|
+
|
|
466
|
+
def _sig(s):
|
|
467
|
+
try:
|
|
468
|
+
if pgid is not None:
|
|
469
|
+
os.killpg(pgid, s)
|
|
470
|
+
else:
|
|
471
|
+
proc.send_signal(s)
|
|
472
|
+
except Exception: # noqa: BLE001
|
|
473
|
+
pass
|
|
474
|
+
|
|
475
|
+
_sig(signal.SIGTERM)
|
|
343
476
|
try:
|
|
344
477
|
proc.wait(timeout=15)
|
|
345
478
|
except subprocess.TimeoutExpired:
|
|
346
|
-
|
|
347
|
-
logger.info("{}: stopped managed vllm-omni
|
|
479
|
+
_sig(signal.SIGKILL)
|
|
480
|
+
logger.info("{}: stopped managed vllm-omni (venv) + worker group", self.name)
|
|
481
|
+
# docker container WE started (--rm → removed on stop)
|
|
482
|
+
name, self._docker_container = self._docker_container, None
|
|
483
|
+
if name and self._owns_service:
|
|
484
|
+
try:
|
|
485
|
+
subprocess.run(["docker", "stop", name], capture_output=True, timeout=30)
|
|
486
|
+
logger.info("{}: stopped managed vllm-omni container '{}'", self.name, name)
|
|
487
|
+
except Exception: # noqa: BLE001
|
|
488
|
+
pass
|
|
348
489
|
self._owns_service = False
|
|
490
|
+
self._served_model_id = None
|
|
349
491
|
if self._service_log_fh is not None:
|
|
350
492
|
try:
|
|
351
493
|
self._service_log_fh.close()
|
|
@@ -365,7 +507,7 @@ class Qwen3OmniSTT(STTProvider):
|
|
|
365
507
|
s = self._effective_settings(
|
|
366
508
|
opts, typed_map={"model": "model", "prompt": "prompt", "language": "language"}
|
|
367
509
|
)
|
|
368
|
-
model = aim_local_path_or(s.model_path, s.model)
|
|
510
|
+
model = await self._served_model(aim_local_path_or(s.model_path, s.model))
|
|
369
511
|
language = (s.language or "").strip()
|
|
370
512
|
prompt = (s.prompt or "").strip()
|
|
371
513
|
|
|
@@ -24,6 +24,7 @@ class AlibabaTTSSettings(BaseSettings):
|
|
|
24
24
|
class AlibabaTTS(TTSProvider):
|
|
25
25
|
name = "alibaba-tts"
|
|
26
26
|
provider_type = ProviderType.TTS
|
|
27
|
+
supported_languages = ['zh', 'en', 'yue', 'ja', 'ko', 'de', 'fr', 'es', 'ru', 'pt', 'it', 'ar', 'th', 'id'] # tags/filter only (researched)
|
|
27
28
|
execution_mode = ExecMode.IN_PROCESS
|
|
28
29
|
settings_cls = AlibabaTTSSettings
|
|
29
30
|
capabilities = {Capability.BATCH, Capability.MULTILINGUAL}
|
|
@@ -26,6 +26,7 @@ class BaiduTTSSettings(BaseSettings):
|
|
|
26
26
|
class BaiduTTS(TTSProvider):
|
|
27
27
|
name = "baidu-tts"
|
|
28
28
|
provider_type = ProviderType.TTS
|
|
29
|
+
supported_languages = ['zh', 'en', 'yue'] # tags/filter only (researched)
|
|
29
30
|
execution_mode = ExecMode.IN_PROCESS
|
|
30
31
|
settings_cls = BaiduTTSSettings
|
|
31
32
|
capabilities = {Capability.BATCH, Capability.MULTILINGUAL}
|