Repository navigation
feat: add Gemma4 Unsloth tensor-class recipes - #105
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_1e08332c-a266-4a93-8374-2baa6508f777) |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ff7f8a51aa
ℹ️ 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".
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_76b6c216-fd3e-4789-b04d-882f439fc7e7) |
… app, mlx-node#105 Gemma4 Unsloth tensor-class recipes Merge-forward of mirror/upstream (400b12b) into our patched main. Upstream delta since mlx-node#102: 400b12b feat(desktop): mlx-node.app menubar app + supervised inference sidecar (mlx-node#103) 5e67047 feat: add Gemma4 Unsloth tensor-class recipes (mlx-node#105) Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> # Conflicts: # packages/server/package.json # packages/server/src/server.ts # vite.config.ts
What changed
Why
The CLI accepted
--q-recipe unsloth --q-mxfpand--q-mode nvfp4for Gemma, but the backend only selected the verified Qwen map. Gemma therefore fell back to the legacy Dynamic 2.0 predicate, and its loader rejected the plain E4M3 attention weights required by the DGX class map.Validation
cargo check -p mlx-core --libyarn vp test packages/cli/__test__/convert-cmd.test.ts(25/25)yarn build:tscargo fmt --all -- --checkgit diff --check8c8b270e: Build, Rust Lint, fullcargo test, TypeScript build/tests, and Publish all passedgoogle/gemma-4-26B-A4B-itcheckpoint with matching Unsloth imatrix into both mapsOKNote
Medium Risk
Touches quantization recipe selection, conversion validation, and Gemma4 weight loading/memory accounting; wrong gates could reject valid checkpoints or mis-classify tensors, but behavior is heavily gated and covered by new tests.
Overview
Extends the verified fixed Unsloth path beyond Qwen hybrids to the exact SafeTensors Gemma 4 26B-A4B MoE checkpoint (
--q-mxfp/--q-mode nvfp4).OfficialUnslothRecipeKindis split into Qwen vs Gemma4 variants so Gemma never inherits Qwen’s final-eight FFN promotion.Conversion (
convert.rs): Strict gates on config,--model-type gemma4, MoE dims, and a 180-MLP / 115-attention tensor inventory; near-miss Gemma inputs fail closed instead of falling back to legacy Dynamic 2.0. Gemma’s map keeps all dense/expert FFNs low, attention q/k/v/o high, and everything else BF16. A pre-quant shape preflight enforces ranks, K%32, and the 180/115 class counts.Runtime (Gemma4): Rank-2 plain E4M3 attention weights load via one-time BF16 reconstruction and A16 matmul; experts stay NVFP4-only. Reconstructed FP8 weight bytes are folded into cache-limit accounting.
CLI/docs/tests: Help text and docs describe Qwen vs Gemma policies; CLI tests updated for the new messaging.
Reviewed by Cursor Bugbot for commit 8c8b270. Bugbot is set up for automated code reviews on this repo. Configure here.