mlx-one 0.1.0a1__py3-none-any.whl

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 (457) hide show
  1. mlx_one/__init__.py +181 -0
  2. mlx_one/audio/__init__.py +50 -0
  3. mlx_one/audio/cli.py +133 -0
  4. mlx_one/audio/decoding.py +533 -0
  5. mlx_one/audio/evaluation.py +181 -0
  6. mlx_one/audio/input.py +137 -0
  7. mlx_one/audio/lfm.py +289 -0
  8. mlx_one/audio/loading.py +102 -0
  9. mlx_one/audio/moonshine.py +129 -0
  10. mlx_one/audio/parakeet.py +177 -0
  11. mlx_one/audio/public.py +149 -0
  12. mlx_one/audio/qwen.py +288 -0
  13. mlx_one/audio/schemas.py +264 -0
  14. mlx_one/audio/service.py +324 -0
  15. mlx_one/audio/streaming.py +311 -0
  16. mlx_one/audio/weights.py +115 -0
  17. mlx_one/benchmark.py +186 -0
  18. mlx_one/benchmark_worker.py +82 -0
  19. mlx_one/calibration.py +618 -0
  20. mlx_one/calibration_worker.py +181 -0
  21. mlx_one/cli.py +1455 -0
  22. mlx_one/comparison.py +143 -0
  23. mlx_one/compat/__init__.py +5 -0
  24. mlx_one/compat/trl.py +53 -0
  25. mlx_one/compat/unsloth.py +77 -0
  26. mlx_one/compatibility.py +193 -0
  27. mlx_one/conversion.py +182 -0
  28. mlx_one/conversion_worker.py +28 -0
  29. mlx_one/core/__init__.py +45 -0
  30. mlx_one/core/cache.py +568 -0
  31. mlx_one/core/capabilities.py +38 -0
  32. mlx_one/core/compatibility.py +224 -0
  33. mlx_one/core/config.py +61 -0
  34. mlx_one/core/outputs.py +55 -0
  35. mlx_one/core/precision.py +154 -0
  36. mlx_one/core/protocols.py +45 -0
  37. mlx_one/core/quantization.py +60 -0
  38. mlx_one/core/registry.py +116 -0
  39. mlx_one/core/release_support.py +35 -0
  40. mlx_one/core/sliding_cache.py +59 -0
  41. mlx_one/core/weights.py +46 -0
  42. mlx_one/data/calibrations/m4-air-32gb-text-v1.json +543 -0
  43. mlx_one/data/calibrations/m4-air-32gb-text-v1.matrix.yaml +57 -0
  44. mlx_one/data/capabilities.json +97 -0
  45. mlx_one/data/compatibility/alpha_release.json +229 -0
  46. mlx_one/data/compatibility/mlx.json +56 -0
  47. mlx_one/data/hardware/m4-air-32gb.yaml +21 -0
  48. mlx_one/datasets.py +206 -0
  49. mlx_one/diagnostics.py +252 -0
  50. mlx_one/engine/__init__.py +153 -0
  51. mlx_one/engine/actor.py +538 -0
  52. mlx_one/engine/adapter_registry.py +159 -0
  53. mlx_one/engine/adapters.py +245 -0
  54. mlx_one/engine/admission.py +173 -0
  55. mlx_one/engine/arena.py +225 -0
  56. mlx_one/engine/batching.py +424 -0
  57. mlx_one/engine/block_cache.py +360 -0
  58. mlx_one/engine/block_kv.py +199 -0
  59. mlx_one/engine/cache.py +161 -0
  60. mlx_one/engine/cache_errors.py +37 -0
  61. mlx_one/engine/cache_manager.py +892 -0
  62. mlx_one/engine/cache_planner.py +121 -0
  63. mlx_one/engine/cache_specs.py +301 -0
  64. mlx_one/engine/cold_prefix.py +240 -0
  65. mlx_one/engine/components.py +645 -0
  66. mlx_one/engine/compound.py +129 -0
  67. mlx_one/engine/construction.py +77 -0
  68. mlx_one/engine/contracts.py +514 -0
  69. mlx_one/engine/device_executor.py +119 -0
  70. mlx_one/engine/dispatch.py +85 -0
  71. mlx_one/engine/envelope.py +100 -0
  72. mlx_one/engine/execution_context.py +25 -0
  73. mlx_one/engine/hybrid.py +252 -0
  74. mlx_one/engine/kernel_dispatch.py +124 -0
  75. mlx_one/engine/lifecycle.py +230 -0
  76. mlx_one/engine/media.py +86 -0
  77. mlx_one/engine/memory.py +150 -0
  78. mlx_one/engine/model_pool.py +255 -0
  79. mlx_one/engine/modes.py +177 -0
  80. mlx_one/engine/native_adapters.py +155 -0
  81. mlx_one/engine/observation.py +19 -0
  82. mlx_one/engine/optimization_policy.py +77 -0
  83. mlx_one/engine/paged.py +417 -0
  84. mlx_one/engine/paged_attention.py +246 -0
  85. mlx_one/engine/parity.py +319 -0
  86. mlx_one/engine/plugins.py +179 -0
  87. mlx_one/engine/prefix_cache.py +348 -0
  88. mlx_one/engine/pressure.py +332 -0
  89. mlx_one/engine/prompts.py +71 -0
  90. mlx_one/engine/public.py +478 -0
  91. mlx_one/engine/qualification.py +356 -0
  92. mlx_one/engine/reporting.py +187 -0
  93. mlx_one/engine/runners.py +221 -0
  94. mlx_one/engine/runtime_specs.py +100 -0
  95. mlx_one/engine/scheduler.py +81 -0
  96. mlx_one/engine/selection.py +270 -0
  97. mlx_one/engine/service.py +240 -0
  98. mlx_one/engine/sessions.py +67 -0
  99. mlx_one/engine/speculation.py +211 -0
  100. mlx_one/engine/task_runners/__init__.py +1 -0
  101. mlx_one/engine/task_runners/base.py +56 -0
  102. mlx_one/engine/task_runners/lfm_audio.py +76 -0
  103. mlx_one/engine/task_runners/multimodal.py +221 -0
  104. mlx_one/engine/task_runners/ocr.py +84 -0
  105. mlx_one/engine/task_runners/retrieval.py +227 -0
  106. mlx_one/engine/task_runners/segmentation.py +129 -0
  107. mlx_one/engine/task_runners/speech.py +191 -0
  108. mlx_one/engine/task_runners/transducer.py +185 -0
  109. mlx_one/engine/tasks.py +237 -0
  110. mlx_one/engine/timing.py +71 -0
  111. mlx_one/engine/transactions.py +108 -0
  112. mlx_one/evaluation.py +270 -0
  113. mlx_one/evidence.py +50 -0
  114. mlx_one/generation.py +72 -0
  115. mlx_one/generation_worker.py +32 -0
  116. mlx_one/hardware.py +125 -0
  117. mlx_one/inference_baseline.py +638 -0
  118. mlx_one/inference_baseline_worker.py +934 -0
  119. mlx_one/inference_qualification.py +498 -0
  120. mlx_one/inference_qualification_worker.py +394 -0
  121. mlx_one/inspection.py +852 -0
  122. mlx_one/models/UPSTREAM_LICENSE +21 -0
  123. mlx_one/models/__init__.py +1 -0
  124. mlx_one/models/audio/__init__.py +1 -0
  125. mlx_one/models/audio/lfm2_audio/UPSTREAM.md +9 -0
  126. mlx_one/models/audio/lfm2_audio/UPSTREAM_LICENSE +21 -0
  127. mlx_one/models/audio/lfm2_audio/__init__.py +5 -0
  128. mlx_one/models/audio/lfm2_audio/checkpoint_config.py +146 -0
  129. mlx_one/models/audio/lfm2_audio/config.py +158 -0
  130. mlx_one/models/audio/lfm2_audio/conformer.py +496 -0
  131. mlx_one/models/audio/lfm2_audio/detokenizer.py +509 -0
  132. mlx_one/models/audio/lfm2_audio/dsp.py +62 -0
  133. mlx_one/models/audio/lfm2_audio/loading.py +168 -0
  134. mlx_one/models/audio/lfm2_audio/model.py +272 -0
  135. mlx_one/models/audio/lfm2_audio/native.py +271 -0
  136. mlx_one/models/audio/lfm2_audio/processing.py +83 -0
  137. mlx_one/models/audio/lfm2_audio/transformer.py +269 -0
  138. mlx_one/models/audio/lfm2_audio/weights.py +120 -0
  139. mlx_one/models/audio/moonshine/NOTICE +14 -0
  140. mlx_one/models/audio/moonshine/__init__.py +1 -0
  141. mlx_one/models/audio/moonshine/config.py +124 -0
  142. mlx_one/models/audio/moonshine/loading.py +162 -0
  143. mlx_one/models/audio/moonshine/model.py +231 -0
  144. mlx_one/models/audio/moonshine/weights.py +55 -0
  145. mlx_one/models/audio/parakeet/NOTICE +10 -0
  146. mlx_one/models/audio/parakeet/__init__.py +5 -0
  147. mlx_one/models/audio/parakeet/config.py +116 -0
  148. mlx_one/models/audio/parakeet/loading.py +214 -0
  149. mlx_one/models/audio/parakeet/mlx_export.py +101 -0
  150. mlx_one/models/audio/parakeet/model.py +263 -0
  151. mlx_one/models/audio/parakeet/processing.py +104 -0
  152. mlx_one/models/audio/parakeet/weights.py +96 -0
  153. mlx_one/models/audio/qwen3_asr/NOTICE +10 -0
  154. mlx_one/models/audio/qwen3_asr/__init__.py +1 -0
  155. mlx_one/models/audio/qwen3_asr/alignment.py +135 -0
  156. mlx_one/models/audio/qwen3_asr/config.py +193 -0
  157. mlx_one/models/audio/qwen3_asr/loading.py +138 -0
  158. mlx_one/models/audio/qwen3_asr/model.py +280 -0
  159. mlx_one/models/audio/qwen3_asr/processing.py +232 -0
  160. mlx_one/models/audio/qwen3_asr/weights.py +94 -0
  161. mlx_one/models/audio/whisper/__init__.py +5 -0
  162. mlx_one/models/audio/whisper/config.py +133 -0
  163. mlx_one/models/audio/whisper/loading.py +187 -0
  164. mlx_one/models/audio/whisper/model.py +293 -0
  165. mlx_one/models/audio/whisper/processing.py +256 -0
  166. mlx_one/models/audio/whisper/tokenizer.py +211 -0
  167. mlx_one/models/audio/whisper/weights.py +78 -0
  168. mlx_one/models/embeddings/__init__.py +1 -0
  169. mlx_one/models/embeddings/bert/__init__.py +5 -0
  170. mlx_one/models/embeddings/bert/config.py +83 -0
  171. mlx_one/models/embeddings/bert/model.py +206 -0
  172. mlx_one/models/embeddings/bert/weights.py +53 -0
  173. mlx_one/models/embeddings/lfm2_colbert/__init__.py +5 -0
  174. mlx_one/models/embeddings/lfm2_colbert/config.py +50 -0
  175. mlx_one/models/embeddings/lfm2_colbert/model.py +57 -0
  176. mlx_one/models/embeddings/lfm2_colbert/weights.py +25 -0
  177. mlx_one/models/embeddings/mpnet/__init__.py +5 -0
  178. mlx_one/models/embeddings/mpnet/config.py +122 -0
  179. mlx_one/models/embeddings/mpnet/model.py +231 -0
  180. mlx_one/models/embeddings/mpnet/weights.py +53 -0
  181. mlx_one/models/embeddings/qwen3_embedding/__init__.py +5 -0
  182. mlx_one/models/embeddings/qwen3_embedding/config.py +126 -0
  183. mlx_one/models/embeddings/qwen3_embedding/model.py +73 -0
  184. mlx_one/models/embeddings/qwen3_embedding/weights.py +18 -0
  185. mlx_one/models/embeddings/qwen3_reranker/__init__.py +5 -0
  186. mlx_one/models/embeddings/qwen3_reranker/config.py +83 -0
  187. mlx_one/models/embeddings/qwen3_reranker/model.py +58 -0
  188. mlx_one/models/embeddings/qwen3_reranker/weights.py +18 -0
  189. mlx_one/models/language/__init__.py +1 -0
  190. mlx_one/models/language/gemma3/UPSTREAM_LICENSE +24 -0
  191. mlx_one/models/language/gemma3/__init__.py +5 -0
  192. mlx_one/models/language/gemma3/config.py +109 -0
  193. mlx_one/models/language/gemma3/model.py +183 -0
  194. mlx_one/models/language/gemma3/weights.py +46 -0
  195. mlx_one/models/language/gpt2/__init__.py +5 -0
  196. mlx_one/models/language/gpt2/config.py +101 -0
  197. mlx_one/models/language/gpt2/model.py +188 -0
  198. mlx_one/models/language/gpt2/reference_math.py +62 -0
  199. mlx_one/models/language/gpt2/weights.py +64 -0
  200. mlx_one/models/language/gpt_oss/__init__.py +1 -0
  201. mlx_one/models/language/gpt_oss/config.py +182 -0
  202. mlx_one/models/language/gpt_oss/model.py +233 -0
  203. mlx_one/models/language/gpt_oss/weights.py +74 -0
  204. mlx_one/models/language/lfm2/__init__.py +5 -0
  205. mlx_one/models/language/lfm2/config.py +155 -0
  206. mlx_one/models/language/lfm2/model.py +125 -0
  207. mlx_one/models/language/lfm2/reference_math.py +179 -0
  208. mlx_one/models/language/lfm2/weights.py +78 -0
  209. mlx_one/models/language/lfm2_moe/__init__.py +5 -0
  210. mlx_one/models/language/lfm2_moe/config.py +114 -0
  211. mlx_one/models/language/lfm2_moe/model.py +193 -0
  212. mlx_one/models/language/lfm2_moe/weights.py +83 -0
  213. mlx_one/models/language/llama/__init__.py +5 -0
  214. mlx_one/models/language/llama/config.py +130 -0
  215. mlx_one/models/language/llama/model.py +92 -0
  216. mlx_one/models/language/llama/reference_math.py +136 -0
  217. mlx_one/models/language/llama/weights.py +55 -0
  218. mlx_one/models/language/openelm/__init__.py +5 -0
  219. mlx_one/models/language/openelm/config.py +200 -0
  220. mlx_one/models/language/openelm/model.py +226 -0
  221. mlx_one/models/language/openelm/weights.py +53 -0
  222. mlx_one/models/language/phi3/UPSTREAM_LICENSE +23 -0
  223. mlx_one/models/language/phi3/__init__.py +5 -0
  224. mlx_one/models/language/phi3/config.py +95 -0
  225. mlx_one/models/language/phi3/model.py +165 -0
  226. mlx_one/models/language/phi3/weights.py +37 -0
  227. mlx_one/models/language/qwen2/__init__.py +5 -0
  228. mlx_one/models/language/qwen2/config.py +104 -0
  229. mlx_one/models/language/qwen2/model.py +106 -0
  230. mlx_one/models/language/qwen2/reference_math.py +122 -0
  231. mlx_one/models/language/qwen2/weights.py +58 -0
  232. mlx_one/models/language/qwen2_moe/__init__.py +5 -0
  233. mlx_one/models/language/qwen2_moe/config.py +103 -0
  234. mlx_one/models/language/qwen2_moe/model.py +149 -0
  235. mlx_one/models/language/qwen2_moe/weights.py +95 -0
  236. mlx_one/models/language/qwen3/UPSTREAM_LICENSE +21 -0
  237. mlx_one/models/language/qwen3/__init__.py +5 -0
  238. mlx_one/models/language/qwen3/config.py +81 -0
  239. mlx_one/models/language/qwen3/model.py +98 -0
  240. mlx_one/models/language/qwen3/reference_math.py +123 -0
  241. mlx_one/models/language/qwen3/upstream_adapter.py +78 -0
  242. mlx_one/models/language/qwen3/upstream_math.py +49 -0
  243. mlx_one/models/language/qwen3/upstream_model.py +183 -0
  244. mlx_one/models/language/qwen3/weights.py +57 -0
  245. mlx_one/models/ocr/UPSTREAM.md +32 -0
  246. mlx_one/models/ocr/UPSTREAM_LICENSE +21 -0
  247. mlx_one/models/ocr/__init__.py +1 -0
  248. mlx_one/models/ocr/_layers.py +250 -0
  249. mlx_one/models/ocr/deepseek_ocr/__init__.py +1 -0
  250. mlx_one/models/ocr/deepseek_ocr/config.py +175 -0
  251. mlx_one/models/ocr/deepseek_ocr/language.py +508 -0
  252. mlx_one/models/ocr/deepseek_ocr/model.py +344 -0
  253. mlx_one/models/ocr/deepseek_ocr/sam.py +475 -0
  254. mlx_one/models/ocr/deepseek_ocr/vision.py +245 -0
  255. mlx_one/models/ocr/florence2/__init__.py +1 -0
  256. mlx_one/models/ocr/florence2/config.py +98 -0
  257. mlx_one/models/ocr/florence2/language.py +475 -0
  258. mlx_one/models/ocr/florence2/model.py +387 -0
  259. mlx_one/models/ocr/florence2/vision.py +514 -0
  260. mlx_one/models/ocr/got_ocr2/__init__.py +1 -0
  261. mlx_one/models/ocr/got_ocr2/config.py +113 -0
  262. mlx_one/models/ocr/got_ocr2/model.py +184 -0
  263. mlx_one/models/ocr/got_ocr2/vision.py +265 -0
  264. mlx_one/models/ocr/lightonocr/__init__.py +1 -0
  265. mlx_one/models/ocr/lightonocr/config.py +28 -0
  266. mlx_one/models/ocr/lightonocr/model.py +57 -0
  267. mlx_one/models/ocr/lightonocr/projector.py +192 -0
  268. mlx_one/models/ocr/lightonocr/vision.py +301 -0
  269. mlx_one/models/ocr/lightonocr/vision_config.py +71 -0
  270. mlx_one/models/ocr/paddleocr_vl/__init__.py +1 -0
  271. mlx_one/models/ocr/paddleocr_vl/config.py +94 -0
  272. mlx_one/models/ocr/paddleocr_vl/language.py +465 -0
  273. mlx_one/models/ocr/paddleocr_vl/model.py +216 -0
  274. mlx_one/models/ocr/paddleocr_vl/vision.py +457 -0
  275. mlx_one/models/ocr/provenance.json +95 -0
  276. mlx_one/models/ocr/trocr/__init__.py +1 -0
  277. mlx_one/models/ocr/trocr/config.py +34 -0
  278. mlx_one/models/ocr/trocr/model.py +199 -0
  279. mlx_one/models/registry.py +344 -0
  280. mlx_one/models/segmentation/__init__.py +1 -0
  281. mlx_one/models/segmentation/sam3/NOTICE.md +26 -0
  282. mlx_one/models/segmentation/sam3/__init__.py +1 -0
  283. mlx_one/models/segmentation/sam3/_configuration.py +67 -0
  284. mlx_one/models/segmentation/sam3/_runtime.py +1336 -0
  285. mlx_one/models/segmentation/sam3/config.py +722 -0
  286. mlx_one/models/segmentation/sam3/model.py +1665 -0
  287. mlx_one/models/segmentation/sam3/tracker.py +807 -0
  288. mlx_one/models/segmentation/sam3/tracker_video.py +2098 -0
  289. mlx_one/models/segmentation/sam3/video.py +1414 -0
  290. mlx_one/models/segmentation/sam3/weights.py +61 -0
  291. mlx_one/models/shared/__init__.py +43 -0
  292. mlx_one/models/shared/decoder.py +76 -0
  293. mlx_one/models/shared/encoder.py +54 -0
  294. mlx_one/models/shared/execution.py +80 -0
  295. mlx_one/models/shared/hybrid.py +180 -0
  296. mlx_one/models/shared/moe.py +80 -0
  297. mlx_one/models/shared/moe_decoder.py +77 -0
  298. mlx_one/models/shared/reference_activations.py +20 -0
  299. mlx_one/models/shared/reference_math.py +112 -0
  300. mlx_one/models/shared/sparse.py +80 -0
  301. mlx_one/models/shared/transformer.py +296 -0
  302. mlx_one/models/shared/vision.py +158 -0
  303. mlx_one/models/shared/vlm_weights.py +58 -0
  304. mlx_one/models/vision_language/UPSTREAM.md +25 -0
  305. mlx_one/models/vision_language/UPSTREAM_LICENSE +21 -0
  306. mlx_one/models/vision_language/__init__.py +1 -0
  307. mlx_one/models/vision_language/lfm2_vl/__init__.py +5 -0
  308. mlx_one/models/vision_language/lfm2_vl/config.py +133 -0
  309. mlx_one/models/vision_language/lfm2_vl/model.py +270 -0
  310. mlx_one/models/vision_language/lfm2_vl/weights.py +91 -0
  311. mlx_one/models/vision_language/qwen2_5_vl/__init__.py +5 -0
  312. mlx_one/models/vision_language/qwen2_5_vl/config.py +144 -0
  313. mlx_one/models/vision_language/qwen2_5_vl/model.py +251 -0
  314. mlx_one/models/vision_language/qwen2_5_vl/weights.py +86 -0
  315. mlx_one/models/vision_language/qwen2_vl/__init__.py +9 -0
  316. mlx_one/models/vision_language/qwen2_vl/config.py +176 -0
  317. mlx_one/models/vision_language/qwen2_vl/model.py +252 -0
  318. mlx_one/models/vision_language/qwen2_vl/weights.py +88 -0
  319. mlx_one/models/vision_language/qwen3_5/__init__.py +5 -0
  320. mlx_one/models/vision_language/qwen3_5/config.py +259 -0
  321. mlx_one/models/vision_language/qwen3_5/model.py +676 -0
  322. mlx_one/models/vision_language/qwen3_5/reference_delta.py +644 -0
  323. mlx_one/models/vision_language/qwen3_5/reference_math.py +86 -0
  324. mlx_one/models/vision_language/qwen3_5/weights.py +218 -0
  325. mlx_one/native_correctness.py +136 -0
  326. mlx_one/native_qualification.py +477 -0
  327. mlx_one/ocr/__init__.py +6 -0
  328. mlx_one/ocr/cli.py +86 -0
  329. mlx_one/ocr/documents.py +237 -0
  330. mlx_one/ocr/generation.py +209 -0
  331. mlx_one/ocr/loading.py +156 -0
  332. mlx_one/ocr/postprocessing.py +104 -0
  333. mlx_one/ocr/processing.py +251 -0
  334. mlx_one/ocr/public.py +179 -0
  335. mlx_one/ocr/registry.py +79 -0
  336. mlx_one/ocr/schemas.py +138 -0
  337. mlx_one/ocr/tokenizers.py +101 -0
  338. mlx_one/ops/__init__.py +1 -0
  339. mlx_one/ops/attention.py +233 -0
  340. mlx_one/ops/compiled.py +38 -0
  341. mlx_one/ops/logits.py +59 -0
  342. mlx_one/ops/numerical_trace.py +243 -0
  343. mlx_one/ops/profiling.py +37 -0
  344. mlx_one/ops/quantized_linear.py +46 -0
  345. mlx_one/ops/reference_tiled.py +107 -0
  346. mlx_one/p0_engine_qualification.py +592 -0
  347. mlx_one/p0_engine_worker.py +1119 -0
  348. mlx_one/p0_qualification.py +264 -0
  349. mlx_one/p1_benchmark.py +130 -0
  350. mlx_one/p1_decode.py +107 -0
  351. mlx_one/p1_profiles.py +119 -0
  352. mlx_one/p1_qualification.py +119 -0
  353. mlx_one/peak_calibration.py +116 -0
  354. mlx_one/planning.py +500 -0
  355. mlx_one/provenance.py +25 -0
  356. mlx_one/quality_dataset.py +312 -0
  357. mlx_one/quantization/__init__.py +1 -0
  358. mlx_one/quantization/turboquant/LICENSE.txt +201 -0
  359. mlx_one/quantization/turboquant/NOTICE.txt +70 -0
  360. mlx_one/quantization/turboquant/__init__.py +1 -0
  361. mlx_one/quantization/turboquant/config.py +105 -0
  362. mlx_one/quantization/turboquant/dispatch.py +35 -0
  363. mlx_one/quantization/turboquant/experts.py +41 -0
  364. mlx_one/quantization/turboquant/kernels/__init__.py +1 -0
  365. mlx_one/quantization/turboquant/kernels/tq3_expert_qmv.py +60 -0
  366. mlx_one/quantization/turboquant/kernels/tq3_gather_qmm.py +201 -0
  367. mlx_one/quantization/turboquant/kernels/tq3_qmm.py +184 -0
  368. mlx_one/quantization/turboquant/kernels/tq3_qmv.py +54 -0
  369. mlx_one/quantization/turboquant/linear.py +67 -0
  370. mlx_one/quantization/turboquant/loading.py +82 -0
  371. mlx_one/registry.py +419 -0
  372. mlx_one/retrieval/__init__.py +20 -0
  373. mlx_one/retrieval/loading.py +396 -0
  374. mlx_one/retrieval/schemas.py +45 -0
  375. mlx_one/retrieval/service.py +210 -0
  376. mlx_one/retrieval/tokenizer.py +294 -0
  377. mlx_one/run_store.py +68 -0
  378. mlx_one/runtime_baseline.py +278 -0
  379. mlx_one/schema_migrations.py +122 -0
  380. mlx_one/schemas.py +1310 -0
  381. mlx_one/segmentation/__init__.py +26 -0
  382. mlx_one/segmentation/cli.py +240 -0
  383. mlx_one/segmentation/export.py +55 -0
  384. mlx_one/segmentation/inference.py +215 -0
  385. mlx_one/segmentation/loading.py +121 -0
  386. mlx_one/segmentation/postprocessing.py +59 -0
  387. mlx_one/segmentation/processing.py +114 -0
  388. mlx_one/segmentation/resizing.py +31 -0
  389. mlx_one/segmentation/schemas.py +32 -0
  390. mlx_one/segmentation/video.py +468 -0
  391. mlx_one/server/__init__.py +25 -0
  392. mlx_one/server/admission.py +60 -0
  393. mlx_one/server/app.py +1104 -0
  394. mlx_one/server/audio.py +413 -0
  395. mlx_one/server/config.py +133 -0
  396. mlx_one/server/generation_engine.py +907 -0
  397. mlx_one/server/media.py +171 -0
  398. mlx_one/server/model_manager.py +326 -0
  399. mlx_one/server/ocr.py +143 -0
  400. mlx_one/server/scheduler.py +358 -0
  401. mlx_one/server/schemas.py +221 -0
  402. mlx_one/server/transcription.py +108 -0
  403. mlx_one/stress_qualification.py +257 -0
  404. mlx_one/task_qualification.py +348 -0
  405. mlx_one/task_qualification_worker.py +524 -0
  406. mlx_one/text/__init__.py +17 -0
  407. mlx_one/text/chat.py +168 -0
  408. mlx_one/text/generation.py +717 -0
  409. mlx_one/text/harmony.py +93 -0
  410. mlx_one/text/harmony_tools.py +513 -0
  411. mlx_one/text/loading.py +610 -0
  412. mlx_one/text/sampling.py +41 -0
  413. mlx_one/text/schemas.py +70 -0
  414. mlx_one/text/tokenizer.py +187 -0
  415. mlx_one/text/tokenizers.py +138 -0
  416. mlx_one/traffic_replay.py +210 -0
  417. mlx_one/training.py +651 -0
  418. mlx_one/tuning.py +233 -0
  419. mlx_one/ui/dist/THIRD_PARTY_NOTICES.txt +2941 -0
  420. mlx_one/ui/dist/_app/immutable/assets/0.g1PcYTVf.css +1 -0
  421. mlx_one/ui/dist/_app/immutable/assets/2.B8K-Evu6.css +1 -0
  422. mlx_one/ui/dist/_app/immutable/chunks/82h7flzh.js +1 -0
  423. mlx_one/ui/dist/_app/immutable/chunks/BauqED68.js +11 -0
  424. mlx_one/ui/dist/_app/immutable/chunks/Bij8Ok7U.js +1 -0
  425. mlx_one/ui/dist/_app/immutable/chunks/C8pA1lZh.js +1 -0
  426. mlx_one/ui/dist/_app/immutable/chunks/DUBjb0lT.js +48 -0
  427. mlx_one/ui/dist/_app/immutable/chunks/mo_kpY37.js +1 -0
  428. mlx_one/ui/dist/_app/immutable/chunks/qhmwaBmK.js +2 -0
  429. mlx_one/ui/dist/_app/immutable/chunks/wbPk3Yxo.js +81 -0
  430. mlx_one/ui/dist/_app/immutable/entry/app.QHeSwbD2.js +2 -0
  431. mlx_one/ui/dist/_app/immutable/entry/start.BA5nnLAR.js +1 -0
  432. mlx_one/ui/dist/_app/immutable/nodes/0.BdtHWFD4.js +1 -0
  433. mlx_one/ui/dist/_app/immutable/nodes/1.RemD7kSb.js +1 -0
  434. mlx_one/ui/dist/_app/immutable/nodes/2.C7Aq8Iat.js +65 -0
  435. mlx_one/ui/dist/_app/version.json +1 -0
  436. mlx_one/ui/dist/index.html +40 -0
  437. mlx_one/ui/dist/mlx-one-logo.png +0 -0
  438. mlx_one/utils/__init__.py +1 -0
  439. mlx_one/utils/checkpoint.py +70 -0
  440. mlx_one/utils/memory.py +127 -0
  441. mlx_one/utils/model_loader.py +200 -0
  442. mlx_one/vision/__init__.py +19 -0
  443. mlx_one/vision/generation.py +183 -0
  444. mlx_one/vision/images.py +55 -0
  445. mlx_one/vision/lfm_processing.py +221 -0
  446. mlx_one/vision/loading.py +183 -0
  447. mlx_one/vision/messages.py +69 -0
  448. mlx_one/vision/processing.py +232 -0
  449. mlx_one/vision/public.py +74 -0
  450. mlx_one/vision/schemas.py +11 -0
  451. mlx_one/workflow.py +294 -0
  452. mlx_one-0.1.0a1.dist-info/METADATA +1237 -0
  453. mlx_one-0.1.0a1.dist-info/RECORD +457 -0
  454. mlx_one-0.1.0a1.dist-info/WHEEL +5 -0
  455. mlx_one-0.1.0a1.dist-info/entry_points.txt +2 -0
  456. mlx_one-0.1.0a1.dist-info/licenses/LICENSE +201 -0
  457. mlx_one-0.1.0a1.dist-info/top_level.txt +1 -0
