Skip to content

Move the Unsloth Studio MLX pins to mlx-vlm 0.7.11 - #15861

Merged
danielhanchen merged 4 commits into
unslothai:mainfrom
Lyxot:chore/studio-mlx-vlm-0711
Oct 29, 2026
Merged

danielhanchen merged 4 commits into
unslothai:mainfrom
Lyxot:chore/studio-mlx-vlm-0711

Conversation

@Lyxot

@Lyxot Lyxot commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator

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_SPEC and mlx_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

  • 0.7.10 / 0.7.11 only raise mlx-vlm's 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 (Python 3.10 to 3.13) moves mlx-vlm alone, 0.7.9 -> 0.7.11; the self-heal resolution likewise.
  • The zoo-side fixes for 0.7.11 (one-row batch decode, speculative penalty history, compiled-step fallback) are in the zoo PR; Unsloth Studio's own mlx_vlm call sites are unchanged.

Validation

Unsloth Studio MLX backend and install tests, one process per file, on mlx-vlm 0.7.9 vs 0.7.11:

3040 passed, 22 failed, 7 errors on both (the failures are pre-existing on main: offline model cache and collection-time imports)

The pin tests fail with the production specs reverted.

…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.
@Lyxot
Lyxot requested a review from danielhanchen as a code owner October 28, 2026 22:00
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-28T22:01:02.018572Z c7de12f PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Lyxot

Lyxot commented Oct 28, 2026

Copy link
Copy Markdown
Collaborator Author

Review and CI check on head c7de12f (unchanged during this check):

@danielhanchen

Copy link
Copy Markdown
Member

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 3d6ccebed5 (this PR's 5468a72ff)

chatgpt-codex-connector[bot] (on the mirror)

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 3d6ccebed5

No triage reaction was recorded on the mirror

Verdict

The round converged at mirror 3d6ccebed5 (this PR's 5468a72ff).

This is the review as it stood at that commit. Anything pushed to this PR afterwards was not part of it.

danielhanchen added a commit to Imagineer99/unsloth that referenced this pull request Oct 29, 2026
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 29, 2026
danielhanchen added a commit that referenced this pull request Oct 29, 2026
…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.
danielhanchen added a commit to danielhanchen/unsloth-staging-2 that referenced this pull request Oct 29, 2026
danielhanchen added a commit to NilayYadav/unsloth that referenced this pull request Oct 29, 2026
…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.

![LFM3-Audio-2B answers a spoken question with text and a playable
spoken
reply](https://raw.githubusercontent.com/Lyxot/unsloth/252d83a2eaddd95aeb043719e68cd0b67612b8fd/studio-mlx-vlm-0711-families/spoken-reply.png)

## 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]>
@danielhanchen
danielhanchen merged commit 3cc31f7 into unslothai:main Oct 29, 2026
88 of 90 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants