fusion-mlx 0.7.3__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 (925) hide show
  1. fusion_mlx/__init__.py +81 -0
  2. fusion_mlx/__main__.py +5 -0
  3. fusion_mlx/_cli_base.py +686 -0
  4. fusion_mlx/_completion.py +133 -0
  5. fusion_mlx/_download_gate.py +18 -0
  6. fusion_mlx/_mirror.py +1645 -0
  7. fusion_mlx/_mlx_compat.py +128 -0
  8. fusion_mlx/_parent_watchdog.py +244 -0
  9. fusion_mlx/_seeded_sampler.py +357 -0
  10. fusion_mlx/_signal_observability.py +151 -0
  11. fusion_mlx/_tempfile_safe.py +144 -0
  12. fusion_mlx/_torch_stub.py +934 -0
  13. fusion_mlx/_version.py +1 -0
  14. fusion_mlx/_version_check.py +18 -0
  15. fusion_mlx/adapter/__init__.py +1 -0
  16. fusion_mlx/adapter/gemma4.py +5 -0
  17. fusion_mlx/adapter/harmony.py +5 -0
  18. fusion_mlx/admin/__init__.py +5 -0
  19. fusion_mlx/admin/accuracy_bench.py +201 -0
  20. fusion_mlx/admin/accuracy_benchmark.py +68 -0
  21. fusion_mlx/admin/auth.py +213 -0
  22. fusion_mlx/admin/auth_routes.py +261 -0
  23. fusion_mlx/admin/bench.py +263 -0
  24. fusion_mlx/admin/benchmark.py +994 -0
  25. fusion_mlx/admin/canvas_routes.py +123 -0
  26. fusion_mlx/admin/fine_tune_route.py +309 -0
  27. fusion_mlx/admin/grammar_route.py +105 -0
  28. fusion_mlx/admin/helpers.py +913 -0
  29. fusion_mlx/admin/hf_download.py +419 -0
  30. fusion_mlx/admin/hf_downloader.py +1046 -0
  31. fusion_mlx/admin/hf_upload.py +117 -0
  32. fusion_mlx/admin/hf_uploader.py +557 -0
  33. fusion_mlx/admin/html_routes.py +121 -0
  34. fusion_mlx/admin/i18n/en.json +803 -0
  35. fusion_mlx/admin/i18n/es.json +771 -0
  36. fusion_mlx/admin/i18n/fr.json +771 -0
  37. fusion_mlx/admin/i18n/ja.json +771 -0
  38. fusion_mlx/admin/i18n/ko.json +771 -0
  39. fusion_mlx/admin/i18n/pt-BR.json +771 -0
  40. fusion_mlx/admin/i18n/ru.json +771 -0
  41. fusion_mlx/admin/i18n/zh-TW.json +771 -0
  42. fusion_mlx/admin/i18n/zh.json +803 -0
  43. fusion_mlx/admin/logs.py +167 -0
  44. fusion_mlx/admin/migrate_route.py +387 -0
  45. fusion_mlx/admin/model_manager_route.py +189 -0
  46. fusion_mlx/admin/models.py +313 -0
  47. fusion_mlx/admin/models_route.py +987 -0
  48. fusion_mlx/admin/ms_download.py +223 -0
  49. fusion_mlx/admin/ms_downloader.py +1095 -0
  50. fusion_mlx/admin/oq.py +259 -0
  51. fusion_mlx/admin/oq_manager.py +692 -0
  52. fusion_mlx/admin/preset.py +166 -0
  53. fusion_mlx/admin/profile.py +240 -0
  54. fusion_mlx/admin/routes.py +145 -0
  55. fusion_mlx/admin/settings.py +1241 -0
  56. fusion_mlx/admin/static/css/dashboard.css +238 -0
  57. fusion_mlx/admin/static/css/fonts/KaTeX_AMS-Regular.ttf +0 -0
  58. fusion_mlx/admin/static/css/fonts/KaTeX_AMS-Regular.woff2 +0 -0
  59. fusion_mlx/admin/static/css/fonts/KaTeX_Caligraphic-Bold.ttf +0 -0
  60. fusion_mlx/admin/static/css/fonts/KaTeX_Caligraphic-Bold.woff2 +0 -0
  61. fusion_mlx/admin/static/css/fonts/KaTeX_Caligraphic-Regular.ttf +0 -0
  62. fusion_mlx/admin/static/css/fonts/KaTeX_Caligraphic-Regular.woff2 +0 -0
  63. fusion_mlx/admin/static/css/fonts/KaTeX_Fraktur-Bold.ttf +0 -0
  64. fusion_mlx/admin/static/css/fonts/KaTeX_Fraktur-Bold.woff2 +0 -0
  65. fusion_mlx/admin/static/css/fonts/KaTeX_Fraktur-Regular.ttf +0 -0
  66. fusion_mlx/admin/static/css/fonts/KaTeX_Fraktur-Regular.woff2 +0 -0
  67. fusion_mlx/admin/static/css/fonts/KaTeX_Main-Bold.ttf +0 -0
  68. fusion_mlx/admin/static/css/fonts/KaTeX_Main-Bold.woff2 +0 -0
  69. fusion_mlx/admin/static/css/fonts/KaTeX_Main-BoldItalic.ttf +0 -0
  70. fusion_mlx/admin/static/css/fonts/KaTeX_Main-BoldItalic.woff2 +0 -0
  71. fusion_mlx/admin/static/css/fonts/KaTeX_Main-Italic.ttf +0 -0
  72. fusion_mlx/admin/static/css/fonts/KaTeX_Main-Italic.woff2 +0 -0
  73. fusion_mlx/admin/static/css/fonts/KaTeX_Main-Regular.ttf +0 -0
  74. fusion_mlx/admin/static/css/fonts/KaTeX_Main-Regular.woff2 +0 -0
  75. fusion_mlx/admin/static/css/fonts/KaTeX_Math-BoldItalic.ttf +0 -0
  76. fusion_mlx/admin/static/css/fonts/KaTeX_Math-BoldItalic.woff2 +0 -0
  77. fusion_mlx/admin/static/css/fonts/KaTeX_Math-Italic.ttf +0 -0
  78. fusion_mlx/admin/static/css/fonts/KaTeX_Math-Italic.woff2 +0 -0
  79. fusion_mlx/admin/static/css/fonts/KaTeX_SansSerif-Bold.ttf +0 -0
  80. fusion_mlx/admin/static/css/fonts/KaTeX_SansSerif-Bold.woff2 +0 -0
  81. fusion_mlx/admin/static/css/fonts/KaTeX_SansSerif-Italic.ttf +0 -0
  82. fusion_mlx/admin/static/css/fonts/KaTeX_SansSerif-Italic.woff2 +0 -0
  83. fusion_mlx/admin/static/css/fonts/KaTeX_SansSerif-Regular.ttf +0 -0
  84. fusion_mlx/admin/static/css/fonts/KaTeX_SansSerif-Regular.woff2 +0 -0
  85. fusion_mlx/admin/static/css/fonts/KaTeX_Script-Regular.ttf +0 -0
  86. fusion_mlx/admin/static/css/fonts/KaTeX_Script-Regular.woff2 +0 -0
  87. fusion_mlx/admin/static/css/fonts/KaTeX_Size1-Regular.ttf +0 -0
  88. fusion_mlx/admin/static/css/fonts/KaTeX_Size1-Regular.woff2 +0 -0
  89. fusion_mlx/admin/static/css/fonts/KaTeX_Size2-Regular.ttf +0 -0
  90. fusion_mlx/admin/static/css/fonts/KaTeX_Size2-Regular.woff2 +0 -0
  91. fusion_mlx/admin/static/css/fonts/KaTeX_Size3-Regular.ttf +0 -0
  92. fusion_mlx/admin/static/css/fonts/KaTeX_Size3-Regular.woff2 +0 -0
  93. fusion_mlx/admin/static/css/fonts/KaTeX_Size4-Regular.ttf +0 -0
  94. fusion_mlx/admin/static/css/fonts/KaTeX_Size4-Regular.woff2 +0 -0
  95. fusion_mlx/admin/static/css/fonts/KaTeX_Typewriter-Regular.ttf +0 -0
  96. fusion_mlx/admin/static/css/fonts/KaTeX_Typewriter-Regular.woff2 +0 -0
  97. fusion_mlx/admin/static/css/hljs-github-dark.min.css +10 -0
  98. fusion_mlx/admin/static/css/hljs-github.min.css +10 -0
  99. fusion_mlx/admin/static/css/katex.min.css +1 -0
  100. fusion_mlx/admin/static/css/tailwind.css +1 -0
  101. fusion_mlx/admin/static/favicon.svg +30 -0
  102. fusion_mlx/admin/static/fonts/inter/inter-latin-300-normal.woff2 +0 -0
  103. fusion_mlx/admin/static/fonts/inter/inter-latin-400-normal.woff2 +0 -0
  104. fusion_mlx/admin/static/fonts/inter/inter-latin-500-normal.woff2 +0 -0
  105. fusion_mlx/admin/static/fonts/inter/inter-latin-600-normal.woff2 +0 -0
  106. fusion_mlx/admin/static/fonts/inter/inter-latin-700-normal.woff2 +0 -0
  107. fusion_mlx/admin/static/fonts/inter/inter-latin-800-normal.woff2 +0 -0
  108. fusion_mlx/admin/static/fonts/inter/inter.css +65 -0
  109. fusion_mlx/admin/static/fonts/noto-sans-jp/NotoSansJP-Bold.woff2 +0 -0
  110. fusion_mlx/admin/static/fonts/noto-sans-jp/NotoSansJP-Medium.woff2 +0 -0
  111. fusion_mlx/admin/static/fonts/noto-sans-jp/NotoSansJP-Regular.woff2 +0 -0
  112. fusion_mlx/admin/static/fonts/noto-sans-jp/noto-sans-jp.css +22 -0
  113. fusion_mlx/admin/static/fonts/noto-sans-kr/NotoSansKR-Bold.woff2 +0 -0
  114. fusion_mlx/admin/static/fonts/noto-sans-kr/NotoSansKR-Medium.woff2 +0 -0
  115. fusion_mlx/admin/static/fonts/noto-sans-kr/NotoSansKR-Regular.woff2 +0 -0
  116. fusion_mlx/admin/static/fonts/noto-sans-kr/noto-sans-kr.css +22 -0
  117. fusion_mlx/admin/static/fonts/noto-sans-sc/NotoSansSC-Bold.woff2 +0 -0
  118. fusion_mlx/admin/static/fonts/noto-sans-sc/NotoSansSC-Medium.woff2 +0 -0
  119. fusion_mlx/admin/static/fonts/noto-sans-sc/NotoSansSC-Regular.woff2 +0 -0
  120. fusion_mlx/admin/static/fonts/noto-sans-sc/noto-sans-sc.css +22 -0
  121. fusion_mlx/admin/static/fonts/noto-sans-tc/NotoSansTC-Bold.woff2 +0 -0
  122. fusion_mlx/admin/static/fonts/noto-sans-tc/NotoSansTC-Medium.woff2 +0 -0
  123. fusion_mlx/admin/static/fonts/noto-sans-tc/NotoSansTC-Regular.woff2 +0 -0
  124. fusion_mlx/admin/static/fonts/noto-sans-tc/noto-sans-tc.css +22 -0
  125. fusion_mlx/admin/static/fusionmlx_preset.json +119 -0
  126. fusion_mlx/admin/static/img/integrations/claude.png +0 -0
  127. fusion_mlx/admin/static/img/integrations/codex.png +0 -0
  128. fusion_mlx/admin/static/img/integrations/copilot.svg +22 -0
  129. fusion_mlx/admin/static/img/integrations/hermes.svg +13 -0
  130. fusion_mlx/admin/static/img/integrations/openclaw.png +0 -0
  131. fusion_mlx/admin/static/img/integrations/opencode.png +0 -0
  132. fusion_mlx/admin/static/img/integrations/pi.svg +29 -0
  133. fusion_mlx/admin/static/js/alpine.min.js +5 -0
  134. fusion_mlx/admin/static/js/canvas.js +483 -0
  135. fusion_mlx/admin/static/js/dashboard.js +5362 -0
  136. fusion_mlx/admin/static/js/highlight.min.js +1213 -0
  137. fusion_mlx/admin/static/js/hljs-bash.min.js +20 -0
  138. fusion_mlx/admin/static/js/hljs-javascript.min.js +80 -0
  139. fusion_mlx/admin/static/js/hljs-json.min.js +7 -0
  140. fusion_mlx/admin/static/js/hljs-python.min.js +41 -0
  141. fusion_mlx/admin/static/js/katex-auto-render.min.js +1 -0
  142. fusion_mlx/admin/static/js/katex.min.js +1 -0
  143. fusion_mlx/admin/static/js/lucide.min.js +12 -0
  144. fusion_mlx/admin/static/js/marked-highlight.umd.js +96 -0
  145. fusion_mlx/admin/static/js/marked.umd.js +2449 -0
  146. fusion_mlx/admin/static/js/purify.min.js +3 -0
  147. fusion_mlx/admin/static/logo-dark.svg +36 -0
  148. fusion_mlx/admin/static/logo-light.svg +24 -0
  149. fusion_mlx/admin/static/menubar-filled.svg +25 -0
  150. fusion_mlx/admin/static/menubar-outline.svg +31 -0
  151. fusion_mlx/admin/static/navbar-logo-dark.svg +25 -0
  152. fusion_mlx/admin/static/navbar-logo-light.svg +19 -0
  153. fusion_mlx/admin/stats.py +1046 -0
  154. fusion_mlx/admin/subkey.py +102 -0
  155. fusion_mlx/admin/templates/base.html +168 -0
  156. fusion_mlx/admin/templates/canvas.html +192 -0
  157. fusion_mlx/admin/templates/chat.html +6146 -0
  158. fusion_mlx/admin/templates/dashboard/_bench.html +488 -0
  159. fusion_mlx/admin/templates/dashboard/_bench_accuracy.html +326 -0
  160. fusion_mlx/admin/templates/dashboard/_fine_tune.html +274 -0
  161. fusion_mlx/admin/templates/dashboard/_logs.html +117 -0
  162. fusion_mlx/admin/templates/dashboard/_modal_model_settings.html +1023 -0
  163. fusion_mlx/admin/templates/dashboard/_models.html +2067 -0
  164. fusion_mlx/admin/templates/dashboard/_navbar.html +392 -0
  165. fusion_mlx/admin/templates/dashboard/_settings.html +1315 -0
  166. fusion_mlx/admin/templates/dashboard/_status.html +971 -0
  167. fusion_mlx/admin/templates/dashboard.html +99 -0
  168. fusion_mlx/admin/templates/login.html +328 -0
  169. fusion_mlx/admin/update_check.py +107 -0
  170. fusion_mlx/agents/__init__.py +13 -0
  171. fusion_mlx/agents/adapter.py +18 -0
  172. fusion_mlx/agents/testing.py +15 -0
  173. fusion_mlx/aliases.json +727 -0
  174. fusion_mlx/api/__init__.py +231 -0
  175. fusion_mlx/api/_anthropic_helpers.py +302 -0
  176. fusion_mlx/api/_guards.py +97 -0
  177. fusion_mlx/api/_url_safety.py +136 -0
  178. fusion_mlx/api/adapters/__init__.py +38 -0
  179. fusion_mlx/api/adapters/anthropic.py +227 -0
  180. fusion_mlx/api/adapters/base.py +207 -0
  181. fusion_mlx/api/adapters/openai.py +254 -0
  182. fusion_mlx/api/adapters/sse_formatter.py +106 -0
  183. fusion_mlx/api/agent_routes.py +326 -0
  184. fusion_mlx/api/analyze_routes.py +261 -0
  185. fusion_mlx/api/anthropic_adapter.py +413 -0
  186. fusion_mlx/api/anthropic_models.py +386 -0
  187. fusion_mlx/api/anthropic_routes.py +876 -0
  188. fusion_mlx/api/anthropic_utils.py +1223 -0
  189. fusion_mlx/api/audio_models.py +55 -0
  190. fusion_mlx/api/audio_routes.py +685 -0
  191. fusion_mlx/api/bench_routes.py +117 -0
  192. fusion_mlx/api/constants.py +14 -0
  193. fusion_mlx/api/context_scaling.py +66 -0
  194. fusion_mlx/api/convert_models.py +96 -0
  195. fusion_mlx/api/convert_routes.py +175 -0
  196. fusion_mlx/api/embedding_models.py +127 -0
  197. fusion_mlx/api/embedding_utils.py +152 -0
  198. fusion_mlx/api/embeddings_routes.py +205 -0
  199. fusion_mlx/api/grammar.py +518 -0
  200. fusion_mlx/api/guided.py +282 -0
  201. fusion_mlx/api/harmony_tools.py +109 -0
  202. fusion_mlx/api/images.py +178 -0
  203. fusion_mlx/api/layered_quantize_routes.py +222 -0
  204. fusion_mlx/api/markitdown.py +859 -0
  205. fusion_mlx/api/markitdown_pdf_fallback.py +261 -0
  206. fusion_mlx/api/mcp_routes.py +117 -0
  207. fusion_mlx/api/migration_routes.py +186 -0
  208. fusion_mlx/api/models.py +857 -0
  209. fusion_mlx/api/ner_models.py +64 -0
  210. fusion_mlx/api/ner_routes.py +112 -0
  211. fusion_mlx/api/ocr_routes.py +225 -0
  212. fusion_mlx/api/ollama_routes.py +489 -0
  213. fusion_mlx/api/openai_models.py +568 -0
  214. fusion_mlx/api/openai_routes.py +1572 -0
  215. fusion_mlx/api/openclaw_routes.py +524 -0
  216. fusion_mlx/api/reasoning_routes.py +134 -0
  217. fusion_mlx/api/recommend_batch_routes.py +191 -0
  218. fusion_mlx/api/recommend_routes.py +106 -0
  219. fusion_mlx/api/rerank_models.py +96 -0
  220. fusion_mlx/api/rerank_routes.py +132 -0
  221. fusion_mlx/api/response_format_metrics.py +137 -0
  222. fusion_mlx/api/responses_adapter.py +643 -0
  223. fusion_mlx/api/responses_models.py +264 -0
  224. fusion_mlx/api/responses_utils.py +694 -0
  225. fusion_mlx/api/session_routes.py +131 -0
  226. fusion_mlx/api/shared_models.py +81 -0
  227. fusion_mlx/api/spec_routes.py +159 -0
  228. fusion_mlx/api/streaming.py +200 -0
  229. fusion_mlx/api/strict_json_schema.py +654 -0
  230. fusion_mlx/api/thinking.py +397 -0
  231. fusion_mlx/api/tool_calling.py +1643 -0
  232. fusion_mlx/api/tool_logits.py +448 -0
  233. fusion_mlx/api/utils.py +1620 -0
  234. fusion_mlx/api/videos_routes.py +423 -0
  235. fusion_mlx/audio/__init__.py +21 -0
  236. fusion_mlx/audio/probe.py +235 -0
  237. fusion_mlx/audio/processor.py +140 -0
  238. fusion_mlx/audio/registry.py +119 -0
  239. fusion_mlx/audio/stt.py +376 -0
  240. fusion_mlx/audio/tts.py +322 -0
  241. fusion_mlx/bench/__init__.py +9 -0
  242. fusion_mlx/bench/tier_runner.py +11 -0
  243. fusion_mlx/cache/__init__.py +192 -0
  244. fusion_mlx/cache/_rotating_subclass.py +42 -0
  245. fusion_mlx/cache/boundary_snapshot_store.py +1453 -0
  246. fusion_mlx/cache/factory.py +252 -0
  247. fusion_mlx/cache/hybrid_cache.py +344 -0
  248. fusion_mlx/cache/interface.py +45 -0
  249. fusion_mlx/cache/latent_cache.py +136 -0
  250. fusion_mlx/cache/mllm_cache.py +500 -0
  251. fusion_mlx/cache/observability.py +147 -0
  252. fusion_mlx/cache/paged_cache.py +1817 -0
  253. fusion_mlx/cache/paged_ssd_cache.py +2087 -0
  254. fusion_mlx/cache/prefix_cache.py +2858 -0
  255. fusion_mlx/cache/protocol.py +169 -0
  256. fusion_mlx/cache/radix_diffusion_cache.py +349 -0
  257. fusion_mlx/cache/recovery.py +128 -0
  258. fusion_mlx/cache/response_cache.py +282 -0
  259. fusion_mlx/cache/stats.py +161 -0
  260. fusion_mlx/cache/tiered_cache.py +279 -0
  261. fusion_mlx/cache/type_handlers.py +1391 -0
  262. fusion_mlx/cache/type_registry.py +243 -0
  263. fusion_mlx/cache/vision_embedding_cache.py +411 -0
  264. fusion_mlx/cache/vision_feature_cache.py +512 -0
  265. fusion_mlx/cli.py +2100 -0
  266. fusion_mlx/cli_commands.py +2410 -0
  267. fusion_mlx/cli_convert.py +150 -0
  268. fusion_mlx/cli_lifecycle.py +141 -0
  269. fusion_mlx/cli_serve.py +2858 -0
  270. fusion_mlx/cluster/__init__.py +0 -0
  271. fusion_mlx/cluster/mdns.py +121 -0
  272. fusion_mlx/community_bench/__init__.py +2 -0
  273. fusion_mlx/community_bench/hardware.py +18 -0
  274. fusion_mlx/community_bench/runner.py +14 -0
  275. fusion_mlx/community_bench/submission.py +18 -0
  276. fusion_mlx/compatibility.py +181 -0
  277. fusion_mlx/config.py +388 -0
  278. fusion_mlx/custom_kernels/__init__.py +10 -0
  279. fusion_mlx/custom_kernels/flash_kda/__init__.py +74 -0
  280. fusion_mlx/custom_kernels/flash_kda/metal_kernels.py +88 -0
  281. fusion_mlx/custom_kernels/flash_kda/reference.py +126 -0
  282. fusion_mlx/custom_kernels/fp8_linear.py +162 -0
  283. fusion_mlx/custom_kernels/glm_moe_dsa/__init__.py +5 -0
  284. fusion_mlx/custom_kernels/glm_moe_dsa/fast.py +258 -0
  285. fusion_mlx/custom_kernels/mfa/__init__.py +111 -0
  286. fusion_mlx/custom_kernels/mfa/attention.py +283 -0
  287. fusion_mlx/custom_kernels/mfa/compile_metallib.py +158 -0
  288. fusion_mlx/custom_kernels/mfa/dispatch_policy.py +251 -0
  289. fusion_mlx/custom_kernels/mfa/distributed/__init__.py +129 -0
  290. fusion_mlx/custom_kernels/mfa/fp8_linear.py +177 -0
  291. fusion_mlx/custom_kernels/mfa/kv_cache.py +222 -0
  292. fusion_mlx/custom_kernels/mfa/masks.py +111 -0
  293. fusion_mlx/custom_kernels/mfa/quantize.py +208 -0
  294. fusion_mlx/custom_kernels/mfa/sparse_video_attention.py +198 -0
  295. fusion_mlx/custom_kernels/mfa/turboquant.py +141 -0
  296. fusion_mlx/custom_kernels/mfa/video_attention.py +253 -0
  297. fusion_mlx/custom_kernels/mfa_bridge.py +248 -0
  298. fusion_mlx/custom_kernels/nvfp4.py +179 -0
  299. fusion_mlx/custom_kernels/phase_c/__init__.py +113 -0
  300. fusion_mlx/custom_kernels/phase_c/glm_moe_ffn.py +82 -0
  301. fusion_mlx/custom_kernels/phase_c/w4a8_dispatch.py +50 -0
  302. fusion_mlx/custom_kernels/quantize.py +69 -0
  303. fusion_mlx/custom_kernels/xfuser_attention.py +465 -0
  304. fusion_mlx/dispatch/__init__.py +30 -0
  305. fusion_mlx/dispatch/cloud_router.py +252 -0
  306. fusion_mlx/dispatch/router.py +194 -0
  307. fusion_mlx/dispatch/smart_router.py +828 -0
  308. fusion_mlx/doctor/__init__.py +53 -0
  309. fusion_mlx/doctor/cli.py +104 -0
  310. fusion_mlx/doctor/env_health.py +864 -0
  311. fusion_mlx/doctor/runner.py +296 -0
  312. fusion_mlx/domain/__init__.py +4 -0
  313. fusion_mlx/domain/events.py +18 -0
  314. fusion_mlx/embedding.py +12 -0
  315. fusion_mlx/engine/__init__.py +13 -0
  316. fusion_mlx/engine/audio_utils.py +71 -0
  317. fusion_mlx/engine/base.py +347 -0
  318. fusion_mlx/engine/batched/__init__.py +357 -0
  319. fusion_mlx/engine/batched/_mtp_dispatch.py +167 -0
  320. fusion_mlx/engine/dflash.py +10 -0
  321. fusion_mlx/engine/vlm.py +10 -0
  322. fusion_mlx/engine_core.py +1204 -0
  323. fusion_mlx/engine_pool.py +10 -0
  324. fusion_mlx/engines/__init__.py +34 -0
  325. fusion_mlx/engines/_progress.py +45 -0
  326. fusion_mlx/engines/audio_utils.py +62 -0
  327. fusion_mlx/engines/base.py +449 -0
  328. fusion_mlx/engines/batched.py +1157 -0
  329. fusion_mlx/engines/embedding.py +815 -0
  330. fusion_mlx/engines/image_gen.py +689 -0
  331. fusion_mlx/engines/ner.py +215 -0
  332. fusion_mlx/engines/reranker.py +1072 -0
  333. fusion_mlx/engines/sts.py +259 -0
  334. fusion_mlx/engines/stt.py +188 -0
  335. fusion_mlx/engines/tts.py +293 -0
  336. fusion_mlx/engines/video.py +162 -0
  337. fusion_mlx/engines/video_backends/__init__.py +136 -0
  338. fusion_mlx/engines/video_backends/base.py +235 -0
  339. fusion_mlx/engines/video_backends/cogvideox.py +99 -0
  340. fusion_mlx/engines/video_backends/cosmos.py +144 -0
  341. fusion_mlx/engines/video_backends/hunyuanvideo.py +131 -0
  342. fusion_mlx/engines/video_backends/ltx2.py +203 -0
  343. fusion_mlx/engines/video_backends/ltx_video_legacy.py +409 -0
  344. fusion_mlx/engines/video_backends/opensora.py +121 -0
  345. fusion_mlx/engines/video_backends/skyreels.py +593 -0
  346. fusion_mlx/engines/video_backends/svd.py +175 -0
  347. fusion_mlx/engines/video_backends/unimplemented.py +88 -0
  348. fusion_mlx/engines/video_backends/uniworld.py +7 -0
  349. fusion_mlx/engines/video_backends/wan2.py +372 -0
  350. fusion_mlx/engines/vlm.py +1674 -0
  351. fusion_mlx/eval/__init__.py +64 -0
  352. fusion_mlx/eval/arc.py +78 -0
  353. fusion_mlx/eval/base.py +346 -0
  354. fusion_mlx/eval/bbq.py +86 -0
  355. fusion_mlx/eval/cmmlu.py +101 -0
  356. fusion_mlx/eval/datasets.py +88 -0
  357. fusion_mlx/eval/gsm8k.py +131 -0
  358. fusion_mlx/eval/hellaswag.py +78 -0
  359. fusion_mlx/eval/humaneval.py +298 -0
  360. fusion_mlx/eval/jmmlu.py +80 -0
  361. fusion_mlx/eval/kmmlu.py +106 -0
  362. fusion_mlx/eval/livecodebench.py +290 -0
  363. fusion_mlx/eval/mathqa.py +79 -0
  364. fusion_mlx/eval/mbpp.py +246 -0
  365. fusion_mlx/eval/mmlu.py +130 -0
  366. fusion_mlx/eval/mmlu_pro.py +82 -0
  367. fusion_mlx/eval/safetybench.py +82 -0
  368. fusion_mlx/eval/truthfulqa.py +108 -0
  369. fusion_mlx/eval/winogrande.py +77 -0
  370. fusion_mlx/exceptions.py +638 -0
  371. fusion_mlx/gui_compat/__init__.py +14 -0
  372. fusion_mlx/gui_compat/app_main.py +158 -0
  373. fusion_mlx/gui_compat/audio_manager.py +109 -0
  374. fusion_mlx/gui_compat/cli.py +449 -0
  375. fusion_mlx/gui_compat/database.py +302 -0
  376. fusion_mlx/gui_compat/download_progress.py +272 -0
  377. fusion_mlx/gui_compat/huggingface_integration.py +1415 -0
  378. fusion_mlx/gui_compat/inference_queue_manager.py +752 -0
  379. fusion_mlx/gui_compat/mlx_integration.py +2005 -0
  380. fusion_mlx/gui_compat/model_manager.py +715 -0
  381. fusion_mlx/gui_compat/models.py +297 -0
  382. fusion_mlx/gui_compat/queued_inference.py +564 -0
  383. fusion_mlx/gui_compat/server.py +964 -0
  384. fusion_mlx/gui_compat/system_monitor.py +264 -0
  385. fusion_mlx/gui_compat/templates/admin.html +1803 -0
  386. fusion_mlx/gui_compat/tray.py +589 -0
  387. fusion_mlx/hardware/__init__.py +5 -0
  388. fusion_mlx/hardware/apple.py +89 -0
  389. fusion_mlx/hardware/cpu.py +33 -0
  390. fusion_mlx/hardware/detector.py +38 -0
  391. fusion_mlx/hardware/memory.py +38 -0
  392. fusion_mlx/hardware/types.py +26 -0
  393. fusion_mlx/integrations/__init__.py +52 -0
  394. fusion_mlx/integrations/base.py +246 -0
  395. fusion_mlx/integrations/claude.py +75 -0
  396. fusion_mlx/integrations/codex.py +131 -0
  397. fusion_mlx/integrations/comfyui.py +526 -0
  398. fusion_mlx/integrations/copilot.py +61 -0
  399. fusion_mlx/integrations/factory_droid.py +54 -0
  400. fusion_mlx/integrations/hermes.py +172 -0
  401. fusion_mlx/integrations/kilo_code.py +56 -0
  402. fusion_mlx/integrations/kimi_code.py +56 -0
  403. fusion_mlx/integrations/openclaw.py +225 -0
  404. fusion_mlx/integrations/opencode.py +103 -0
  405. fusion_mlx/integrations/openhands.py +56 -0
  406. fusion_mlx/integrations/pi.py +113 -0
  407. fusion_mlx/integrations/pydantic_ai.py +68 -0
  408. fusion_mlx/integrations/qwen_code.py +56 -0
  409. fusion_mlx/integrations/smolagents.py +69 -0
  410. fusion_mlx/kernels/__init__.py +2 -0
  411. fusion_mlx/kernels/turboquant_fused.py +222 -0
  412. fusion_mlx/kv_cache_dtype.py +367 -0
  413. fusion_mlx/launch/__init__.py +44 -0
  414. fusion_mlx/launch/_common.py +158 -0
  415. fusion_mlx/launch/claude_code.py +131 -0
  416. fusion_mlx/launch/cli.py +311 -0
  417. fusion_mlx/launch/cline.py +147 -0
  418. fusion_mlx/launch/codex.py +89 -0
  419. fusion_mlx/launch/continue_dev.py +121 -0
  420. fusion_mlx/launch/cursor.py +116 -0
  421. fusion_mlx/launch/factory_droid.py +23 -0
  422. fusion_mlx/launch/hermes.py +84 -0
  423. fusion_mlx/launch/kilo_code.py +23 -0
  424. fusion_mlx/launch/kimi_code.py +23 -0
  425. fusion_mlx/launch/opencode.py +66 -0
  426. fusion_mlx/launch/openhands.py +23 -0
  427. fusion_mlx/launch/pydantic_ai.py +42 -0
  428. fusion_mlx/launch/qwen_code.py +23 -0
  429. fusion_mlx/launch/smolagents.py +42 -0
  430. fusion_mlx/logging_config.py +236 -0
  431. fusion_mlx/mcp/__init__.py +85 -0
  432. fusion_mlx/mcp/client.py +401 -0
  433. fusion_mlx/mcp/config.py +245 -0
  434. fusion_mlx/mcp/executor.py +500 -0
  435. fusion_mlx/mcp/manager.py +301 -0
  436. fusion_mlx/mcp/security.py +730 -0
  437. fusion_mlx/mcp/tools.py +174 -0
  438. fusion_mlx/mcp/types.py +201 -0
  439. fusion_mlx/memory_cache.py +1635 -0
  440. fusion_mlx/memory_monitor.py +964 -0
  441. fusion_mlx/middleware/__init__.py +49 -0
  442. fusion_mlx/middleware/auth.py +396 -0
  443. fusion_mlx/middleware/body_depth.py +274 -0
  444. fusion_mlx/middleware/body_size.py +359 -0
  445. fusion_mlx/middleware/exception_handlers.py +652 -0
  446. fusion_mlx/middleware/probe_fastpath.py +121 -0
  447. fusion_mlx/middleware/request_id.py +63 -0
  448. fusion_mlx/middleware/route_guard.py +155 -0
  449. fusion_mlx/migrate/__init__.py +2 -0
  450. fusion_mlx/migrate/analyzer.py +159 -0
  451. fusion_mlx/migrate/architectures.py +264 -0
  452. fusion_mlx/migrate/codegen.py +254 -0
  453. fusion_mlx/migrate/converter.py +240 -0
  454. fusion_mlx/migrate/validator.py +64 -0
  455. fusion_mlx/migrate/weight_mapper.py +164 -0
  456. fusion_mlx/model_aliases.py +444 -0
  457. fusion_mlx/model_auto_config.py +1415 -0
  458. fusion_mlx/model_discovery.py +9 -0
  459. fusion_mlx/model_profiles.py +124 -0
  460. fusion_mlx/model_registry.py +270 -0
  461. fusion_mlx/model_settings/__init__.py +882 -0
  462. fusion_mlx/models/__init__.py +1 -0
  463. fusion_mlx/models/base_model.py +45 -0
  464. fusion_mlx/models/gemma4_text.py +5 -0
  465. fusion_mlx/models/mllm.py +20 -0
  466. fusion_mlx/models/mlx_embeddings_compat.py +73 -0
  467. fusion_mlx/models/qwen2_embedding.py +235 -0
  468. fusion_mlx/models/reranker.py +9 -0
  469. fusion_mlx/models/vlm.py +250 -0
  470. fusion_mlx/models/xlm_roberta.py +401 -0
  471. fusion_mlx/multimodal_processor.py +461 -0
  472. fusion_mlx/mxfp4_moe_guardrail.py +219 -0
  473. fusion_mlx/optimizations.py +68 -0
  474. fusion_mlx/oq/__init__.py +107 -0
  475. fusion_mlx/oq/_core.py +1136 -0
  476. fusion_mlx/oq/io.py +967 -0
  477. fusion_mlx/oq/levels.py +371 -0
  478. fusion_mlx/oq/plan.py +841 -0
  479. fusion_mlx/oq/streaming.py +1956 -0
  480. fusion_mlx/oq.py +26 -0
  481. fusion_mlx/output_collector.py +164 -0
  482. fusion_mlx/output_router.py +759 -0
  483. fusion_mlx/output_router_harmony.py +662 -0
  484. fusion_mlx/parsers/__init__.py +19 -0
  485. fusion_mlx/parsers/gemma4.py +462 -0
  486. fusion_mlx/parsers/harmony.py +442 -0
  487. fusion_mlx/parsers/output_parser.py +657 -0
  488. fusion_mlx/patches/__init__.py +2 -0
  489. fusion_mlx/patches/deepseek_v4/__init__.py +196 -0
  490. fusion_mlx/patches/deepseek_v4/cache_extras.py +669 -0
  491. fusion_mlx/patches/deepseek_v4/cache_handlers.py +262 -0
  492. fusion_mlx/patches/deepseek_v4/chat_template_v4.py +417 -0
  493. fusion_mlx/patches/deepseek_v4/deepseek_v4_model.py +1206 -0
  494. fusion_mlx/patches/deepseek_v4/generate_patch.py +91 -0
  495. fusion_mlx/patches/deepseek_v4/hyper_connection.py +284 -0
  496. fusion_mlx/patches/deepseek_v4/tokenizer_patch.py +270 -0
  497. fusion_mlx/patches/deepseek_v4/tool_parser_v4.py +121 -0
  498. fusion_mlx/patches/deepseek_v4/utils_patch.py +271 -0
  499. fusion_mlx/patches/dflash_lifecycle.py +144 -0
  500. fusion_mlx/patches/glm_moe_dsa/__init__.py +108 -0
  501. fusion_mlx/patches/glm_moe_dsa/deepseek_v32.py +1110 -0
  502. fusion_mlx/patches/glm_moe_dsa/generate_patch.py +291 -0
  503. fusion_mlx/patches/glm_moe_dsa/glm_moe_dsa_model.py +448 -0
  504. fusion_mlx/patches/glm_moe_dsa/kernels.py +56 -0
  505. fusion_mlx/patches/glm_moe_dsa/sparse_mla.py +518 -0
  506. fusion_mlx/patches/glm_moe_dsa/switch_layers.py +283 -0
  507. fusion_mlx/patches/index_cache.py +266 -0
  508. fusion_mlx/patches/llama4_attention.py +123 -0
  509. fusion_mlx/patches/minimax_m3_sparse_attention.py +212 -0
  510. fusion_mlx/patches/mlx_audio_compat.py +40 -0
  511. fusion_mlx/patches/mlx_lm_mtp/__init__.py +112 -0
  512. fusion_mlx/patches/mlx_lm_mtp/batch_generator.py +1772 -0
  513. fusion_mlx/patches/mlx_lm_mtp/cache_rollback.py +155 -0
  514. fusion_mlx/patches/mlx_lm_mtp/deepseek_v4_model.py +557 -0
  515. fusion_mlx/patches/mlx_lm_mtp/qwen35_model.py +811 -0
  516. fusion_mlx/patches/mlx_vlm_diffusion.py +65 -0
  517. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/__init__.py +578 -0
  518. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/__init__.py +2 -0
  519. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/__init__.py +2 -0
  520. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/models/__init__.py +2 -0
  521. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/models/minimax_m3/__init__.py +5 -0
  522. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/models/minimax_m3/minimax_m3.py +132 -0
  523. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/models/minimax_m3_vl/__init__.py +23 -0
  524. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/models/minimax_m3_vl/config.py +316 -0
  525. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/models/minimax_m3_vl/language.py +1794 -0
  526. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/models/minimax_m3_vl/minimax_m3_vl.py +432 -0
  527. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/models/minimax_m3_vl/processing_minimax_m3_vl.py +1078 -0
  528. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/models/minimax_m3_vl/vision.py +276 -0
  529. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/tool_parsers/__init__.py +2 -0
  530. fusion_mlx/patches/mlx_vlm_minimax_m3_compat/vendor/mlx_vlm/tool_parsers/minimax_m3.py +372 -0
  531. fusion_mlx/patches/mlx_vlm_mtp/__init__.py +105 -0
  532. fusion_mlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_model.py +180 -0
  533. fusion_mlx/patches/mlx_vlm_mtp/qwen35_moe_vlm_runtime.py +509 -0
  534. fusion_mlx/patches/mlx_vlm_mtp/qwen35_vlm_model.py +144 -0
  535. fusion_mlx/patches/mlx_vlm_mtp/qwen35_vlm_runtime.py +324 -0
  536. fusion_mlx/patches/qwen3_6_nested_visual.py +111 -0
  537. fusion_mlx/patches/specprefill.py +922 -0
  538. fusion_mlx/patches/step3p7/__init__.py +78 -0
  539. fusion_mlx/patches/step3p7/step3p7_model.py +73 -0
  540. fusion_mlx/patches/turboquant_attention.py +170 -0
  541. fusion_mlx/performance.py +85 -0
  542. fusion_mlx/pflash.py +373 -0
  543. fusion_mlx/pool/__init__.py +44 -0
  544. fusion_mlx/pool/engine/__init__.py +1 -0
  545. fusion_mlx/pool/engine/dflash.py +33 -0
  546. fusion_mlx/pool/engine_pool.py +2373 -0
  547. fusion_mlx/pool/memory_enforcer.py +1423 -0
  548. fusion_mlx/pool/model_discovery.py +1526 -0
  549. fusion_mlx/pool/priority_scheduler.py +599 -0
  550. fusion_mlx/pool/settings.py +16 -0
  551. fusion_mlx/pool/unified_memory_pool.py +704 -0
  552. fusion_mlx/prefill_progress.py +141 -0
  553. fusion_mlx/prefill_transient_tracker.py +93 -0
  554. fusion_mlx/reasoning/__init__.py +130 -0
  555. fusion_mlx/reasoning/base.py +359 -0
  556. fusion_mlx/reasoning/deepseek_r1_parser.py +284 -0
  557. fusion_mlx/reasoning/gemma4_parser.py +484 -0
  558. fusion_mlx/reasoning/glm4_parser.py +105 -0
  559. fusion_mlx/reasoning/gpt_oss_parser.py +219 -0
  560. fusion_mlx/reasoning/harmony_parser.py +197 -0
  561. fusion_mlx/reasoning/minimax_parser.py +366 -0
  562. fusion_mlx/reasoning/qwen3_parser.py +458 -0
  563. fusion_mlx/reasoning/think_detector.py +119 -0
  564. fusion_mlx/reasoning/think_parser.py +1573 -0
  565. fusion_mlx/reasoning/ui_tars_parser.py +637 -0
  566. fusion_mlx/request.py +237 -0
  567. fusion_mlx/routes_internal/__init__.py +6 -0
  568. fusion_mlx/routes_internal/anthropic.py +26 -0
  569. fusion_mlx/routes_internal/audio.py +104 -0
  570. fusion_mlx/routes_internal/cache.py +225 -0
  571. fusion_mlx/routes_internal/chat.py +263 -0
  572. fusion_mlx/routes_internal/embeddings.py +4 -0
  573. fusion_mlx/routes_internal/gc.py +124 -0
  574. fusion_mlx/routes_internal/health.py +126 -0
  575. fusion_mlx/routes_internal/mcp_routes.py +4 -0
  576. fusion_mlx/routes_internal/metrics.py +295 -0
  577. fusion_mlx/routes_internal/models.py +131 -0
  578. fusion_mlx/routes_internal/responses.py +952 -0
  579. fusion_mlx/runtime/__init__.py +9 -0
  580. fusion_mlx/runtime/cache.py +186 -0
  581. fusion_mlx/runtime/diffusion_lane.py +1637 -0
  582. fusion_mlx/runtime/disk_kv_checkpoint.py +1027 -0
  583. fusion_mlx/runtime/model_registry.py +68 -0
  584. fusion_mlx/runtime/radix_index.py +523 -0
  585. fusion_mlx/runtime/ubc_evict.py +248 -0
  586. fusion_mlx/scheduler/__init__.py +35 -0
  587. fusion_mlx/scheduler/_mtp_vendored.py +831 -0
  588. fusion_mlx/scheduler/compiled_kv_cache.py +78 -0
  589. fusion_mlx/scheduler/config.py +39 -0
  590. fusion_mlx/scheduler/core.py +341 -0
  591. fusion_mlx/scheduler/helpers.py +277 -0
  592. fusion_mlx/scheduler/monkeypatches.py +601 -0
  593. fusion_mlx/scheduler/ngram_spec.py +603 -0
  594. fusion_mlx/scheduler/sampler_fast_path.py +319 -0
  595. fusion_mlx/scheduler/sched_admission.py +686 -0
  596. fusion_mlx/scheduler/sched_batch.py +891 -0
  597. fusion_mlx/scheduler/sched_boundary.py +895 -0
  598. fusion_mlx/scheduler/sched_cache.py +813 -0
  599. fusion_mlx/scheduler/sched_handoff.py +119 -0
  600. fusion_mlx/scheduler/sched_init.py +535 -0
  601. fusion_mlx/scheduler/sched_misc.py +602 -0
  602. fusion_mlx/scheduler/sched_query.py +506 -0
  603. fusion_mlx/scheduler/sched_response.py +774 -0
  604. fusion_mlx/scheduler/sched_schedule.py +868 -0
  605. fusion_mlx/scheduler/sched_specprefill.py +219 -0
  606. fusion_mlx/scheduler/sched_step.py +877 -0
  607. fusion_mlx/scheduler/sched_thinking.py +457 -0
  608. fusion_mlx/scheduler/sched_token.py +465 -0
  609. fusion_mlx/scheduler/sched_trim.py +255 -0
  610. fusion_mlx/scheduler/sched_vlm_mtp.py +115 -0
  611. fusion_mlx/scheduler/sched_vlm_mtp_batched.py +558 -0
  612. fusion_mlx/scheduler/spec_decode.py +899 -0
  613. fusion_mlx/scheduler/types.py +237 -0
  614. fusion_mlx/server.py +1649 -0
  615. fusion_mlx/server_metrics.py +309 -0
  616. fusion_mlx/service/__init__.py +88 -0
  617. fusion_mlx/service/disconnect_guard.py +376 -0
  618. fusion_mlx/service/helpers.py +1652 -0
  619. fusion_mlx/service/postprocessor/__init__.py +27 -0
  620. fusion_mlx/service/postprocessor/core.py +1969 -0
  621. fusion_mlx/service/postprocessor/formatters.py +948 -0
  622. fusion_mlx/service/postprocessor/parsers.py +944 -0
  623. fusion_mlx/sessions/__init__.py +23 -0
  624. fusion_mlx/sessions/tracker.py +195 -0
  625. fusion_mlx/settings.py +171 -0
  626. fusion_mlx/share/__init__.py +4 -0
  627. fusion_mlx/share/cli.py +510 -0
  628. fusion_mlx/share/warning.py +68 -0
  629. fusion_mlx/share/ws_tunnel.py +270 -0
  630. fusion_mlx/speculative/__init__.py +26 -0
  631. fusion_mlx/speculative/auto_resolve.py +119 -0
  632. fusion_mlx/speculative/auto_router.py +293 -0
  633. fusion_mlx/speculative/config.py +160 -0
  634. fusion_mlx/speculative/constraints.py +59 -0
  635. fusion_mlx/speculative/dflash/__init__.py +78 -0
  636. fusion_mlx/speculative/dflash/accept_counter.py +69 -0
  637. fusion_mlx/speculative/dflash/detect.py +84 -0
  638. fusion_mlx/speculative/dflash/drafter.py +231 -0
  639. fusion_mlx/speculative/dflash/drafter_registry.py +48 -0
  640. fusion_mlx/speculative/dflash/eligibility.py +164 -0
  641. fusion_mlx/speculative/dflash/generator.py +117 -0
  642. fusion_mlx/speculative/dflash/runtime.py +86 -0
  643. fusion_mlx/speculative/dflash/server.py +740 -0
  644. fusion_mlx/speculative/dflash/verifier.py +126 -0
  645. fusion_mlx/speculative/dfly/__init__.py +45 -0
  646. fusion_mlx/speculative/dfly/accept_counter.py +62 -0
  647. fusion_mlx/speculative/dfly/drafter.py +259 -0
  648. fusion_mlx/speculative/dfly/eligibility.py +133 -0
  649. fusion_mlx/speculative/dfly/runtime.py +21 -0
  650. fusion_mlx/speculative/draft_model.py +159 -0
  651. fusion_mlx/speculative/dspark/__init__.py +38 -0
  652. fusion_mlx/speculative/dspark/eligibility.py +121 -0
  653. fusion_mlx/speculative/dspark/engine/__init__.py +55 -0
  654. fusion_mlx/speculative/dspark/engine/adapters.py +600 -0
  655. fusion_mlx/speculative/dspark/engine/api.py +541 -0
  656. fusion_mlx/speculative/dspark/engine/benchmark_cli.py +1083 -0
  657. fusion_mlx/speculative/dspark/engine/chat_cli.py +155 -0
  658. fusion_mlx/speculative/dspark/engine/cli.py +383 -0
  659. fusion_mlx/speculative/dspark/engine/convert.py +498 -0
  660. fusion_mlx/speculative/dspark/engine/draft.py +476 -0
  661. fusion_mlx/speculative/dspark/engine/heads.py +75 -0
  662. fusion_mlx/speculative/dspark/engine/history.py +111 -0
  663. fusion_mlx/speculative/dspark/engine/runtime.py +693 -0
  664. fusion_mlx/speculative/dspark/engine/sampling.py +207 -0
  665. fusion_mlx/speculative/dspark/engine/sts.py +401 -0
  666. fusion_mlx/speculative/dspark/runtime.py +74 -0
  667. fusion_mlx/speculative/dspark/server.py +667 -0
  668. fusion_mlx/speculative/eagle3/__init__.py +4 -0
  669. fusion_mlx/speculative/eagle3/model.py +308 -0
  670. fusion_mlx/speculative/eagle3/speculator.py +352 -0
  671. fusion_mlx/speculative/hidden_capture.py +199 -0
  672. fusion_mlx/speculative/mtp/__init__.py +32 -0
  673. fusion_mlx/speculative/mtp/accept_counter.py +71 -0
  674. fusion_mlx/speculative/mtp/cache_patch.py +64 -0
  675. fusion_mlx/speculative/mtp/detect.py +110 -0
  676. fusion_mlx/speculative/mtp/dispatch.py +78 -0
  677. fusion_mlx/speculative/mtp/draft_k_controller_v2.py +320 -0
  678. fusion_mlx/speculative/mtp/gemma4_inject.py +828 -0
  679. fusion_mlx/speculative/mtp/generator.py +531 -0
  680. fusion_mlx/speculative/mtp/head.py +114 -0
  681. fusion_mlx/speculative/mtp/qwen3_5_inject.py +381 -0
  682. fusion_mlx/speculative/mtp.py +6 -0
  683. fusion_mlx/speculative/mtp_generate.py +294 -0
  684. fusion_mlx/speculative/ngram_predictor.py +210 -0
  685. fusion_mlx/speculative/per_request_route.py +98 -0
  686. fusion_mlx/speculative/prompt_lookup.py +328 -0
  687. fusion_mlx/speculative/registry.py +122 -0
  688. fusion_mlx/speculative/suffix_decoding.py +296 -0
  689. fusion_mlx/speculative/vlm_mtp.py +220 -0
  690. fusion_mlx/telemetry/__init__.py +46 -0
  691. fusion_mlx/telemetry/consent.py +218 -0
  692. fusion_mlx/telemetry/emit.py +525 -0
  693. fusion_mlx/telemetry/queue.py +244 -0
  694. fusion_mlx/telemetry/redact.py +260 -0
  695. fusion_mlx/telemetry/schema.py +160 -0
  696. fusion_mlx/telemetry/state.py +254 -0
  697. fusion_mlx/telemetry/transport.py +304 -0
  698. fusion_mlx/tests/regression_fp8_quant.py +510 -0
  699. fusion_mlx/tool_parsers/__init__.py +104 -0
  700. fusion_mlx/tool_parsers/abstract_tool_parser.py +473 -0
  701. fusion_mlx/tool_parsers/auto_tool_parser.py +361 -0
  702. fusion_mlx/tool_parsers/deepseek_tool_parser.py +177 -0
  703. fusion_mlx/tool_parsers/deepseek_v3_tool_parser.py +366 -0
  704. fusion_mlx/tool_parsers/deepseekv31_tool_parser.py +428 -0
  705. fusion_mlx/tool_parsers/functionary_tool_parser.py +194 -0
  706. fusion_mlx/tool_parsers/gemma4_tool_parser.py +534 -0
  707. fusion_mlx/tool_parsers/glm47_tool_parser.py +195 -0
  708. fusion_mlx/tool_parsers/granite_tool_parser.py +148 -0
  709. fusion_mlx/tool_parsers/harmony_tool_parser.py +358 -0
  710. fusion_mlx/tool_parsers/hermes_tool_parser.py +639 -0
  711. fusion_mlx/tool_parsers/kimi_tool_parser.py +161 -0
  712. fusion_mlx/tool_parsers/llama_tool_parser.py +744 -0
  713. fusion_mlx/tool_parsers/minimax_tool_parser.py +245 -0
  714. fusion_mlx/tool_parsers/mistral_tool_parser.py +561 -0
  715. fusion_mlx/tool_parsers/nemotron_tool_parser.py +168 -0
  716. fusion_mlx/tool_parsers/qwen3coder_tool_parser.py +670 -0
  717. fusion_mlx/tool_parsers/qwen_tool_parser.py +190 -0
  718. fusion_mlx/tool_parsers/seed_oss_tool_parser.py +542 -0
  719. fusion_mlx/tool_parsers/ui_tars_tool_parser.py +1610 -0
  720. fusion_mlx/tool_parsers/xlam_tool_parser.py +179 -0
  721. fusion_mlx/training/__init__.py +4 -0
  722. fusion_mlx/training/service.py +729 -0
  723. fusion_mlx/turboquant.py +107 -0
  724. fusion_mlx/turboquant_kv.py +524 -0
  725. fusion_mlx/utils/__init__.py +1 -0
  726. fusion_mlx/utils/chat_template.py +462 -0
  727. fusion_mlx/utils/chat_templates.py +217 -0
  728. fusion_mlx/utils/compile_cache.py +108 -0
  729. fusion_mlx/utils/decode.py +44 -0
  730. fusion_mlx/utils/fatal.py +27 -0
  731. fusion_mlx/utils/formatting.py +12 -0
  732. fusion_mlx/utils/generation_config.py +131 -0
  733. fusion_mlx/utils/hardware.py +348 -0
  734. fusion_mlx/utils/image.py +194 -0
  735. fusion_mlx/utils/install.py +116 -0
  736. fusion_mlx/utils/json_depth.py +72 -0
  737. fusion_mlx/utils/mamba_cache.py +139 -0
  738. fusion_mlx/utils/model_loading.py +164 -0
  739. fusion_mlx/utils/proc_memory.py +118 -0
  740. fusion_mlx/utils/psutil_compat.py +209 -0
  741. fusion_mlx/utils/release_check.py +28 -0
  742. fusion_mlx/utils/sampling.py +191 -0
  743. fusion_mlx/utils/tokenizer.py +762 -0
  744. fusion_mlx/utils/video.py +558 -0
  745. fusion_mlx/video/__init__.py +20 -0
  746. fusion_mlx/video/adapters/__init__.py +67 -0
  747. fusion_mlx/video/adapters/animatediff.py +318 -0
  748. fusion_mlx/video/adapters/controlnet.py +933 -0
  749. fusion_mlx/video/adapters/ip_adapter.py +632 -0
  750. fusion_mlx/video/cogvideox/__init__.py +1 -0
  751. fusion_mlx/video/cogvideox/config.py +112 -0
  752. fusion_mlx/video/cogvideox/convert.py +201 -0
  753. fusion_mlx/video/cogvideox/generate.py +314 -0
  754. fusion_mlx/video/cogvideox/rope.py +76 -0
  755. fusion_mlx/video/cogvideox/scheduler.py +57 -0
  756. fusion_mlx/video/cogvideox/text_encoder.py +20 -0
  757. fusion_mlx/video/cogvideox/transformer.py +386 -0
  758. fusion_mlx/video/cogvideox/utils.py +109 -0
  759. fusion_mlx/video/cogvideox/vae.py +252 -0
  760. fusion_mlx/video/cosmos/__init__.py +6 -0
  761. fusion_mlx/video/cosmos/dit.py +674 -0
  762. fusion_mlx/video/cosmos/generate.py +252 -0
  763. fusion_mlx/video/cosmos/scheduler.py +110 -0
  764. fusion_mlx/video/cosmos/text_encoder.py +343 -0
  765. fusion_mlx/video/cosmos/vae.py +444 -0
  766. fusion_mlx/video/hunyuanvideo/__init__.py +3 -0
  767. fusion_mlx/video/hunyuanvideo/dit.py +559 -0
  768. fusion_mlx/video/hunyuanvideo/generate.py +290 -0
  769. fusion_mlx/video/hunyuanvideo/scheduler.py +85 -0
  770. fusion_mlx/video/hunyuanvideo/text_encoder.py +360 -0
  771. fusion_mlx/video/hunyuanvideo/vae.py +594 -0
  772. fusion_mlx/video/latentsync_mlx/__init__.py +12 -0
  773. fusion_mlx/video/latentsync_mlx/attention.py +155 -0
  774. fusion_mlx/video/latentsync_mlx/convert_weights.py +170 -0
  775. fusion_mlx/video/latentsync_mlx/motion_module.py +167 -0
  776. fusion_mlx/video/latentsync_mlx/pipeline.py +513 -0
  777. fusion_mlx/video/latentsync_mlx/resnet.py +131 -0
  778. fusion_mlx/video/latentsync_mlx/sampler.py +81 -0
  779. fusion_mlx/video/latentsync_mlx/unet.py +509 -0
  780. fusion_mlx/video/latentsync_mlx/vae.py +222 -0
  781. fusion_mlx/video/ltx2/__init__.py +23 -0
  782. fusion_mlx/video/ltx2/adaln.py +164 -0
  783. fusion_mlx/video/ltx2/attention.py +162 -0
  784. fusion_mlx/video/ltx2/audio.py +77 -0
  785. fusion_mlx/video/ltx2/audio_vae/__init__.py +45 -0
  786. fusion_mlx/video/ltx2/audio_vae/attention.py +71 -0
  787. fusion_mlx/video/ltx2/audio_vae/audio_processor.py +86 -0
  788. fusion_mlx/video/ltx2/audio_vae/audio_vae.py +473 -0
  789. fusion_mlx/video/ltx2/audio_vae/causal_conv_2d.py +107 -0
  790. fusion_mlx/video/ltx2/audio_vae/downsample.py +96 -0
  791. fusion_mlx/video/ltx2/audio_vae/normalization.py +36 -0
  792. fusion_mlx/video/ltx2/audio_vae/ops.py +61 -0
  793. fusion_mlx/video/ltx2/audio_vae/resnet.py +168 -0
  794. fusion_mlx/video/ltx2/audio_vae/upsample.py +100 -0
  795. fusion_mlx/video/ltx2/audio_vae/vocoder.py +580 -0
  796. fusion_mlx/video/ltx2/conditioning.py +134 -0
  797. fusion_mlx/video/ltx2/config.py +349 -0
  798. fusion_mlx/video/ltx2/denoise.py +976 -0
  799. fusion_mlx/video/ltx2/feed_forward.py +38 -0
  800. fusion_mlx/video/ltx2/generate.py +1957 -0
  801. fusion_mlx/video/ltx2/guidance.py +40 -0
  802. fusion_mlx/video/ltx2/lora.py +126 -0
  803. fusion_mlx/video/ltx2/ltx2_model.py +718 -0
  804. fusion_mlx/video/ltx2/positions.py +89 -0
  805. fusion_mlx/video/ltx2/rope.py +355 -0
  806. fusion_mlx/video/ltx2/samplers.py +104 -0
  807. fusion_mlx/video/ltx2/scheduler.py +55 -0
  808. fusion_mlx/video/ltx2/text_encoder.py +1023 -0
  809. fusion_mlx/video/ltx2/text_projection.py +26 -0
  810. fusion_mlx/video/ltx2/transformer.py +396 -0
  811. fusion_mlx/video/ltx2/upsampler.py +385 -0
  812. fusion_mlx/video/ltx2/utils.py +261 -0
  813. fusion_mlx/video/ltx2/video_vae/__init__.py +4 -0
  814. fusion_mlx/video/ltx2/video_vae/convolution.py +246 -0
  815. fusion_mlx/video/ltx2/video_vae/decoder.py +620 -0
  816. fusion_mlx/video/ltx2/video_vae/encoder.py +23 -0
  817. fusion_mlx/video/ltx2/video_vae/ops.py +56 -0
  818. fusion_mlx/video/ltx2/video_vae/resnet.py +157 -0
  819. fusion_mlx/video/ltx2/video_vae/sampling.py +207 -0
  820. fusion_mlx/video/ltx2/video_vae/tiling.py +481 -0
  821. fusion_mlx/video/ltx2/video_vae/video_vae.py +542 -0
  822. fusion_mlx/video/ltx_video_legacy/__init__.py +6 -0
  823. fusion_mlx/video/ltx_video_legacy/denoise.py +151 -0
  824. fusion_mlx/video/ltx_video_legacy/scheduler.py +103 -0
  825. fusion_mlx/video/ltx_video_legacy/transformer.py +573 -0
  826. fusion_mlx/video/ltx_video_legacy/vae.py +796 -0
  827. fusion_mlx/video/mage/__init__.py +5 -0
  828. fusion_mlx/video/mage/config.py +35 -0
  829. fusion_mlx/video/mage/layers.py +245 -0
  830. fusion_mlx/video/mage/pipeline.py +167 -0
  831. fusion_mlx/video/mage/scheduler.py +43 -0
  832. fusion_mlx/video/mage/transformer.py +90 -0
  833. fusion_mlx/video/mage/vae.py +82 -0
  834. fusion_mlx/video/musetalk_mlx/__init__.py +6 -0
  835. fusion_mlx/video/musetalk_mlx/config.py +70 -0
  836. fusion_mlx/video/musetalk_mlx/models/__init__.py +0 -0
  837. fusion_mlx/video/musetalk_mlx/models/unet.py +358 -0
  838. fusion_mlx/video/musetalk_mlx/models/vae.py +233 -0
  839. fusion_mlx/video/musetalk_mlx/pipeline_mlx.py +176 -0
  840. fusion_mlx/video/musetalk_mlx/utils/__init__.py +0 -0
  841. fusion_mlx/video/musetalk_mlx/utils/weights.py +105 -0
  842. fusion_mlx/video/musetalk_mlx/whisper/__init__.py +0 -0
  843. fusion_mlx/video/musetalk_mlx/whisper/audio2feature.py +61 -0
  844. fusion_mlx/video/musetalk_mlx/whisper/log_mel.py +76 -0
  845. fusion_mlx/video/musetalk_mlx/whisper/whisper_encoder.py +86 -0
  846. fusion_mlx/video/opensora/__init__.py +2 -0
  847. fusion_mlx/video/opensora/config.py +52 -0
  848. fusion_mlx/video/opensora/convert.py +151 -0
  849. fusion_mlx/video/opensora/generate.py +227 -0
  850. fusion_mlx/video/opensora/rope.py +60 -0
  851. fusion_mlx/video/opensora/scheduler.py +90 -0
  852. fusion_mlx/video/opensora/text_encoder.py +61 -0
  853. fusion_mlx/video/opensora/transformer.py +418 -0
  854. fusion_mlx/video/pulid_mlx/__init__.py +17 -0
  855. fusion_mlx/video/pulid_mlx/attention.py +176 -0
  856. fusion_mlx/video/pulid_mlx/convert_weights.py +221 -0
  857. fusion_mlx/video/pulid_mlx/encoders.py +189 -0
  858. fusion_mlx/video/pulid_mlx/eva_clip.py +398 -0
  859. fusion_mlx/video/pulid_mlx/pipeline.py +231 -0
  860. fusion_mlx/video/skyreels_v3/__init__.py +27 -0
  861. fusion_mlx/video/skyreels_v3/_device.py +182 -0
  862. fusion_mlx/video/skyreels_v3/attention.py +561 -0
  863. fusion_mlx/video/skyreels_v3/blocks.py +550 -0
  864. fusion_mlx/video/skyreels_v3/common.py +456 -0
  865. fusion_mlx/video/skyreels_v3/config.py +152 -0
  866. fusion_mlx/video/skyreels_v3/convert_skyreels_v3.py +544 -0
  867. fusion_mlx/video/skyreels_v3/dit_base.py +225 -0
  868. fusion_mlx/video/skyreels_v3/generate.py +284 -0
  869. fusion_mlx/video/skyreels_v3/kv_cache.py +352 -0
  870. fusion_mlx/video/skyreels_v3/m5_optimizer.py +328 -0
  871. fusion_mlx/video/skyreels_v3/pipelines/__init__.py +1627 -0
  872. fusion_mlx/video/skyreels_v3/scheduler/__init__.py +16 -0
  873. fusion_mlx/video/skyreels_v3/scheduler/fm_solvers_unipc.py +421 -0
  874. fusion_mlx/video/skyreels_v3/speculative_denoise.py +395 -0
  875. fusion_mlx/video/skyreels_v3/step_strategy.py +300 -0
  876. fusion_mlx/video/skyreels_v3/temporal_flicker_fix.py +469 -0
  877. fusion_mlx/video/skyreels_v3/text_encoder.py +472 -0
  878. fusion_mlx/video/skyreels_v3/transformer_a2v.py +193 -0
  879. fusion_mlx/video/skyreels_v3/transformer_r2v.py +137 -0
  880. fusion_mlx/video/skyreels_v3/transformer_v2v.py +163 -0
  881. fusion_mlx/video/skyreels_v3/utils/__init__.py +2 -0
  882. fusion_mlx/video/skyreels_v3/vae.py +343 -0
  883. fusion_mlx/video/skyreels_v3/weights.py +654 -0
  884. fusion_mlx/video/svd/__init__.py +4 -0
  885. fusion_mlx/video/svd/clip_vision.py +231 -0
  886. fusion_mlx/video/svd/generate.py +180 -0
  887. fusion_mlx/video/svd/scheduler.py +111 -0
  888. fusion_mlx/video/svd/unet.py +727 -0
  889. fusion_mlx/video/svd/vae.py +256 -0
  890. fusion_mlx/video/t5_encoder.py +407 -0
  891. fusion_mlx/video/uniworld/__init__.py +21 -0
  892. fusion_mlx/video/uniworld/backend.py +506 -0
  893. fusion_mlx/video/uniworld/config.py +114 -0
  894. fusion_mlx/video/uniworld/feature_merge.py +216 -0
  895. fusion_mlx/video/uniworld/projectors.py +160 -0
  896. fusion_mlx/video/uniworld/siglip2.py +226 -0
  897. fusion_mlx/video/uniworld/weight_converter.py +177 -0
  898. fusion_mlx/video/wan2/__init__.py +7 -0
  899. fusion_mlx/video/wan2/attention.py +248 -0
  900. fusion_mlx/video/wan2/camera_adapter.py +73 -0
  901. fusion_mlx/video/wan2/config.py +174 -0
  902. fusion_mlx/video/wan2/convert.py +71 -0
  903. fusion_mlx/video/wan2/generate.py +1427 -0
  904. fusion_mlx/video/wan2/i2v_utils.py +39 -0
  905. fusion_mlx/video/wan2/lora/__init__.py +20 -0
  906. fusion_mlx/video/wan2/lora/apply.py +350 -0
  907. fusion_mlx/video/wan2/lora/loader.py +95 -0
  908. fusion_mlx/video/wan2/lora/types.py +42 -0
  909. fusion_mlx/video/wan2/postprocess.py +34 -0
  910. fusion_mlx/video/wan2/rope.py +149 -0
  911. fusion_mlx/video/wan2/scheduler.py +386 -0
  912. fusion_mlx/video/wan2/text_encoder.py +217 -0
  913. fusion_mlx/video/wan2/tiling.py +304 -0
  914. fusion_mlx/video/wan2/transformer.py +100 -0
  915. fusion_mlx/video/wan2/utils.py +343 -0
  916. fusion_mlx/video/wan2/vace.py +106 -0
  917. fusion_mlx/video/wan2/vae.py +550 -0
  918. fusion_mlx/video/wan2/vae22.py +1060 -0
  919. fusion_mlx/video/wan2/wan_2.py +525 -0
  920. fusion_mlx-0.7.3.dist-info/METADATA +1743 -0
  921. fusion_mlx-0.7.3.dist-info/RECORD +925 -0
  922. fusion_mlx-0.7.3.dist-info/WHEEL +5 -0
  923. fusion_mlx-0.7.3.dist-info/entry_points.txt +3 -0
  924. fusion_mlx-0.7.3.dist-info/licenses/LICENSE +202 -0
  925. fusion_mlx-0.7.3.dist-info/top_level.txt +1 -0
fusion_mlx/__init__.py ADDED
@@ -0,0 +1,81 @@
1
+ """fusion-mlx — unified local model management for Apple Silicon.
2
+
3
+ Merges the best of fusion-mlx (long-context, memory control, multi-model
4
+ concurrency) with Rapid-MLX (speculative decoding, multi-modal,
5
+ cloud routing) into a single codebase.
6
+
7
+ Key features:
8
+ - EnginePool with LRU eviction, pinning, TTL auto-unload
9
+ - 4-tier ProcessMemoryEnforcer (safe/balanced/aggressive/custom)
10
+ - Paged KV cache with SSD cold layer
11
+ - Block-aware prefix cache with copy-on-write
12
+ - Speculative decoding (SuffixDecoding, DFlash, MTP, VLM-MTP)
13
+ - OpenAI/Anthropic/Responses API compatibility
14
+ - Claude Code, OpenClaw, ComfyUI integrations
15
+ """
16
+
17
+ from ._version import __version__
18
+ from .config import MemoryConfig, MemoryTier, ServerConfig
19
+ from .dispatch import CloudRouter, RequestRouter
20
+ from .engine_core import AsyncEngineCore, EngineConfig
21
+ from .engines import (
22
+ BaseEngine,
23
+ BaseNonStreamingEngine,
24
+ BatchedEngine,
25
+ EmbeddingEngine,
26
+ GenerationOutput,
27
+ ImageGenEngine,
28
+ RerankerEngine,
29
+ STSEngine,
30
+ STTEngine,
31
+ TTSEngine,
32
+ VLMBatchedEngine,
33
+ )
34
+ from .pool import EnginePool, MemoryProfile, ModelDiscovery, ProcessMemoryEnforcer
35
+ from .request import Request, RequestOutput, RequestStatus, SamplingParams
36
+ from .scheduler import Scheduler, SchedulerConfig, SchedulerOutput, SchedulingPolicy
37
+ from .server import Server, create_app
38
+
39
+ __all__ = [
40
+ # Version
41
+ "__version__",
42
+ # Server
43
+ "Server",
44
+ "create_app",
45
+ "ServerConfig",
46
+ "MemoryConfig",
47
+ "MemoryTier",
48
+ # Scheduler
49
+ "Scheduler",
50
+ "SchedulerConfig",
51
+ "SchedulingPolicy",
52
+ "SchedulerOutput",
53
+ # Engine core
54
+ "AsyncEngineCore",
55
+ "EngineConfig",
56
+ # Request
57
+ "Request",
58
+ "RequestOutput",
59
+ "RequestStatus",
60
+ "SamplingParams",
61
+ # Engines
62
+ "BaseEngine",
63
+ "BaseNonStreamingEngine",
64
+ "GenerationOutput",
65
+ "BatchedEngine",
66
+ "VLMBatchedEngine",
67
+ "EmbeddingEngine",
68
+ "RerankerEngine",
69
+ "STTEngine",
70
+ "TTSEngine",
71
+ "STSEngine",
72
+ "ImageGenEngine",
73
+ # Pool
74
+ "EnginePool",
75
+ "ProcessMemoryEnforcer",
76
+ "MemoryProfile",
77
+ "ModelDiscovery",
78
+ # Router
79
+ "RequestRouter",
80
+ "CloudRouter",
81
+ ]
fusion_mlx/__main__.py ADDED
@@ -0,0 +1,5 @@
1
+ """Allow `python -m fusion_mlx` execution."""
2
+
3
+ from fusion_mlx.cli import main
4
+
5
+ main()