openspeechapi 0.2.22__tar.gz → 0.2.24__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.22 → openspeechapi-0.2.24}/PKG-INFO +1 -1
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/config.py +25 -3
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/core/model_hub.py +50 -12
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/engine_catalog.py +2 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/engine_registry.yaml +8 -7
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/aim_resolver.py +9 -0
- openspeechapi-0.2.24/openspeechapi/local_engines/vllm_venv.py +177 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/canary_qwen_stt.py +21 -3
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/faster_whisper.py +40 -2
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/fireredasr_stt.py +32 -3
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/mms_stt.py +22 -4
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/moonshine_stt.py +27 -8
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/phi4_multimodal_stt.py +22 -4
- openspeechapi-0.2.24/openspeechapi/providers/stt/qwen3_omni_stt.py +435 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/vosk_stt.py +80 -5
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/whisper.py +84 -2
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/whisperlivekit.py +186 -2
- openspeechapi-0.2.24/openspeechapi/server/model_downloads.py +396 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/routes/management.py +123 -7
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/routes/stt.py +10 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/webui/app.js +185 -22
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/webui/styles.css +13 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/ws/stt_stream.py +25 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/pyproject.toml +1 -1
- openspeechapi-0.2.22/openspeechapi/providers/stt/qwen3_omni_stt.py +0 -169
- openspeechapi-0.2.22/openspeechapi/server/model_downloads.py +0 -191
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/.gitignore +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/README.md +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/__main__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/cli.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/client/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/client/client.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/core/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/core/base.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/core/enums.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/core/models.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/core/registry.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/core/settings.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/demo.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/aim_provision.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/context.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/dispatcher.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/executors/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/executors/base.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/executors/in_process.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/executors/remote.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/executors/subprocess_exec.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/fanout.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/filters.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/lifecycle.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/dispatch/watcher.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/exceptions.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/factory.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/backends/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/backends/docker_backend.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/backends/native_backend.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/base.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/faster_whisper.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/fish_speech.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/sherpa_onnx.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/whisper.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/whisperlivekit.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/isolated_venv.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/manager.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/models.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/progress.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/registry.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/task_store.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/local_engines/tasks.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/logging_config.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/observe/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/observe/base.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/observe/debug.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/observe/latency.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/observe/metrics.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/observe/tracing.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/observe/usage.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/_template.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/_local_audio.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/alibaba.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/assemblyai.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/azure_speech.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/baidu.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/deepgram.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/dolphin_stt.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/elevenlabs.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/funasr_stt.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/gemma4.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/google_cloud.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/iflytek.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/kimi_audio_stt.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/macos_speech.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/mlx_whisper_stt.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/mms_languages.json +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/openai.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/paraformer.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/parakeet_mlx_stt.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/qwen3_asr.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/sensevoice.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/sherpa_onnx.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/tencent.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/volcengine.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/voxtral_stt.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/wenet_stt.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/windows_speech.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/alibaba.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/azure_speech.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/baidu.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/coqui.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/cosyvoice.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/deepgram.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/elevenlabs.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/fish_speech.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/google_cloud.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/iflytek.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/macos_say.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/minimax.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/openai.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/piper.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/tencent.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/volcengine.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/tts/windows_sapi.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/app.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/auth.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/extras_installer.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/middleware.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/native_installer.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/routes/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/routes/tts.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/routes/webui.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/system_metrics.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/webui/index.html +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/ws/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/server/ws/tts_stream.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/telemetry/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/telemetry/perf.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/utils/__init__.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/utils/audio_converter.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/utils/audio_playback.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/vendor_registry.yaml +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/providers.example.yaml +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/aim_adopt.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/aim_consumers.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/engines/cloud/install.sh +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/engines/faster-whisper/native/install.sh +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/engines/fish-speech/native/install.sh +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/engines/macos-stt/_bundle.sh +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/engines/macos-stt/install.sh +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/engines/macos-stt/macos_stt.swift +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/engines/macos-stt/request_auth.swift +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/engines/sherpa-onnx/native/install.sh +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/engines/sherpa-onnx/native/run_streaming_server.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/engines/whisper/native/install.sh +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/engines/whisperlivekit/native/install.sh +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/gen_mms_languages.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/preload_stt_model.py +0 -0
- {openspeechapi-0.2.22 → openspeechapi-0.2.24}/scripts/release.sh +0 -0
|
@@ -120,6 +120,14 @@ class ServerConfig:
|
|
|
120
120
|
# multi-engine / memory-constrained boxes so idle engines free their GPU/RAM after N seconds
|
|
121
121
|
# of inactivity (auto-reloaded on next request). A per-engine ``keepalive > 0`` overrides this.
|
|
122
122
|
default_keepalive: int = 0
|
|
123
|
+
# Keepalive FLOOR (seconds) for reload-expensive LOCAL engines (subprocess/local model
|
|
124
|
+
# loaders, e.g. gemma4 / qwen3-omni). A short ``default_keepalive`` (e.g. 600) idle-unloads a
|
|
125
|
+
# multi-GB model between interactive requests; the cold reload (tens of seconds to minutes,
|
|
126
|
+
# worse under concurrent disk I/O) then reads as "no result" in live mic. This floors the
|
|
127
|
+
# INHERITED keepalive for such engines so interactive use stays warm, while cloud/native
|
|
128
|
+
# engines (cheap to reconnect) keep the shorter default. Only raises an inherited value — an
|
|
129
|
+
# explicit per-engine ``keepalive`` (incl. 0 = never unload) is respected. 0 disables.
|
|
130
|
+
keepalive_floor_local: int = 1800
|
|
123
131
|
|
|
124
132
|
|
|
125
133
|
@dataclass
|
|
@@ -272,17 +280,31 @@ def load_config(path: Path) -> OpenSpeechConfig:
|
|
|
272
280
|
0, int(srv.get("default_keepalive", server_cfg.default_keepalive)))
|
|
273
281
|
except (TypeError, ValueError):
|
|
274
282
|
pass
|
|
283
|
+
try:
|
|
284
|
+
server_cfg.keepalive_floor_local = max(
|
|
285
|
+
0, int(srv.get("keepalive_floor_local", server_cfg.keepalive_floor_local)))
|
|
286
|
+
except (TypeError, ValueError):
|
|
287
|
+
pass
|
|
275
288
|
auth = srv.get("auth", {})
|
|
276
289
|
if auth:
|
|
277
290
|
server_cfg.auth_enabled = bool(auth.get("enabled", False))
|
|
278
291
|
server_cfg.api_keys = list(auth.get("api_keys", []))
|
|
279
292
|
|
|
280
293
|
# Engines that didn't set their own keepalive inherit the global default (so operators can
|
|
281
|
-
# set one idle-unload policy via server.default_keepalive instead of per-engine).
|
|
294
|
+
# set one idle-unload policy via server.default_keepalive instead of per-engine). Reload-
|
|
295
|
+
# expensive LOCAL loaders (subprocess/local) additionally get a keepalive FLOOR so a short
|
|
296
|
+
# global default doesn't idle-unload a multi-GB model between interactive requests (the cold
|
|
297
|
+
# reload reads as "no result" in live mic). Only an INHERITED value (keepalive == 0) is
|
|
298
|
+
# adjusted — an explicit per-engine keepalive is respected as-is.
|
|
299
|
+
_LOCAL_LOADERS = {"subprocess", "local"}
|
|
282
300
|
if server_cfg.default_keepalive > 0:
|
|
283
301
|
for eng in engines.values():
|
|
284
|
-
if eng.keepalive
|
|
285
|
-
|
|
302
|
+
if eng.keepalive != 0:
|
|
303
|
+
continue
|
|
304
|
+
eng.keepalive = server_cfg.default_keepalive
|
|
305
|
+
if (server_cfg.keepalive_floor_local > 0
|
|
306
|
+
and str(eng.exec_mode).strip().lower() in _LOCAL_LOADERS):
|
|
307
|
+
eng.keepalive = max(eng.keepalive, server_cfg.keepalive_floor_local)
|
|
286
308
|
|
|
287
309
|
return OpenSpeechConfig(
|
|
288
310
|
engines=engines,
|
|
@@ -112,10 +112,12 @@ def effective_source(hub: str) -> str:
|
|
|
112
112
|
"""Effective download source for a model: 'hf' or 'ms'.
|
|
113
113
|
|
|
114
114
|
- explicit engine hub 'ms'/'hf' wins
|
|
115
|
-
- ``'auto'`` →
|
|
116
|
-
|
|
117
|
-
HF
|
|
118
|
-
|
|
115
|
+
- ``'auto'`` → explicit ms default is TRUSTED unconditionally (a transient probe must not flip
|
|
116
|
+
an ms-preferred, usually HF-blocked box to HF — that caused FunASR engines to re-fetch from
|
|
117
|
+
HF and stall); explicit hf default uses hf when reachable, else falls back to ms (HF-block-
|
|
118
|
+
proofing); with NO explicit default: ModelScope if reachable (funasr-native) else HuggingFace
|
|
119
|
+
(direct or via auto-mirror). Only decides a *fresh* download's source — _materialise reuses
|
|
120
|
+
any already-downloaded copy first.
|
|
119
121
|
- hub '' → global OSA_DEFAULT_MODEL_SOURCE (default 'hf')
|
|
120
122
|
- back-compat: OSA_PREFER_MODELSCOPE=1 with no explicit default → 'ms'
|
|
121
123
|
"""
|
|
@@ -124,11 +126,16 @@ def effective_source(hub: str) -> str:
|
|
|
124
126
|
return h
|
|
125
127
|
glob = os.environ.get("OSA_DEFAULT_MODEL_SOURCE", "").strip().lower()
|
|
126
128
|
if h == "auto":
|
|
129
|
+
# Explicit ms default → TRUST it, no reachability gate. ms-preferred boxes are typically
|
|
130
|
+
# HF-blocked, so a transient ms probe failure must NOT flip them to HF — that made
|
|
131
|
+
# FunASR-style engines re-fetch the model/VAD from HF, causing duplicate downloads +
|
|
132
|
+
# stalls. (hf default keeps its probe + ms fallback below, which is the HF-block-proofing
|
|
133
|
+
# for hf-preferred boxes; only ms-trust is unconditional.)
|
|
134
|
+
if glob == "ms":
|
|
135
|
+
return "ms"
|
|
127
136
|
reach = reachable_sources()
|
|
128
137
|
if glob == "hf" and (reach["hf"] or reach["hf_mirror"]):
|
|
129
138
|
return "hf"
|
|
130
|
-
if glob == "ms" and reach["ms"]:
|
|
131
|
-
return "ms"
|
|
132
139
|
if reach["ms"]:
|
|
133
140
|
return "ms" # ModelScope reachable → prefer it (HF-block-proof)
|
|
134
141
|
return "hf" # HF direct, or auto-mirror via ensure_reachable_download_env
|
|
@@ -310,19 +317,49 @@ def _download_candidates(
|
|
|
310
317
|
return [c for c in ordered if c is not None]
|
|
311
318
|
|
|
312
319
|
|
|
320
|
+
def _hf_snapshot_complete(snapshot_path: str) -> bool:
|
|
321
|
+
"""False if the snapshot's repo still has an in-progress download — a
|
|
322
|
+
``blobs/<etag>.incomplete`` block.
|
|
323
|
+
|
|
324
|
+
``snapshot_download(..., local_files_only=True)`` returns the snapshot folder as soon as
|
|
325
|
+
it exists, *without* checking the files are all there (its own source says "we can't
|
|
326
|
+
check if all the files are actually there"). huggingface_hub streams a weight into
|
|
327
|
+
``blobs/<etag>.incomplete``, and only after the bytes finish renames it to
|
|
328
|
+
``blobs/<etag>`` and links it into the snapshot (file_download.py) — so a half-downloaded
|
|
329
|
+
repo has its small configs symlinked but *no* weight symlink, and the snapshot folder
|
|
330
|
+
looks populated. We therefore inspect the sibling ``blobs/`` ourselves. Format-agnostic:
|
|
331
|
+
catches a truncated ct2 ``model.bin`` / NeMo ``.nemo`` / MLX ``.npz`` / sharded
|
|
332
|
+
``.safetensors`` alike, with no per-engine weight-name list to keep in sync."""
|
|
333
|
+
blobs = os.path.join(os.path.dirname(os.path.dirname(snapshot_path)), "blobs")
|
|
334
|
+
try:
|
|
335
|
+
return not any(name.endswith(".incomplete") for name in os.listdir(blobs))
|
|
336
|
+
except OSError:
|
|
337
|
+
# No blobs/ dir (non-standard layout, e.g. a local_dir copy) → can't prove it's
|
|
338
|
+
# incomplete; trust the snapshot rather than spuriously re-downloading.
|
|
339
|
+
return True
|
|
340
|
+
|
|
341
|
+
|
|
313
342
|
def _hf_local(repo: str) -> str | None:
|
|
314
|
-
"""Path to an already-downloaded HF snapshot of ``repo`` (no network), or
|
|
315
|
-
Checks both the default HF cache (where funasr/transformers download) and our
|
|
316
|
-
root, so an existing copy is reused no matter which path originally fetched it.
|
|
343
|
+
"""Path to an already-downloaded **complete** HF snapshot of ``repo`` (no network), or
|
|
344
|
+
None. Checks both the default HF cache (where funasr/transformers download) and our
|
|
345
|
+
storage root, so an existing copy is reused no matter which path originally fetched it.
|
|
346
|
+
|
|
347
|
+
A snapshot still mid-download is skipped (``_hf_snapshot_complete``): without this an
|
|
348
|
+
interrupted fetch masquerades as cached — ``model_is_cached`` would lie and
|
|
349
|
+
``build_aim_spec`` would skip aim pre-provisioning, leaving the engine to load a broken
|
|
350
|
+
model (the DGX faster-whisper-large-v3-turbo case: snapshot had only the small jsons,
|
|
351
|
+
``model.bin`` was still a ``blobs/*.incomplete``)."""
|
|
317
352
|
try:
|
|
318
353
|
from huggingface_hub import snapshot_download
|
|
319
354
|
except ImportError:
|
|
320
355
|
return None
|
|
321
356
|
for cache_dir in (None, os.path.join(default_storage_root(), "huggingface")):
|
|
322
357
|
try:
|
|
323
|
-
|
|
358
|
+
path = snapshot_download(repo, cache_dir=cache_dir, local_files_only=True)
|
|
324
359
|
except Exception: # noqa: BLE001 - not in this cache → try the next / give up
|
|
325
360
|
continue
|
|
361
|
+
if _hf_snapshot_complete(path):
|
|
362
|
+
return path # else: in-progress download in this cache → try the next / give up
|
|
326
363
|
return None
|
|
327
364
|
|
|
328
365
|
|
|
@@ -347,8 +384,9 @@ _WEIGHT_SUFFIXES = (".pt", ".pth", ".bin", ".safetensors", ".onnx", ".gguf", ".c
|
|
|
347
384
|
|
|
348
385
|
def _dir_has_model_weights(d: str) -> bool:
|
|
349
386
|
"""True if ``d`` holds a substantial (>1MB) model-weights file at its top level.
|
|
350
|
-
(Catches missing/stub weights; it can't detect a large-but-truncated file — for HF
|
|
351
|
-
|
|
387
|
+
(Catches missing/stub weights; it can't detect a large-but-truncated file — for HF a
|
|
388
|
+
truncated/in-progress download is caught upstream by ``_hf_snapshot_complete``'s
|
|
389
|
+
``*.incomplete`` blob check in ``_hf_local``.)"""
|
|
352
390
|
try:
|
|
353
391
|
names = os.listdir(d)
|
|
354
392
|
except OSError:
|
|
@@ -39,6 +39,7 @@ class CatalogEntry:
|
|
|
39
39
|
incompat_reason: str = "" # why incompatible (shown in UI when compatible is False)
|
|
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
|
+
vllm_venv: bool = False # build a clean vLLM-Omni serving venv (no openspeechapi) for a service-client engine
|
|
42
43
|
|
|
43
44
|
@property
|
|
44
45
|
def compatible(self) -> bool:
|
|
@@ -196,6 +197,7 @@ def build_catalog(registry_path: Path | None = None) -> list[CatalogEntry]:
|
|
|
196
197
|
incompat_reason=raw.get("incompat_reason", ""),
|
|
197
198
|
isolated_venv=bool(raw.get("isolated_venv", False)),
|
|
198
199
|
pip_constraints=list(raw.get("pip_constraints", []) or []),
|
|
200
|
+
vllm_venv=bool(raw.get("vllm_venv", False)),
|
|
199
201
|
)
|
|
200
202
|
# Try to enrich with provider code metadata
|
|
201
203
|
entry = _enrich_from_provider(entry)
|
|
@@ -259,10 +259,11 @@ engines:
|
|
|
259
259
|
type: stt
|
|
260
260
|
category: local
|
|
261
261
|
display_name: "WhisperLiveKit"
|
|
262
|
-
description: "WhisperLiveKit — streaming STT
|
|
262
|
+
description: "WhisperLiveKit — streaming STT server (OSA-managed; faster-whisper/MLX backend)"
|
|
263
263
|
default_alias: stt_wlk
|
|
264
264
|
default_exec_mode: local
|
|
265
265
|
pip_extras: [whisperlivekit]
|
|
266
|
+
isolated_venv: true # whisperlivekit-server runs from ~/AI/venvs/whisperlivekit-stt/ (heavy deps)
|
|
266
267
|
|
|
267
268
|
- name: sherpa-onnx
|
|
268
269
|
provider: sherpa-onnx-stt
|
|
@@ -397,12 +398,12 @@ engines:
|
|
|
397
398
|
display_name: "Qwen3-Omni 30B"
|
|
398
399
|
description: "Alibaba Qwen3-Omni-30B-A3B — omni LLM ASR + understanding (zh/en+); needs a large GPU (~60GB)"
|
|
399
400
|
default_alias: qwen3_omni_stt
|
|
400
|
-
default_exec_mode:
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
#
|
|
405
|
-
incompat_reason: "
|
|
401
|
+
default_exec_mode: local # service client → OSA-managed vLLM-Omni OpenAI server (was in-process transformers, which OOMs the 30B on big unified-memory GPUs)
|
|
402
|
+
vllm_venv: true # build a clean vLLM-Omni serving venv (no openspeechapi → no torch clash); see local_engines/vllm_venv.py
|
|
403
|
+
pip_extras: [vllm==0.22.0, vllm-omni==0.22.0, ninja] # installed into the vLLM serving venv (vllm pulls flashinfer); NOT pyproject extras
|
|
404
|
+
platforms: [linux, win32] # vLLM-Omni serving is CUDA-only; the 30B MoE needs a large GPU.
|
|
405
|
+
# Not runnable on Apple Silicon (no CUDA vLLM; the MLX build is text-only).
|
|
406
|
+
incompat_reason: "qwen3-omni serving needs CUDA vLLM-Omni + a large GPU; not available on Apple Silicon"
|
|
406
407
|
|
|
407
408
|
- name: voxtral
|
|
408
409
|
provider: voxtral
|
|
@@ -126,6 +126,15 @@ def _aim_resolve(model_id: str) -> dict | None:
|
|
|
126
126
|
return data or None
|
|
127
127
|
|
|
128
128
|
|
|
129
|
+
def aim_has_model(model_id: str) -> bool:
|
|
130
|
+
"""True if aim has *model_id* registered (downloaded into its store/hub), even when not yet
|
|
131
|
+
provisioned to an engine (no ``model_path`` written). Lets the WebUI download-state check
|
|
132
|
+
recognise aim-store models that the HF/ms cache check (``model_is_cached``) can't see — e.g.
|
|
133
|
+
a multi-GB ModelScope download sitting in ``~/AI/store`` would otherwise look "not
|
|
134
|
+
downloaded" until the engine first starts and provisions it."""
|
|
135
|
+
return aim_available() and _aim_resolve(model_id) is not None
|
|
136
|
+
|
|
137
|
+
|
|
129
138
|
def _loadable_path(meta: dict | None) -> str | None:
|
|
130
139
|
"""A directly-loadable local model path from aim resolve metadata, or None.
|
|
131
140
|
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"""Per-engine vLLM-Omni serving venv (for service-client providers, e.g. qwen3-omni).
|
|
2
|
+
|
|
3
|
+
Unlike :mod:`isolated_venv` (which editable-installs ``openspeechapi`` so an IPC-compatible
|
|
4
|
+
subprocess WORKER can run from it), a vLLM-Omni engine runs as a separate OpenAI-compatible
|
|
5
|
+
**server** that OSA talks to over HTTP. Its venv must therefore NOT contain ``openspeechapi``
|
|
6
|
+
— OSA's torch would clash with vLLM's pinned cu13 torch. This builds a clean venv with just
|
|
7
|
+
``vllm`` + ``vllm-omni`` + ``ninja``, using a **uv-managed python** (python-build-standalone
|
|
8
|
+
ships ``Python.h``, which vLLM's runtime JIT needs), and applies two small source patches that
|
|
9
|
+
a brand-new Blackwell / unified-memory box (GB10 / DGX Spark) needs and that are safe no-ops
|
|
10
|
+
elsewhere.
|
|
11
|
+
|
|
12
|
+
China-friendly by default: the uv python is fetched via a GitHub proxy and pip via a PyPI
|
|
13
|
+
mirror, both overridable by env so other machines can point elsewhere. See the
|
|
14
|
+
qwen3-omni-gb10 playbook + docs/architecture/local-tts-expansion.md siblings.
|
|
15
|
+
|
|
16
|
+
Layout/keying matches isolated_venv: ``venv_dir(provider_key)`` = ``~/AI/venvs/<name>``; the
|
|
17
|
+
provider's ``_resolve_server_bin`` looks for ``<venv>/bin/vllm-omni`` there.
|
|
18
|
+
"""
|
|
19
|
+
from __future__ import annotations
|
|
20
|
+
|
|
21
|
+
import os
|
|
22
|
+
import shutil
|
|
23
|
+
import subprocess
|
|
24
|
+
from collections.abc import Callable
|
|
25
|
+
from dataclasses import dataclass
|
|
26
|
+
from pathlib import Path
|
|
27
|
+
|
|
28
|
+
from openspeechapi.local_engines.isolated_venv import venv_dir, venv_python
|
|
29
|
+
|
|
30
|
+
# Defaults are China-fast; override per-machine with the OSA_* env vars.
|
|
31
|
+
_UV_PYTHON_MIRROR_DEFAULT = (
|
|
32
|
+
"https://ghfast.top/https://github.com/astral-sh/"
|
|
33
|
+
"python-build-standalone/releases/download"
|
|
34
|
+
)
|
|
35
|
+
_PIP_INDEX_DEFAULT = "https://pypi.tuna.tsinghua.edu.cn/simple"
|
|
36
|
+
_PY_VERSION = "3.12"
|
|
37
|
+
_DEFAULT_PKGS = ["vllm==0.22.0", "vllm-omni==0.22.0", "ninja"]
|
|
38
|
+
|
|
39
|
+
# ── GB10 / Blackwell source patches (idempotent; safe no-ops on other GPUs) ────────────────
|
|
40
|
+
# #1 vLLM NVML get_device_capability raises NVMLError_InvalidArgument on the GB10 unified-memory
|
|
41
|
+
# iGPU; broaden the catch and fall back to torch (which reports it fine).
|
|
42
|
+
_NVML_OLD = """ major, minor = pynvml.nvmlDeviceGetCudaComputeCapability(handle)
|
|
43
|
+
return DeviceCapability(major=major, minor=minor)
|
|
44
|
+
except RuntimeError:
|
|
45
|
+
return None"""
|
|
46
|
+
_NVML_NEW = """ major, minor = pynvml.nvmlDeviceGetCudaComputeCapability(handle)
|
|
47
|
+
return DeviceCapability(major=major, minor=minor)
|
|
48
|
+
except Exception:
|
|
49
|
+
# GB10/DGX Spark: NVML capability query raises NVMLError_InvalidArgument on the
|
|
50
|
+
# unified-memory iGPU. torch reports the capability fine -> fall back to it.
|
|
51
|
+
try:
|
|
52
|
+
import torch
|
|
53
|
+
major, minor = torch.cuda.get_device_capability(device_id)
|
|
54
|
+
return DeviceCapability(major=major, minor=minor)
|
|
55
|
+
except Exception:
|
|
56
|
+
return None"""
|
|
57
|
+
_NVML_MARK = "GB10/DGX Spark: NVML capability query"
|
|
58
|
+
|
|
59
|
+
# #6 qwen3-omni's vision encoder passes cu_seqlens on CPU; flash_attn_varlen_func needs it on
|
|
60
|
+
# CUDA. Move it to q.device right before the call.
|
|
61
|
+
_VIT_OLD = """ 0, (batch_size + 1) * q_len, step=q_len, dtype=torch.int32, device=q.device
|
|
62
|
+
)
|
|
63
|
+
max_seqlen = q_len if max_seqlen is None else max_seqlen.item()"""
|
|
64
|
+
_VIT_NEW = """ 0, (batch_size + 1) * q_len, step=q_len, dtype=torch.int32, device=q.device
|
|
65
|
+
)
|
|
66
|
+
cu_seqlens = cu_seqlens.to(q.device) # GB10 fix: cu_seqlens may be on CPU; flash-attn needs CUDA
|
|
67
|
+
max_seqlen = q_len if max_seqlen is None else max_seqlen.item()"""
|
|
68
|
+
_VIT_MARK = "GB10 fix: cu_seqlens may be on CPU"
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass
|
|
72
|
+
class VllmVenvResult:
|
|
73
|
+
ok: bool
|
|
74
|
+
venv_python: str = ""
|
|
75
|
+
method: str = ""
|
|
76
|
+
log: str = ""
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _run(cmd: list[str], env: dict | None = None, timeout: int = 3600) -> subprocess.CompletedProcess:
|
|
80
|
+
return subprocess.run(cmd, capture_output=True, text=True, timeout=timeout, env=env)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def _patch_file(path: Path, old: str, new: str, marker: str) -> str:
|
|
84
|
+
if not path.exists():
|
|
85
|
+
return f"{path.name}: missing(skip)"
|
|
86
|
+
s = path.read_text(encoding="utf-8")
|
|
87
|
+
if marker in s:
|
|
88
|
+
return f"{path.name}: already"
|
|
89
|
+
if old not in s:
|
|
90
|
+
return f"{path.name}: target-not-found"
|
|
91
|
+
path.write_text(s.replace(old, new, 1), encoding="utf-8")
|
|
92
|
+
return f"{path.name}: patched"
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
def apply_gb10_patches(vpy: Path) -> str:
|
|
96
|
+
"""Apply the two vLLM source patches to the venv's site-packages. Idempotent."""
|
|
97
|
+
r = _run([str(vpy), "-c", "import sysconfig; print(sysconfig.get_path('purelib'))"], timeout=30)
|
|
98
|
+
sp = (r.stdout or "").strip()
|
|
99
|
+
if not sp or not Path(sp).exists():
|
|
100
|
+
return "site-packages not found"
|
|
101
|
+
sp_path = Path(sp)
|
|
102
|
+
return "; ".join([
|
|
103
|
+
_patch_file(sp_path / "vllm/platforms/cuda.py", _NVML_OLD, _NVML_NEW, _NVML_MARK),
|
|
104
|
+
_patch_file(
|
|
105
|
+
sp_path / "vllm/v1/attention/ops/vit_attn_wrappers.py",
|
|
106
|
+
_VIT_OLD, _VIT_NEW, _VIT_MARK,
|
|
107
|
+
),
|
|
108
|
+
])
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def create_vllm_venv(
|
|
112
|
+
repo_root: Path | str, entry, *, timeout: int = 3600,
|
|
113
|
+
progress: Callable[[str], None] | None = None,
|
|
114
|
+
) -> VllmVenvResult:
|
|
115
|
+
"""Build the per-engine vLLM-Omni serving venv: uv-managed python (headers) → ``uv venv`` →
|
|
116
|
+
``uv pip install`` the engine's ``pip_extras`` (vllm + vllm-omni + ninja) → GB10 patches.
|
|
117
|
+
``entry`` is a CatalogEntry (needs ``provider`` / ``pip_extras``). Idempotent: an existing
|
|
118
|
+
venv is reused and the pip install / patches are no-ops when already satisfied.
|
|
119
|
+
|
|
120
|
+
NOTE: the model weights are NOT downloaded here — that stays with aim provisioning at
|
|
121
|
+
lazy-start (the provider's ``aim_model_spec``), exactly like the in-process engines.
|
|
122
|
+
"""
|
|
123
|
+
logs: list[str] = []
|
|
124
|
+
|
|
125
|
+
def emit(line: str) -> None:
|
|
126
|
+
line = (line or "").rstrip()
|
|
127
|
+
if not line:
|
|
128
|
+
return
|
|
129
|
+
logs.append(line)
|
|
130
|
+
if progress:
|
|
131
|
+
progress(line)
|
|
132
|
+
|
|
133
|
+
provider_key = entry.provider
|
|
134
|
+
vdir = venv_dir(provider_key)
|
|
135
|
+
vpy = venv_python(provider_key)
|
|
136
|
+
|
|
137
|
+
uv = shutil.which("uv")
|
|
138
|
+
if not uv:
|
|
139
|
+
return VllmVenvResult(
|
|
140
|
+
ok=False,
|
|
141
|
+
log="uv not found — install uv (https://docs.astral.sh/uv) to build the vLLM venv.",
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
env = dict(os.environ)
|
|
145
|
+
env.setdefault(
|
|
146
|
+
"UV_PYTHON_INSTALL_MIRROR",
|
|
147
|
+
os.environ.get("OSA_UV_PYTHON_MIRROR", _UV_PYTHON_MIRROR_DEFAULT),
|
|
148
|
+
)
|
|
149
|
+
pip_index = os.environ.get("OSA_PIP_INDEX_URL", _PIP_INDEX_DEFAULT)
|
|
150
|
+
|
|
151
|
+
# 1+2. uv-managed python (ships Python.h) + venv. Skip if the venv python already exists.
|
|
152
|
+
if not vpy.exists():
|
|
153
|
+
emit(f"uv python install {_PY_VERSION} …")
|
|
154
|
+
r = _run([uv, "python", "install", _PY_VERSION], env=env, timeout=timeout)
|
|
155
|
+
emit((r.stdout or "") + (r.stderr or ""))
|
|
156
|
+
vdir.parent.mkdir(parents=True, exist_ok=True)
|
|
157
|
+
emit(f"uv venv --python {_PY_VERSION} {vdir} …")
|
|
158
|
+
r = _run([uv, "venv", "--python", _PY_VERSION, str(vdir)], env=env, timeout=timeout)
|
|
159
|
+
emit((r.stdout or "") + (r.stderr or ""))
|
|
160
|
+
if r.returncode != 0 or not vpy.exists():
|
|
161
|
+
return VllmVenvResult(ok=False, method="uv", log="\n".join(logs)[-4000:])
|
|
162
|
+
|
|
163
|
+
# 3. Install vllm + vllm-omni + ninja (NO openspeechapi). uv pip is idempotent.
|
|
164
|
+
pkgs = list(entry.pip_extras or []) or list(_DEFAULT_PKGS)
|
|
165
|
+
emit(f"uv pip install {' '.join(pkgs)} (index={pip_index}) …")
|
|
166
|
+
r = _run(
|
|
167
|
+
[uv, "pip", "install", "--python", str(vpy), "-i", pip_index, *pkgs],
|
|
168
|
+
env=env, timeout=timeout,
|
|
169
|
+
)
|
|
170
|
+
emit((r.stdout or "") + (r.stderr or ""))
|
|
171
|
+
if r.returncode != 0:
|
|
172
|
+
return VllmVenvResult(ok=False, method="uv", log="\n".join(logs)[-4000:])
|
|
173
|
+
|
|
174
|
+
# 4. GB10/Blackwell source patches (idempotent; safe no-ops elsewhere).
|
|
175
|
+
emit(f"GB10 patches: {apply_gb10_patches(vpy)}")
|
|
176
|
+
|
|
177
|
+
return VllmVenvResult(ok=True, venv_python=str(vpy), method="uv", log="\n".join(logs)[-4000:])
|
{openspeechapi-0.2.22 → openspeechapi-0.2.24}/openspeechapi/providers/stt/canary_qwen_stt.py
RENAMED
|
@@ -16,8 +16,9 @@ from collections.abc import AsyncIterator
|
|
|
16
16
|
from dataclasses import dataclass
|
|
17
17
|
from typing import Any
|
|
18
18
|
|
|
19
|
-
from openspeechapi.core.base import STTProvider
|
|
19
|
+
from openspeechapi.core.base import AimModelSpec, STTProvider, aim_local_path_or
|
|
20
20
|
from openspeechapi.core.enums import Capability, ExecMode, ProviderType
|
|
21
|
+
from openspeechapi.core.model_hub import build_aim_spec
|
|
21
22
|
from openspeechapi.core.models import AudioData, STTOptions, Transcription
|
|
22
23
|
from openspeechapi.core.settings import BaseSettings
|
|
23
24
|
from openspeechapi.logging_config import logger
|
|
@@ -27,6 +28,10 @@ from openspeechapi.providers.stt._local_audio import duration_ms, write_temp_wav
|
|
|
27
28
|
@dataclass
|
|
28
29
|
class CanaryQwenSTTSettings(BaseSettings):
|
|
29
30
|
model: str = "nvidia/canary-qwen-2.5b"
|
|
31
|
+
# aim-resolved local path, set by the main-process aim provisioning step and
|
|
32
|
+
# persisted to providers.yaml. When set + present on disk, the loader uses it
|
|
33
|
+
# instead of `model` (keeps working when aim is absent — falls back to the repo id).
|
|
34
|
+
model_path: str = ""
|
|
30
35
|
device: str = "cpu" # cpu | cuda (GPU strongly recommended)
|
|
31
36
|
dtype: str = "bfloat16" # bfloat16 | float32
|
|
32
37
|
max_new_tokens: int = 128
|
|
@@ -66,8 +71,17 @@ class CanaryQwenSTT(STTProvider):
|
|
|
66
71
|
async def health_check(self) -> bool:
|
|
67
72
|
return self._model is not None
|
|
68
73
|
|
|
74
|
+
def aim_model_spec(self) -> AimModelSpec | None:
|
|
75
|
+
"""Let aim (ai-model-manager) download + manage the weights, per CLAUDE.md's aim
|
|
76
|
+
rule. ``SALM.from_pretrained`` loads from a HF repo id; ``build_aim_spec`` adds
|
|
77
|
+
existing-copy-first (defers to a copy already in the HF cache instead of having aim
|
|
78
|
+
re-download) and the ``hf:`` scheme. canary-qwen has no ModelScope mirror, so the
|
|
79
|
+
hub is fixed to ``hf``."""
|
|
80
|
+
return build_aim_spec(self.settings.model, "hf", None, "asr/model")
|
|
81
|
+
|
|
69
82
|
async def _ensure_model(self, s: "CanaryQwenSTTSettings") -> None:
|
|
70
|
-
|
|
83
|
+
# model_path changes the resolved load target → part of the reload key.
|
|
84
|
+
key = (s.model.strip(), s.model_path.strip(), s.device.strip(), s.dtype.strip())
|
|
71
85
|
if self._model is not None and self._loaded_key == key:
|
|
72
86
|
return
|
|
73
87
|
try:
|
|
@@ -79,8 +93,12 @@ class CanaryQwenSTT(STTProvider):
|
|
|
79
93
|
"pip install 'nemo_toolkit[asr] @ git+https://github.com/NVIDIA/NeMo.git'"
|
|
80
94
|
) from exc
|
|
81
95
|
|
|
96
|
+
# Load from the aim-provisioned local path when set + present on disk; else the repo
|
|
97
|
+
# id (NeMo downloads it). Keeps working when aim is absent (falls back to the id).
|
|
98
|
+
target = aim_local_path_or(s.model_path, s.model)
|
|
99
|
+
|
|
82
100
|
def _load() -> Any:
|
|
83
|
-
m = SALM.from_pretrained(
|
|
101
|
+
m = SALM.from_pretrained(target)
|
|
84
102
|
if s.dtype.strip().lower() == "bfloat16":
|
|
85
103
|
m = m.bfloat16()
|
|
86
104
|
return m.eval().to(s.device)
|
|
@@ -10,15 +10,36 @@ from collections.abc import AsyncIterator
|
|
|
10
10
|
from dataclasses import dataclass
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
13
|
-
from openspeechapi.core.base import STTProvider
|
|
13
|
+
from openspeechapi.core.base import AimModelSpec, STTProvider, aim_local_path_or
|
|
14
14
|
|
|
15
15
|
from openspeechapi.core.enums import Capability, ExecMode, ProviderType
|
|
16
|
+
from openspeechapi.core.model_hub import build_aim_spec
|
|
16
17
|
from openspeechapi.core.models import AudioData, STTOptions, Transcription, Word
|
|
17
18
|
from openspeechapi.core.settings import BaseSettings
|
|
18
19
|
|
|
20
|
+
# faster-whisper's own size→HF-repo map (faster_whisper.utils._MODELS), restricted to the
|
|
21
|
+
# sizes we offer in field_options. Used to give aim a concrete `hf:<repo>` source — aim
|
|
22
|
+
# can't act on a bare size alias like "large-v3". NOTE: the turbo + large aliases live
|
|
23
|
+
# under different orgs (mobiuslabsgmbh / large-v3), so this can't be derived by f-string.
|
|
24
|
+
_FW_REPOS = {
|
|
25
|
+
"tiny": "Systran/faster-whisper-tiny",
|
|
26
|
+
"base": "Systran/faster-whisper-base",
|
|
27
|
+
"small": "Systran/faster-whisper-small",
|
|
28
|
+
"medium": "Systran/faster-whisper-medium",
|
|
29
|
+
"large-v2": "Systran/faster-whisper-large-v2",
|
|
30
|
+
"large-v3": "Systran/faster-whisper-large-v3",
|
|
31
|
+
"large-v3-turbo": "mobiuslabsgmbh/faster-whisper-large-v3-turbo",
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
|
|
19
35
|
@dataclass
|
|
20
36
|
class FasterWhisperSTTSettings(BaseSettings):
|
|
21
37
|
model_size: str = "base"
|
|
38
|
+
# aim-resolved local path, set by the main-process aim provisioning step and persisted
|
|
39
|
+
# to providers.yaml. When set + present on disk, the loader uses it instead of the size
|
|
40
|
+
# alias (keeps working when aim is absent — falls back to the size, which faster-whisper
|
|
41
|
+
# resolves to its HF repo itself).
|
|
42
|
+
model_path: str = ""
|
|
22
43
|
device: str = "auto"
|
|
23
44
|
compute_type: str = "default"
|
|
24
45
|
download_root: str | None = None
|
|
@@ -53,6 +74,18 @@ class FasterWhisperSTT(STTProvider):
|
|
|
53
74
|
)
|
|
54
75
|
logger.info("{} provider started", self.name)
|
|
55
76
|
|
|
77
|
+
def aim_model_spec(self) -> AimModelSpec | None:
|
|
78
|
+
"""Let aim (ai-model-manager) download + manage the weights, per CLAUDE.md's aim
|
|
79
|
+
rule. faster-whisper resolves a size alias (e.g. "large-v3") to a HF repo
|
|
80
|
+
internally; map it back via ``_FW_REPOS`` so aim gets a concrete ``hf:<repo>``.
|
|
81
|
+
``build_aim_spec`` adds existing-copy-first (defers to a copy already in the HF
|
|
82
|
+
cache) and the ``hf:`` scheme. None when the configured size is a local dir or an
|
|
83
|
+
unknown alias (no repo to map → fall back to faster-whisper's own download)."""
|
|
84
|
+
repo = _FW_REPOS.get((self.settings.model_size or "").strip())
|
|
85
|
+
if not repo:
|
|
86
|
+
return None
|
|
87
|
+
return build_aim_spec(repo, "hf", None, "asr/model")
|
|
88
|
+
|
|
56
89
|
async def _ensure_model(
|
|
57
90
|
self,
|
|
58
91
|
*,
|
|
@@ -67,7 +100,12 @@ class FasterWhisperSTT(STTProvider):
|
|
|
67
100
|
"Install faster-whisper: pip install openspeechapi[faster-whisper]"
|
|
68
101
|
)
|
|
69
102
|
|
|
70
|
-
|
|
103
|
+
# Prefer the aim-provisioned local dir when set + present on disk; else the size
|
|
104
|
+
# alias (faster-whisper resolves it to its HF repo and downloads). Keeps working
|
|
105
|
+
# when aim is absent (falls back to the alias).
|
|
106
|
+
normalized_model_size = self._resolve_model_dir(
|
|
107
|
+
aim_local_path_or(self.settings.model_path, model_size)
|
|
108
|
+
)
|
|
71
109
|
|
|
72
110
|
if (
|
|
73
111
|
self._model is not None
|
|
@@ -5,8 +5,12 @@ strong singing-lyrics recognition. Two variants:
|
|
|
5
5
|
* ``aed`` — FireRedASR-AED-L (attention-encoder-decoder), audio ≤ 60s
|
|
6
6
|
* ``llm`` — FireRedASR-LLM-L (LLM-based), audio ≤ 30s
|
|
7
7
|
|
|
8
|
-
Weights are
|
|
9
|
-
|
|
8
|
+
Weights are pulled from **ModelScope** by fireredasr itself — its
|
|
9
|
+
``FireRedAsr.from_pretrained(asr_type)`` calls ``modelscope.snapshot_download(
|
|
10
|
+
"pengzhendong/FireRedASR-<TYPE>-L")`` internally (it takes ONLY the type, computes the
|
|
11
|
+
repo + cache dir itself, and exposes no path/repo override). So aim can pre-fetch the
|
|
12
|
+
weights (download button + lazy-start), but the load call can't be redirected to an
|
|
13
|
+
aim-resolved ``model_path`` the way the other engines are — see ``aim_model_spec``.
|
|
10
14
|
|
|
11
15
|
Capabilities: BATCH + MULTILINGUAL. Offline batch model.
|
|
12
16
|
"""
|
|
@@ -19,13 +23,21 @@ from collections.abc import AsyncIterator
|
|
|
19
23
|
from dataclasses import dataclass
|
|
20
24
|
from typing import Any
|
|
21
25
|
|
|
22
|
-
from openspeechapi.core.base import STTProvider
|
|
26
|
+
from openspeechapi.core.base import AimModelSpec, STTProvider
|
|
23
27
|
from openspeechapi.core.enums import Capability, ExecMode, ProviderType
|
|
28
|
+
from openspeechapi.core.model_hub import build_aim_spec
|
|
24
29
|
from openspeechapi.core.models import AudioData, STTOptions, Transcription
|
|
25
30
|
from openspeechapi.core.settings import BaseSettings
|
|
26
31
|
from openspeechapi.logging_config import logger
|
|
27
32
|
from openspeechapi.providers.stt._local_audio import duration_ms, write_temp_wav
|
|
28
33
|
|
|
34
|
+
# fireredasr's hardcoded ModelScope repo per variant (FireRedAsr.from_pretrained →
|
|
35
|
+
# snapshot_download(f"pengzhendong/FireRedASR-{TYPE}-L")). Drives the aim source.
|
|
36
|
+
_FIRERED_REPOS = {
|
|
37
|
+
"aed": "pengzhendong/FireRedASR-AED-L",
|
|
38
|
+
"llm": "pengzhendong/FireRedASR-LLM-L",
|
|
39
|
+
}
|
|
40
|
+
|
|
29
41
|
|
|
30
42
|
@dataclass
|
|
31
43
|
class FireRedASRSTTSettings(BaseSettings):
|
|
@@ -68,6 +80,23 @@ class FireRedASRSTT(STTProvider):
|
|
|
68
80
|
async def health_check(self) -> bool:
|
|
69
81
|
return self._model is not None
|
|
70
82
|
|
|
83
|
+
def aim_model_spec(self) -> AimModelSpec | None:
|
|
84
|
+
"""Let aim (ai-model-manager) pre-fetch the weights, per CLAUDE.md's aim rule.
|
|
85
|
+
fireredasr downloads from **ModelScope** (``snapshot_download("pengzhendong/
|
|
86
|
+
FireRedASR-<TYPE>-L")``), so the aim source uses the ``ms:`` scheme via
|
|
87
|
+
``build_aim_spec`` (which also defers to an already-downloaded copy → returns None).
|
|
88
|
+
|
|
89
|
+
NOTE: this only makes aim DOWNLOAD the weights ahead of time (WebUI button /
|
|
90
|
+
lazy-start). fireredasr's ``from_pretrained(asr_type)`` takes no path/repo and
|
|
91
|
+
re-runs its own ``snapshot_download`` into the ModelScope cache at load time, so —
|
|
92
|
+
unlike the other engines — there's no ``model_path`` for the loader to consume.
|
|
93
|
+
aim pre-fetching the same ModelScope repo warms that cache so the load is a no-op
|
|
94
|
+
re-resolve (``snapshot_download`` is idempotent)."""
|
|
95
|
+
repo = _FIRERED_REPOS.get((self.settings.model_type or "").strip().lower())
|
|
96
|
+
if not repo:
|
|
97
|
+
return None
|
|
98
|
+
return build_aim_spec(repo, "ms", None, "asr/model")
|
|
99
|
+
|
|
71
100
|
async def _ensure_model(self, s: "FireRedASRSTTSettings") -> None:
|
|
72
101
|
key = (s.model_type.strip(), s.device.strip())
|
|
73
102
|
if self._model is not None and self._loaded_key == key:
|
|
@@ -17,8 +17,9 @@ from dataclasses import dataclass
|
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
from typing import Any
|
|
19
19
|
|
|
20
|
-
from openspeechapi.core.base import STTProvider
|
|
20
|
+
from openspeechapi.core.base import AimModelSpec, STTProvider, aim_local_path_or
|
|
21
21
|
from openspeechapi.core.enums import Capability, ExecMode, ProviderType
|
|
22
|
+
from openspeechapi.core.model_hub import build_aim_spec
|
|
22
23
|
from openspeechapi.core.models import AudioData, STTOptions, Transcription
|
|
23
24
|
from openspeechapi.core.settings import BaseSettings
|
|
24
25
|
from openspeechapi.logging_config import logger
|
|
@@ -51,6 +52,10 @@ for _x in _MMS_LANGS:
|
|
|
51
52
|
@dataclass
|
|
52
53
|
class MMSSTTSettings(BaseSettings):
|
|
53
54
|
model: str = "facebook/mms-1b-all"
|
|
55
|
+
# aim-resolved local path, set by the main-process aim provisioning step and
|
|
56
|
+
# persisted to providers.yaml. When set + present on disk, the loader uses it
|
|
57
|
+
# instead of `model` (keeps working when aim is absent — falls back to the repo id).
|
|
58
|
+
model_path: str = ""
|
|
54
59
|
language: str = "eng" # ISO 639-3 (eng, cmn, yue, jpn, ...)
|
|
55
60
|
device: str = "auto" # auto | cpu | cuda | mps (auto: cuda > mps > cpu)
|
|
56
61
|
|
|
@@ -118,8 +123,17 @@ class MMSSTT(STTProvider):
|
|
|
118
123
|
pass
|
|
119
124
|
return "cpu"
|
|
120
125
|
|
|
126
|
+
def aim_model_spec(self) -> AimModelSpec | None:
|
|
127
|
+
"""Let aim (ai-model-manager) download + manage the model, per CLAUDE.md's aim
|
|
128
|
+
rule. ``build_aim_spec`` adds existing-copy-first (defers to a copy already in the
|
|
129
|
+
HF cache instead of having aim re-download it) and the ``hf:`` scheme, consistent
|
|
130
|
+
with the other STT engines. Meta MMS has no ModelScope mirror, so the hub is fixed
|
|
131
|
+
to ``hf``."""
|
|
132
|
+
return build_aim_spec(self.settings.model, "hf", None, "asr/model")
|
|
133
|
+
|
|
121
134
|
async def _ensure_model(self, s: "MMSSTTSettings") -> None:
|
|
122
|
-
|
|
135
|
+
# model_path changes the resolved load target → part of the reload key.
|
|
136
|
+
key = (s.model.strip(), s.model_path.strip(), s.language.strip(), s.device.strip())
|
|
123
137
|
if self._model is not None and self._loaded_key == key:
|
|
124
138
|
return
|
|
125
139
|
try:
|
|
@@ -130,12 +144,16 @@ class MMSSTT(STTProvider):
|
|
|
130
144
|
"pip install 'openspeechapi[mms-stt]'"
|
|
131
145
|
) from exc
|
|
132
146
|
|
|
147
|
+
# Load from the aim-provisioned local path when set + present on disk; else the repo
|
|
148
|
+
# id (transformers downloads it). Keeps working when aim is absent (falls back to id).
|
|
149
|
+
target = aim_local_path_or(s.model_path, s.model)
|
|
150
|
+
|
|
133
151
|
def _build(local_only: bool) -> tuple[Any, Any]:
|
|
134
152
|
processor = AutoProcessor.from_pretrained(
|
|
135
|
-
|
|
153
|
+
target, target_lang=s.language, local_files_only=local_only
|
|
136
154
|
)
|
|
137
155
|
model = Wav2Vec2ForCTC.from_pretrained(
|
|
138
|
-
|
|
156
|
+
target, target_lang=s.language, ignore_mismatched_sizes=True,
|
|
139
157
|
local_files_only=local_only,
|
|
140
158
|
)
|
|
141
159
|
return model, processor
|