Switch openCodeMlx default model to Qwen3.8-27B-8bit (mlx-vlm) - #54
Open
perNyfelt wants to merge 3 commits into
Open
Switch openCodeMlx default model to Qwen3.8-27B-8bit (mlx-vlm)#54perNyfelt wants to merge 3 commits into
perNyfelt wants to merge 3 commits into
Conversation
…mlx-vlm Qwen3.8-27B-8bit is a vision-language checkpoint that mlx_lm.server can't load (unsupported architecture), so serving it requires mlx-vlm's own OpenAI-compatible server instead. Auto-detect the backend per model from its downloaded config.json (vision_config presence) so future MLX_MODEL swaps between text-only and vision-capable checkpoints keep working with just the one-line change the script already supports. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Member
Author
|
Reviewed PR #54 ✅ Verified against the actual environment:
Review notes (non-blocking):
|
Switch to mlx-community/Qwen3.8-27B-4bit paired with the Qwen3.8-27B-MTP-4bit draft head via mlx_vlm.server's --draft-model/--draft-kind mtp, since the 8-bit model alone was too slow for practical use. Verified live: 17.8 tok/s decode (up from ~12 tok/s baseline) with a ~77% draft-token acceptance rate. Also bind model downloads to a specific network interface (MLX_DOWNLOAD_INTERFACE, default en7) via a socket.socket subclass in the huggingface_hub/modelscope download snippets, since GlobalProtect VPN was found to reset every connection to huggingface.co outright. Disables hf_xet when binding is active, since its separate Rust networking stack bypasses the socket patch and was observed to hang indefinitely. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Member
Author
|
Follow-up: the 8-bit model was too slow in practice, so this branch now switches to Also fixed model downloads to bind to a specific network interface ( Live-verified on real hardware:
|
…default This is an open-source repo; defaulting to a specific machine's network interface name doesn't generalize. MLX_DOWNLOAD_INTERFACE now defaults to empty (default route), and users can opt in with their own interface name if they hit VPN issues like the GlobalProtect one described in the comment. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
demo/openCodeMlx's defaultMLX_MODELtomlx-community/Qwen3.8-27B-8bit, a vision-language checkpoint that plainmlx_lm.servercan't load (unsupported architecture).detect_model_backend(), which inspects the downloaded model'sconfig.jsonfor avision_configkey to auto-pickmlx_vlmvsmlx_lmas the serving backend — so futureMLX_MODELswaps between text-only and vision-capable checkpoints keep working with the existing "swap one line" UX, no second env var to keep in sync.ensure_mlx_vlm_current()(mirrorsensure_mlx_lm_current's not-installed→hard-error / already-installed→warn-and-continue pattern), only invoked when the detected backend needs it.start_mlx_server_instance()now branches betweenmlx_lm.server(--prompt-cache-bytes) andpython3 -m mlx_vlm.server(--max-kv-size,--trust-remote-code) based on the detected backend. The small background model (Qwen2.5-Coder-1.5B-Instruct-4bit) is explicitly pinned tomlx_lmand unaffected.Known tradeoff (accepted):
mlx-vlm's prompt-prefix caching is limited, so opencode's system prompt may get reprocessed every turn instead of cached like themlx_lm.serverpath — a documented upstream opencode+mlx-vlm behavior. This is a real latency cost for the coding-agent workflow, not fixed here.Test plan
bash -n demo/openCodeMlxsyntax checkdemo/test_updates_opencode.sh— 8/8 passing (no regression)mlx_vlm,mlx-vlmauto-installedmlx_vlm.server --helpoutput matches the flags used in the script/v1/modelsresponds (what the script polls)tool_callsresponse, confirming the agentic use case works end-to-end🤖 Generated with Claude Code