mlx_one/__init__.py ADDED
@@ -0,0 +1,181 @@
1
+ """Public package surface for mlx-one."""
2
+
3
+ from mlx_one.audio import (
4
+ AudioEngine,
5
+ AudioInput,
6
+ SpeechGenerationResult,
7
+ TranscriptionResult,
8
+ TranscriptionSegment,
9
+ TranscriptionWord,
10
+ WhisperDecodeOptions,
11
+ transcribe,
12
+ )
13
+ from mlx_one.compat.unsloth import FastLanguageModel
14
+ from mlx_one.engine.batching import BatchingConfig
15
+ from mlx_one.engine.cache_specs import CacheConfig
16
+ from mlx_one.engine.envelope import QualificationEnvelope
17
+ from mlx_one.engine.optimization_policy import NativeMathPolicy
18
+ from mlx_one.engine.pressure import MemoryPressureConfig
19
+ from mlx_one.engine.public import Engine, EngineRequestHandle
20
+ from mlx_one.hardware import (
21
+ HardwareProfileError,
22
+ detect_hardware,
23
+ list_hardware_profiles,
24
+ load_hardware_profile,
25
+ )
26
+ from mlx_one.inspection import InspectionError, inspect_model
27
+ from mlx_one.planning import PlanningError, estimate_memory, plan_inference, plan_training
28
+ from mlx_one.retrieval import (
29
+ EmbeddingResult,
30
+ LoadedRetrievalModel,
31
+ RerankItem,
32
+ RerankResult,
33
+ RetrievalModelLoadError,
34
+ embed,
35
+ load_retrieval_model,
36
+ rerank,
37
+ )
38
+ from mlx_one.schemas import (
39
+ SCHEMA_VERSION,
40
+ ArtifactRef,
41
+ CachePolicy,
42
+ CalibrationRecord,
43
+ CalibrationStatus,
44
+ CapabilityHint,
45
+ CapabilityHintStatus,
46
+ CapabilitySpec,
47
+ CapabilityStatus,
48
+ CheckpointMetadata,
49
+ CompatibilityResult,
50
+ CompatibilityStatus,
51
+ Confidence,
52
+ DatasetFormat,
53
+ DatasetLayout,
54
+ DatasetSpec,
55
+ Failure,
56
+ FitStatus,
57
+ HardwareSpec,
58
+ InspectionResult,
59
+ MemoryEstimate,
60
+ MetricProvenance,
61
+ MetricValue,
62
+ Modality,
63
+ ModelDimensions,
64
+ ModelSource,
65
+ ModelSpec,
66
+ Operation,
67
+ PlanResult,
68
+ Precision,
69
+ ResumeSemantics,
70
+ RunResult,
71
+ RunSpec,
72
+ RunStatus,
73
+ SoftwareProvenance,
74
+ TaskResult,
75
+ TrainConfig,
76
+ TrainingMethod,
77
+ WorkloadKind,
78
+ WorkloadSpec,
79
+ )
80
+ from mlx_one.text import (
81
+ GenerationChunk,
82
+ GenerationResult,
83
+ LoadedTextModel,
84
+ TextGenerationOptions,
85
+ TextModelLoadError,
86
+ generate,
87
+ load_text_model,
88
+ stream_chat,
89
+ stream_generate,
90
+ )
91
+ from mlx_one.training import SFTTrainer
92
+
93
+ __version__ = "0.1.0a1"
94
+
95
+ __all__ = [
96
+ "AudioEngine",
97
+ "AudioInput",
98
+ "SpeechGenerationResult",
99
+ "NativeMathPolicy",
100
+ "MemoryPressureConfig",
101
+ "QualificationEnvelope",
102
+ "SCHEMA_VERSION",
103
+ "ArtifactRef",
104
+ "CachePolicy",
105
+ "CacheConfig",
106
+ "BatchingConfig",
107
+ "CapabilitySpec",
108
+ "CapabilityStatus",
109
+ "CapabilityHint",
110
+ "CapabilityHintStatus",
111
+ "CalibrationRecord",
112
+ "CalibrationStatus",
113
+ "CompatibilityResult",
114
+ "CompatibilityStatus",
115
+ "CheckpointMetadata",
116
+ "Confidence",
117
+ "Failure",
118
+ "FitStatus",
119
+ "GenerationChunk",
120
+ "GenerationResult",
121
+ "DatasetFormat",
122
+ "DatasetLayout",
123
+ "DatasetSpec",
124
+ "EmbeddingResult",
125
+ "Engine",
126
+ "EngineRequestHandle",
127
+ "MetricProvenance",
128
+ "MetricValue",
129
+ "HardwareSpec",
130
+ "HardwareProfileError",
131
+ "InspectionError",
132
+ "InspectionResult",
133
+ "MemoryEstimate",
134
+ "Modality",
135
+ "ModelSource",
136
+ "ModelDimensions",
137
+ "ModelSpec",
138
+ "LoadedTextModel",
139
+ "LoadedRetrievalModel",
140
+ "Operation",
141
+ "PlanResult",
142
+ "PlanningError",
143
+ "Precision",
144
+ "ResumeSemantics",
145
+ "RunResult",
146
+ "RunSpec",
147
+ "RunStatus",
148
+ "RerankItem",
149
+ "RerankResult",
150
+ "RetrievalModelLoadError",
151
+ "SoftwareProvenance",
152
+ "TaskResult",
153
+ "TextGenerationOptions",
154
+ "TextModelLoadError",
155
+ "TrainingMethod",
156
+ "TranscriptionResult",
157
+ "TranscriptionSegment",
158
+ "TranscriptionWord",
159
+ "TrainConfig",
160
+ "FastLanguageModel",
161
+ "SFTTrainer",
162
+ "WorkloadKind",
163
+ "WorkloadSpec",
164
+ "WhisperDecodeOptions",
165
+ "__version__",
166
+ "inspect_model",
167
+ "detect_hardware",
168
+ "estimate_memory",
169
+ "embed",
170
+ "generate",
171
+ "list_hardware_profiles",
172
+ "load_hardware_profile",
173
+ "load_retrieval_model",
174
+ "load_text_model",
175
+ "plan_inference",
176
+ "plan_training",
177
+ "rerank",
178
+ "transcribe",
179
+ "stream_generate",
180
+ "stream_chat",
181
+ ]
@@ -0,0 +1,50 @@
1
+ """Native audio services; importing this namespace does not initialize MLX."""
2
+
3
+ from mlx_one.audio.loading import AudioModelLoadError, load_audio_model
4
+ from mlx_one.audio.qwen import align_audio
5
+ from mlx_one.audio.schemas import (
6
+ AlignmentUnit,
7
+ ASRDecodeOptions,
8
+ AudioAlignment,
9
+ AudioStreamEvent,
10
+ QwenASROptions,
11
+ SpeechTranscript,
12
+ TranscriptionResult,
13
+ TranscriptionSegment,
14
+ TranscriptionWord,
15
+ WhisperDecodeOptions,
16
+ )
17
+ from mlx_one.audio.service import transcribe
18
+ from mlx_one.audio.streaming import open_audio_stream
19
+
20
+ __all__ = [
21
+ "ASRDecodeOptions",
22
+ "QwenASROptions",
23
+ "AlignmentUnit",
24
+ "AudioAlignment",
25
+ "AudioStreamEvent",
26
+ "SpeechTranscript",
27
+ "AudioModelLoadError",
28
+ "TranscriptionResult",
29
+ "TranscriptionSegment",
30
+ "TranscriptionWord",
31
+ "WhisperDecodeOptions",
32
+ "load_audio_model",
33
+ "transcribe",
34
+ "align_audio",
35
+ "open_audio_stream",
36
+ ]
37
+
38
+ from mlx_one.audio.input import AudioInput
39
+ from mlx_one.audio.public import AudioEngine
40
+ from mlx_one.audio.schemas import SpeechGenerationResult, SpeechStreamEvent
41
+
42
+
43
+ def generate_speech(*args, **kwargs):
44
+ from mlx_one.audio.lfm import generate_speech as generate
45
+
46
+ return generate(*args, **kwargs)
47
+
48
+
49
+ __all__ += ["AudioEngine", "AudioInput", "SpeechGenerationResult", "SpeechStreamEvent",
50
+ "generate_speech"]
mlx_one/audio/cli.py ADDED
@@ -0,0 +1,133 @@
1
+ """Audio CLI subcommands; all inference uses the existing managed task service."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import json
6
+ from pathlib import Path
7
+
8
+ import click
9
+
10
+ from mlx_one.audio.public import AudioEngine
11
+
12
+
13
+ @click.group("audio")
14
+ def audio_group():
15
+ """Native transcription, alignment and speech generation."""
16
+
17
+
18
+ def common(function):
19
+ for decorator in reversed(
20
+ [
21
+ click.option("--model", required=True, help="Local checkpoint directory or Hub ID."),
22
+ click.option("--revision"),
23
+ click.option("--offline", is_flag=True),
24
+ click.option("--cache-dir", type=click.Path(file_okay=False)),
25
+ ]
26
+ ):
27
+ function = decorator(function)
28
+ return function
29
+
30
+
31
+ def emit(result, output):
32
+ content = json.dumps(result.to_dict(), indent=2, ensure_ascii=False) + "\n"
33
+ if output:
34
+ with Path(output).open("x", encoding="utf-8") as handle:
35
+ handle.write(content)
36
+ else:
37
+ click.echo(content, nl=False)
38
+
39
+
40
+ @audio_group.command("transcribe")
41
+ @common
42
+ @click.option("--audio", required=True, type=click.Path(exists=True, dir_okay=False))
43
+ @click.option("--language")
44
+ @click.option("--word-timestamps", is_flag=True)
45
+ @click.option("--stream", is_flag=True, help="Qwen accumulated utterance, maximum 30 seconds.")
46
+ @click.option("--output", type=click.Path(dir_okay=False))
47
+ def transcribe_command(
48
+ model, revision, offline, cache_dir, audio, language, word_timestamps, stream, output
49
+ ):
50
+ try:
51
+ if output and Path(output).exists():
52
+ raise ValueError("output already exists")
53
+ with AudioEngine(model, revision=revision, offline=offline, cache_dir=cache_dir) as engine:
54
+ if stream:
55
+ if word_timestamps or output:
56
+ raise ValueError("stream emits NDJSON to stdout; timestamps/output unsupported")
57
+ from mlx_one.audio.input import prepare_audio
58
+
59
+ pcm = prepare_audio(audio, max_seconds=30)
60
+ for event in engine.stream_transcribe(
61
+ (pcm[i : i + 32000] for i in range(0, len(pcm), 32000)), language=language
62
+ ):
63
+ click.echo(event.to_json())
64
+ else:
65
+ emit(
66
+ engine.transcribe(audio, language=language, word_timestamps=word_timestamps),
67
+ output,
68
+ )
69
+ except (OSError, ValueError, RuntimeError) as exc:
70
+ raise click.ClickException(str(exc)) from exc
71
+
72
+
73
+ @audio_group.command("align")
74
+ @common
75
+ @click.option("--audio", required=True, type=click.Path(exists=True, dir_okay=False))
76
+ @click.option("--text", required=True)
77
+ @click.option("--language", required=True)
78
+ @click.option("--output", type=click.Path(dir_okay=False))
79
+ def align_command(model, revision, offline, cache_dir, audio, text, language, output):
80
+ try:
81
+ if output and Path(output).exists():
82
+ raise ValueError("output already exists")
83
+ with AudioEngine(model, revision=revision, offline=offline, cache_dir=cache_dir) as engine:
84
+ emit(engine.align(audio, text, language=language), output)
85
+ except (OSError, ValueError, RuntimeError) as exc:
86
+ raise click.ClickException(str(exc)) from exc
87
+
88
+
89
+ @audio_group.command("speak")
90
+ @common
91
+ @click.option("--text", default="")
92
+ @click.option(
93
+ "--audio",
94
+ type=click.Path(exists=True, dir_okay=False),
95
+ help="Use interleaved speech-to-speech instead of TTS.",
96
+ )
97
+ @click.option(
98
+ "--voice",
99
+ type=click.Choice(["us_male", "us_female", "uk_male", "uk_female"]),
100
+ default="us_male",
101
+ )
102
+ @click.option("--max-tokens", type=click.IntRange(min=1, max=4096), default=1024)
103
+ @click.option("--format", type=click.Choice(["wav", "pcm"]), default="wav")
104
+ @click.option("--output", required=True, type=click.Path(dir_okay=False))
105
+ def speak_command(
106
+ model, revision, offline, cache_dir, text, audio, voice, max_tokens, format, output
107
+ ):
108
+ try:
109
+ if Path(output).exists():
110
+ raise ValueError("output already exists")
111
+ if bool(text.strip()) == bool(audio):
112
+ raise ValueError("provide either --text (TTS) or --audio (speech-to-speech)")
113
+ with AudioEngine(model, revision=revision, offline=offline, cache_dir=cache_dir) as engine:
114
+ result = (
115
+ engine.speech_to_speech(audio, max_tokens=max_tokens)
116
+ if audio
117
+ else engine.generate_speech(text, voice=voice, max_tokens=max_tokens)
118
+ )
119
+ result.save(output, format=format)
120
+ click.echo(json.dumps(result.to_dict(), ensure_ascii=False))
121
+ except (OSError, ValueError, RuntimeError) as exc:
122
+ raise click.ClickException(str(exc)) from exc
123
+
124
+
125
+ @audio_group.command("detect-language")
126
+ @common
127
+ @click.option("--audio", required=True, type=click.Path(exists=True, dir_okay=False))
128
+ def detect_language_command(model, revision, offline, cache_dir, audio):
129
+ try:
130
+ with AudioEngine(model, revision=revision, offline=offline, cache_dir=cache_dir) as engine:
131
+ click.echo(json.dumps(engine.detect_language(audio), ensure_ascii=False))
132
+ except (OSError, ValueError, RuntimeError) as exc:
133
+ raise click.ClickException(str(exc)) from exc