Skip to content

Add qwen3.6 script - #5084

Merged
danielhanchen merged 12 commits into
mainfrom
add-qwen3.6-script
Apr 17, 2026
Merged

danielhanchen merged 12 commits into
mainfrom
add-qwen3.6-script

Conversation

@Manan17

@Manan17 Manan17 commented Apr 17, 2026 •

Copy link
Copy Markdown
Contributor

This is a new installation script addition for qwen3.6 using MLX

Roland Tannous and others added 9 commits April 2, 2026 15:54
* Fixing cache.empty() calls

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Manan Shah <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* Fixing cache.empty() calls

* fixing for mlx versions

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Manan Shah <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* removed bidirectional check for 31b

* Change gemma4_text for moe

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Manan Shah <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
* fix(gemma4): cast RoPE offset to int before mx.arange()

* fix(gemma4): use zero-based arange + offset to avoid CPU-GPU sync

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2225e6a64

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread unsloth/models/gemma4_text.py Resolved
Comment thread scripts/install_qwen3_6_mlx.sh Resolved

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces an installation script for Qwen3.6 MLX on macOS and provides the implementation for the Gemma4 model using the MLX framework. The feedback focuses on improving the robustness and debuggability of the installation script by ensuring download failures are properly handled and installation logs are not silenced. Additionally, a critical performance issue was identified in the Gemma4 text model's embedding logic, where an inefficient reverse lookup of input IDs could lead to significant memory overhead and potential out-of-memory errors.

I am having trouble creating individual review comments. Click here to see my feedback.

unsloth/models/gemma4_text.py (561-565)

critical

This reverse lookup of input_ids from input_embeddings is extremely inefficient and will likely cause an Out-Of-Memory (OOM) error. Comparing input_embeddings (shape [B, L, D]) against the entire embedding weight matrix (shape [V, D]) using broadcasting creates a massive intermediate tensor of shape [B, L, V, D]. For a typical vocabulary size (V) and hidden dimension (D), this can easily exceed hundreds of gigabytes of memory even for a single token.

scripts/install_qwen3_6_mlx.sh (159)

high

The curl command should include the -f (or --fail) flag to ensure the script exits if the remote patch file is not found (e.g., a 404 error). Without it, curl might exit with code 0 even if the download fails, potentially writing an error message into the target .py file.

curl -sSLf "${_PATCH_BASE}/qwen3_5.py" -o "${_SITE_PKGS}/mlx_vlm/models/qwen3_5/qwen3_5.py"

scripts/install_qwen3_6_mlx.sh (111)

medium

Silencing the output of the uv installation script makes it difficult to diagnose failures. If the installation fails, the script will exit due to set -e, but the user will have no information about why it failed.

    sh "$_uv_tmp" </dev/null

scripts/install_qwen3_6_mlx.sh (130)

medium

Redirecting stderr to /dev/null during package installation hides potential error messages that are crucial for troubleshooting environment issues.

if uv pip install --python "$_VENV_PY" -q "transformers>=5.5.0"; then

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7deb6952e6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread scripts/install_qwen3_6_mlx.sh Resolved
@Manan17
Manan17 force-pushed the add-qwen3.6-script branch from 7deb695 to 76e66d0 Compare April 17, 2026 08:16
@danielhanchen
danielhanchen merged commit 7d0d2f2 into main Apr 17, 2026
5 checks passed
@danielhanchen
danielhanchen deleted the add-qwen3.6-script branch April 17, 2026 08:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f611f3e130

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".


step "patch" "fixing multi-turn image chat..."

if curl -sSLf "${_PATCH_BASE}/qwen3_5.py" -o "${_SITE_PKGS}/mlx_vlm/models/qwen3_5/qwen3_5.py"; then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Download patches atomically before overwriting installed modules

This curl ... -o writes directly into site-packages, so a transient transfer failure (e.g., connection reset mid-download) can leave a partially written qwen3_5.py/generate.py. Because the failure branch only emits a warning and the script continues to the success banner, users can end up with a corrupted mlx_vlm install that fails later at import/runtime; downloading to a temp file and mv-ing only after success avoids this corruption path.

Useful? React with 👍 / 👎.

@utajum

utajum commented Apr 17, 2026

Copy link
Copy Markdown

Script is not executable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants