Repository navigation
Studio: send Decision API images to the MLX engine for Clef - #13126
Conversation
On Apple Silicon a Clef whose MLX form has its vision tower and processor now answers requests with images through the MLX engine, under Auto and under the MLX runtime, and reports the image modality. The engine gets only the request's `images`, which the route has already checked; image parts inside a chat-message state keep a request off MLX as before. Every other model, and an unsloth-zoo that reads no images, keeps today's routing.
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. |
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. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6b34528a1d
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…vision projector Under Auto a resident llama.cpp server kept every request, so an image for a Clef whose GGUF export has no vision projector was refused there although the model is reported as reading images through MLX. Such a request now goes to the MLX engine; text, and images the llama.cpp form can read, stay where they were.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex review converged at What changed during review: under Auto, a request with images that MLX reads now goes to the MLX engine when the llama.cpp form of the entry has no vision projector, instead of staying on a resident llama.cpp server and being refused. Text requests, and images the llama.cpp form can read, keep their routing, so the advertised modality and the selected backend agree. CI at
|
|
@codex review |
1 similar comment
|
@codex review |
|
Codex Review: Didn't find any major issues. Already looking forward to the next diff. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
…reads them POST /v1/systemone validated images and then refused outright when the configured model was a saved connection, and _connection_decide had no images parameter to pass on. A multimodal System One server reached through a custom connection could only be asked text questions, even though unslothai#13126 and unslothai#13471 gave the native Clef path images. Images are forwarded now, but never on a guess: Studio cannot see what a remote System One server accepts, so the owner declares it per connection (input_modalities: ["text", "image"], stored for the configured connection only, with a switch in Settings > API) and an undeclared connection keeps refusing images with a message naming the setting. Declared or not, _validate_images runs first, so a malformed, oversized, over-pixel or non-PNG/JPEG image is refused before any provider is called, and remote URLs are still never fetched. A provider that cannot read what it was sent fails through _upstream_error as itself, with no silent text-only retry. laya_runtime.input_modalities answers for a connection too, so GET /api/settings/systemone, /v1/models and the try dialog agree with what gets forwarded. Try a decision gains an image example, "Read a screenshot", offered only when the configured model reads images. Its PNG sits in its own module behind import(), so the startup bundle never carries it.
…reads them POST /v1/systemone validated images and then refused outright when the configured model was a saved connection, and _connection_decide had no images parameter to pass on. A multimodal System One server reached through a custom connection could only be asked text questions, even though unslothai#13126 and unslothai#13471 gave the native Clef path images. Images are forwarded now, but never on a guess: Studio cannot see what a remote System One server accepts, so the owner declares it per connection (input_modalities: ["text", "image"], stored for the configured connection only, with a switch in Settings > API) and an undeclared connection keeps refusing images with a message naming the setting. Declared or not, _validate_images runs first, so a malformed, oversized, over-pixel or non-PNG/JPEG image is refused before any provider is called, and remote URLs are still never fetched. A provider that cannot read what it was sent fails through _upstream_error as itself, with no silent text-only retry. laya_runtime.input_modalities answers for a connection too, so GET /api/settings/systemone, /v1/models and the try dialog agree with what gets forwarded. Try a decision gains an image example, "Read a screenshot", offered only when the configured model reads images. Its PNG sits in its own module behind import(), so the startup bundle never carries it.
What this changes
On Apple Silicon, Unsloth Studio now answers Decision API requests that carry images through the MLX engine for a Clef, where they previously always went to llama.cpp.
imagesto the MLX engine when the model's MLX form is a Clef with its vision tower and processor (stock Clef repos; a local Clef folder whoseconfig.jsonhasvision_configand that has a processor config).input_modalitiesreportsimagefor such a model when MLX is ready.imagesarray, which the route has already checked (count, PNG/JPEG, byte and pixel limits). Image parts inside a chat-message state keep a request off MLX exactly as before, so nothing unvalidated is decoded in the server process.Depends on unslothai/unsloth-zoo#1645 for the engine support; without it this change is inert.
Validation
python -m pytest studio/backend/tests/test_decision_serving.py studio/backend/tests/test_decision_native.py -q # 90 passedThe new routing decisions are covered by
test_a_clef_with_its_vision_tower_reads_images_through_the_mlx_engine; each decision was checked by breaking it and confirming the test fails. On the engine side, real Clef Flash answers image requests on MLX in under a second.Risks
input_modalitiescan reportimagewhile Auto still picks a resident llama.cpp server, which then refuses the image. That refusal predates this change.