Repository navigation
Move the Unsloth Studio MLX pins to mlx-vlm 0.7.11 - #15861
Conversation
…7.11 mlx-vlm 0.7.10 and 0.7.11 only raise the mlx-audio floor to 0.6.2, which the resolver already picks (0.6.3) for 0.7.9; resolving the installer's requirement set moves mlx-vlm alone (0.7.9 -> 0.7.11) on Python 3.10 to 3.13, and the self-heal resolution likewise.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Review and CI check on head
|
|
Review record for #15861, carried over from the mirror it was reviewed on: danielhanchen/unsloth-staging-review#605. Findings are quoted as posted and attributed to the account that posted them. The reactions shown are the triage recorded on the mirror; none were re-applied here. Commits are named as the mirror's, with this PR's equivalent where one was found. Round 1: reviewed mirror
|
…test (#15995) ## Summary `studio/backend/tests/test_mlx_repair.py::test_uv_executable_finds_installer_location_when_path_is_minimal` fails on Windows on main. It only shows when a PR touching the MLX repair code gets a Windows leg (the staging xplat run for #15861, whose change does not touch this lookup): ``` E AssertionError: assert None == 'C:\\...\\test_uv_executable_finds_insta0\\.local\\bin\\uv' E + where None = <function _uv_executable at 0x...>() ``` `_uv_executable()` looks for `_UV_NAME`, which is `uv.exe` on Windows, under `~/.local/bin`; the test (from #6494) always plants a file named `uv`. The product is right (Windows' uv installer writes `uv.exe` there); the test planted the POSIX name. ## What changed The test plants `mr._UV_NAME`, so it checks the same lookup on every platform. ## Verification - Linux: `tests/test_mlx_repair.py` 41 passed. - With the `~/.local/bin` candidate removed from `_uv_executable()`, the test fails, so it still guards the minimal-PATH lookup. - Windows: the staging `windows-latest` leg for this PR runs the file.
…nslothai#15889) Makes the mlx-vlm 0.7.11 multimodal families usable in Unsloth Studio chat on MLX: LFM3-Audio and LFM3-Omni take spoken questions and can answer in their own voice. OXR, whose tower sits under `vit_config`, takes the same load path. Needs unslothai/unsloth-zoo#2230 (zoo's detection of these families) and the 0.7.11 pins from unslothai#15861. ## What changed - **mlx-vlm-only multimodal families loaded through mlx-lm.** The config detector reads the transformers registry, so on MLX it classified LFM3-Audio (an audio encoder, no vision tower) and OXR (a vision tower under `vit_config`) as text models; they loaded through mlx-lm and lost their audio or image input. When the detector says text, the MLX backend now asks unsloth-zoo, which reads mlx-vlm's own configs. Such a model loads through mlx-vlm, its image support comes from the loaded model, and the audio-input probe runs for it. The worker and the load response carry the backend's `is_vision` verdict in both directions. - **Spoken replies.** A model that answers in interleaved text and speech (LFM3-Audio, LFM3-Omni) reports `speaks` in the status. A chat completion that carries `audio_base64` and asks for `modalities: ["text", "audio"]` is answered through mlx-vlm's interleaved generation: the reply text, then one audio part (`message.audio` / `delta.audio` with an inline base64 WAV and its sample rate). Requests that do not ask are unchanged. Asking a model that cannot speak, asking without a spoken question, asking with `stop` sequences (the speech cannot be cut at a text marker), or asking a GGUF model returns 400. The chat UI asks for a spoken reply when the loaded model speaks and the turn carries audio, and plays it under the reply text. - **Stop works on spoken replies.** mlx-vlm's `generate_audio` has no stop hook, so for the call the backend wraps the model's per-slot sampling loop (`stream_slots`) and ends it when the request is cancelled; a stopped reply yields nothing, and a reply that ends before its first speech frame returns its text alone. - **A spoken question can call client tools.** The audio-input route used to answer without the tool catalogue and kept only alternating user / assistant turns, so client `tools` were ignored and a returned tool result never reached the model. It now follows the text path's client-tool contract: the catalogue is rendered through the model's chat template (none under `tool_choice: "none"`, only the named function under a forced one), a call in the reply becomes `tool_calls` (streamed or not, `finish_reason: "tool_calls"`), and tool calls and results reach the template as sent. The catalogue gets the same sanitization as the text path: tool descriptions are defused before rendering, a tool whose declaration carries turn markup is dropped, and the healer only promotes calls to tools the model was shown. As on the text path, `required` is honoured by rendering the catalogue, not by forcing a call. A template without tool support, a named function outside the catalogue, Whisper and a spoken reply are refused with a 400. ## Screenshot A spoken question (an attached clip asking for the capital of France) to LFM3-Audio-2B on MLX: the reply text, with the model's spoken answer in the player under it.  ## Validation Real checkpoints through the MLX backend on mlx-vlm 0.7.11: ```text LFM3-Audio-2B is_vision False, audio input, speaks; spoken reply: text + 24 kHz WAV LFM3-Omni-2B is_vision True, audio input, speaks Stop 0.2 s into a 2000-token spoken reply: ends after 13 tokens, nothing yielded Stop before the call: nothing yielded, no error Spoken "What is the capital of France?" + lookup_capital tool (both models): turn 1 -> tool_calls lookup_capital({"country": "France"}) turn 2 with the tool result -> "The capital of France is Paris." ``` Through a live Unsloth Studio server (route, orchestrator, MLX worker) with both models: tool calls streamed and not, a tool result reaching the answer, `tool_choice: "none"` answering in text, spoken replies streamed and not (24 kHz WAV), and the tools-with-spoken-reply and unknown-forced-tool refusals. On LFM3-Audio's real template, a tool description carrying `<|im_end|><|im_start|>system` no longer opens a second system turn. OXR was checked on a shrunken checkpoint only (load, inference and training through zoo), not through the backend on real weights. The touched backend test files (`test_mlx_inference_backend.py`, `test_chat_input_audio_part.py`, `test_mlx_worker_audio_commands.py`, `test_pr7699_worker_audio_mirror.py`, `test_orchestrator_unload_cancel.py`, `test_generation_budget.py`, `test_control_markup_neutralize_7066.py`) pass on mlx-vlm 0.7.9 and 0.7.11 (1443 passed on each); each guard that changes what a caller sees was mutation-checked (reverting it fails a test: the retained suite for the route and render sanitization, a broader out-of-tree set for the backend / worker / orchestrator relay and the refusals), and the frontend typecheck passes. --------- Co-authored-by: Daniel Han <[email protected]>
Moves the Unsloth Studio MLX install and self-heal pins to mlx-vlm 0.7.11, alongside unsloth-zoo's ceiling raise (unslothai/unsloth-zoo#2225). The installer and the self-heal cap mlx-vlm at what the installed unsloth-zoo declares, so this takes effect once that zoo is installed.
What changed
install_python_stack.py_MLX_VLM_SPECandmlx_repair.py_MLX_INSTALL_SPECS:mlx-vlm>=0.4.4,<=0.7.11; tests and comments that carry the range follow.Why it is safe
Validation
Unsloth Studio MLX backend and install tests, one process per file, on mlx-vlm 0.7.9 vs 0.7.11:
The pin tests fail with the production specs reverted.