openspeechapi 0.2.23__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.
Files changed (164) hide show
  1. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/PKG-INFO +1 -1
  2. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/core/model_hub.py +37 -6
  3. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/engine_catalog.py +2 -0
  4. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/engine_registry.yaml +8 -7
  5. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/aim_resolver.py +9 -0
  6. openspeechapi-0.2.24/openspeechapi/local_engines/vllm_venv.py +177 -0
  7. openspeechapi-0.2.24/openspeechapi/providers/stt/qwen3_omni_stt.py +435 -0
  8. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/whisperlivekit.py +186 -2
  9. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/routes/management.py +44 -2
  10. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/routes/stt.py +10 -0
  11. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/webui/app.js +54 -25
  12. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/pyproject.toml +1 -1
  13. openspeechapi-0.2.23/openspeechapi/providers/stt/qwen3_omni_stt.py +0 -219
  14. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/.gitignore +0 -0
  15. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/README.md +0 -0
  16. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/__init__.py +0 -0
  17. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/__main__.py +0 -0
  18. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/cli.py +0 -0
  19. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/client/__init__.py +0 -0
  20. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/client/client.py +0 -0
  21. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/config.py +0 -0
  22. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/core/__init__.py +0 -0
  23. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/core/base.py +0 -0
  24. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/core/enums.py +0 -0
  25. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/core/models.py +0 -0
  26. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/core/registry.py +0 -0
  27. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/core/settings.py +0 -0
  28. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/demo.py +0 -0
  29. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/__init__.py +0 -0
  30. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/aim_provision.py +0 -0
  31. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/context.py +0 -0
  32. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/dispatcher.py +0 -0
  33. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/executors/__init__.py +0 -0
  34. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/executors/base.py +0 -0
  35. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/executors/in_process.py +0 -0
  36. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/executors/remote.py +0 -0
  37. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/executors/subprocess_exec.py +0 -0
  38. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/fanout.py +0 -0
  39. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/filters.py +0 -0
  40. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/lifecycle.py +0 -0
  41. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/dispatch/watcher.py +0 -0
  42. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/exceptions.py +0 -0
  43. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/factory.py +0 -0
  44. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/__init__.py +0 -0
  45. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/backends/__init__.py +0 -0
  46. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/backends/docker_backend.py +0 -0
  47. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/backends/native_backend.py +0 -0
  48. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/base.py +0 -0
  49. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/__init__.py +0 -0
  50. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/faster_whisper.py +0 -0
  51. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/fish_speech.py +0 -0
  52. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/sherpa_onnx.py +0 -0
  53. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/whisper.py +0 -0
  54. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/engines/whisperlivekit.py +0 -0
  55. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/isolated_venv.py +0 -0
  56. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/manager.py +0 -0
  57. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/models.py +0 -0
  58. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/progress.py +0 -0
  59. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/registry.py +0 -0
  60. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/task_store.py +0 -0
  61. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/local_engines/tasks.py +0 -0
  62. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/logging_config.py +0 -0
  63. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/observe/__init__.py +0 -0
  64. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/observe/base.py +0 -0
  65. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/observe/debug.py +0 -0
  66. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/observe/latency.py +0 -0
  67. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/observe/metrics.py +0 -0
  68. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/observe/tracing.py +0 -0
  69. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/observe/usage.py +0 -0
  70. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/__init__.py +0 -0
  71. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/_template.py +0 -0
  72. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/__init__.py +0 -0
  73. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/_local_audio.py +0 -0
  74. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/alibaba.py +0 -0
  75. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/assemblyai.py +0 -0
  76. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/azure_speech.py +0 -0
  77. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/baidu.py +0 -0
  78. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/canary_qwen_stt.py +0 -0
  79. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/deepgram.py +0 -0
  80. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/dolphin_stt.py +0 -0
  81. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/elevenlabs.py +0 -0
  82. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/faster_whisper.py +0 -0
  83. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/fireredasr_stt.py +0 -0
  84. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/funasr_stt.py +0 -0
  85. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/gemma4.py +0 -0
  86. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/google_cloud.py +0 -0
  87. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/iflytek.py +0 -0
  88. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/kimi_audio_stt.py +0 -0
  89. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/macos_speech.py +0 -0
  90. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/mlx_whisper_stt.py +0 -0
  91. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/mms_languages.json +0 -0
  92. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/mms_stt.py +0 -0
  93. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/moonshine_stt.py +0 -0
  94. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/openai.py +0 -0
  95. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/paraformer.py +0 -0
  96. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/parakeet_mlx_stt.py +0 -0
  97. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/phi4_multimodal_stt.py +0 -0
  98. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/qwen3_asr.py +0 -0
  99. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/sensevoice.py +0 -0
  100. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/sherpa_onnx.py +0 -0
  101. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/tencent.py +0 -0
  102. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/volcengine.py +0 -0
  103. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/vosk_stt.py +0 -0
  104. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/voxtral_stt.py +0 -0
  105. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/wenet_stt.py +0 -0
  106. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/whisper.py +0 -0
  107. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/stt/windows_speech.py +0 -0
  108. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/__init__.py +0 -0
  109. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/alibaba.py +0 -0
  110. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/azure_speech.py +0 -0
  111. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/baidu.py +0 -0
  112. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/coqui.py +0 -0
  113. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/cosyvoice.py +0 -0
  114. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/deepgram.py +0 -0
  115. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/elevenlabs.py +0 -0
  116. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/fish_speech.py +0 -0
  117. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/google_cloud.py +0 -0
  118. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/iflytek.py +0 -0
  119. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/macos_say.py +0 -0
  120. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/minimax.py +0 -0
  121. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/openai.py +0 -0
  122. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/piper.py +0 -0
  123. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/tencent.py +0 -0
  124. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/volcengine.py +0 -0
  125. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/providers/tts/windows_sapi.py +0 -0
  126. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/__init__.py +0 -0
  127. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/app.py +0 -0
  128. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/auth.py +0 -0
  129. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/extras_installer.py +0 -0
  130. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/middleware.py +0 -0
  131. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/model_downloads.py +0 -0
  132. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/native_installer.py +0 -0
  133. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/routes/__init__.py +0 -0
  134. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/routes/tts.py +0 -0
  135. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/routes/webui.py +0 -0
  136. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/system_metrics.py +0 -0
  137. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/webui/index.html +0 -0
  138. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/webui/styles.css +0 -0
  139. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/ws/__init__.py +0 -0
  140. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/ws/stt_stream.py +0 -0
  141. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/server/ws/tts_stream.py +0 -0
  142. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/telemetry/__init__.py +0 -0
  143. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/telemetry/perf.py +0 -0
  144. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/utils/__init__.py +0 -0
  145. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/utils/audio_converter.py +0 -0
  146. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/utils/audio_playback.py +0 -0
  147. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/openspeechapi/vendor_registry.yaml +0 -0
  148. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/providers.example.yaml +0 -0
  149. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/aim_adopt.py +0 -0
  150. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/aim_consumers.py +0 -0
  151. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/engines/cloud/install.sh +0 -0
  152. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/engines/faster-whisper/native/install.sh +0 -0
  153. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/engines/fish-speech/native/install.sh +0 -0
  154. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/engines/macos-stt/_bundle.sh +0 -0
  155. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/engines/macos-stt/install.sh +0 -0
  156. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/engines/macos-stt/macos_stt.swift +0 -0
  157. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/engines/macos-stt/request_auth.swift +0 -0
  158. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/engines/sherpa-onnx/native/install.sh +0 -0
  159. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/engines/sherpa-onnx/native/run_streaming_server.py +0 -0
  160. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/engines/whisper/native/install.sh +0 -0
  161. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/engines/whisperlivekit/native/install.sh +0 -0
  162. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/gen_mms_languages.py +0 -0
  163. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/preload_stt_model.py +0 -0
  164. {openspeechapi-0.2.23 → openspeechapi-0.2.24}/scripts/release.sh +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: openspeechapi
3
- Version: 0.2.23
3
+ Version: 0.2.24
4
4
  Summary: Unified speech interface for STT/TTS providers
5
5
  Requires-Python: >=3.11
6
6
  Requires-Dist: httpx>=0.27
@@ -317,19 +317,49 @@ def _download_candidates(
317
317
  return [c for c in ordered if c is not None]
318
318
 
319
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
+
320
342
  def _hf_local(repo: str) -> str | None:
321
- """Path to an already-downloaded HF snapshot of ``repo`` (no network), or None.
322
- Checks both the default HF cache (where funasr/transformers download) and our storage
323
- 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``)."""
324
352
  try:
325
353
  from huggingface_hub import snapshot_download
326
354
  except ImportError:
327
355
  return None
328
356
  for cache_dir in (None, os.path.join(default_storage_root(), "huggingface")):
329
357
  try:
330
- return snapshot_download(repo, cache_dir=cache_dir, local_files_only=True)
358
+ path = snapshot_download(repo, cache_dir=cache_dir, local_files_only=True)
331
359
  except Exception: # noqa: BLE001 - not in this cache → try the next / give up
332
360
  continue
361
+ if _hf_snapshot_complete(path):
362
+ return path # else: in-progress download in this cache → try the next / give up
333
363
  return None
334
364
 
335
365
 
@@ -354,8 +384,9 @@ _WEIGHT_SUFFIXES = (".pt", ".pth", ".bin", ".safetensors", ".onnx", ".gguf", ".c
354
384
 
355
385
  def _dir_has_model_weights(d: str) -> bool:
356
386
  """True if ``d`` holds a substantial (>1MB) model-weights file at its top level.
357
- (Catches missing/stub weights; it can't detect a large-but-truncated file — for HF
358
- that's covered by snapshot_download's own completeness check in ``_hf_local``.)"""
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``.)"""
359
390
  try:
360
391
  names = os.listdir(d)
361
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 with MLX backend"
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: subprocess
401
- pip_extras: [qwen3-omni-stt]
402
- platforms: [linux, win32] # transformers build needs ~60GB CUDA; on Apple Silicon the
403
- # quantized builds (AWQ/GPTQ/FP8) are CUDA-only and the MLX
404
- # build is text-only (audio tower dropped) — STT not runnable yet
405
- incompat_reason: "Audio STT not yet runnable on Apple Silicon (quantized builds are CUDA-only; MLX audio support pending upstream)"
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:])