Instructions to use m-i/Qwen3.5-397B-A17B-2.592bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use m-i/Qwen3.5-397B-A17B-2.592bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("m-i/Qwen3.5-397B-A17B-2.592bit") config = load_config("m-i/Qwen3.5-397B-A17B-2.592bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use m-i/Qwen3.5-397B-A17B-2.592bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "m-i/Qwen3.5-397B-A17B-2.592bit"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "m-i/Qwen3.5-397B-A17B-2.592bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use m-i/Qwen3.5-397B-A17B-2.592bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "m-i/Qwen3.5-397B-A17B-2.592bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default m-i/Qwen3.5-397B-A17B-2.592bit
Run Hermes
hermes
m-i/Qwen3.5-397B-A17B-2.592bit
This model was converted to MLX format from Qwen/Qwen3.5-397B-A17B
using mlx-vlm version 0.4.4.
Refer to the original model card for more details on the model.
Use with mlx
pip install -U mlx-vlm
On Macs with 128GiB of RAM - https://github.com/ml-explore/mlx-lm#large-models :
sudo sysctl iogpu.wired_limit_mb=130000
Also, mlx-vlm supports TurboQuant
# Server with TurboQuant
mlx_vlm server \
--model m-i/Qwen3.5-397B-A17B-2.592bit\
--kv-bits 3.5 \
--kv-quant-scheme turboquant
python -m mlx_vlm.generate --model m-i/Qwen3.5-397B-A17B-2.592bit --max-tokens 100 --temperature 0.0 --prompt "Describe this image." --image <path_to_image>
Quantization Predicate
Main difference compared to m-i/Qwen3.5-397B-A17B-2.416bit is here the vision is untouched. Some parts have a slightly better quant param.
import mlx.core as mx
mx.set_default_device(mx.cpu)
from mlx_vlm import convert
def qwen397b_predicate(path: str, module):
"""
Multi-bit quantization predicate for Qwen/Qwen3.5-397B-A17B.
Maps GGUF _exps patterns (MoE experts) to HF switch_mlp paths.
"""
# ── SKIP: Critical for numerical stability ─────────────────────────────
if any(kw in path for kw in [
"layernorm", "mlp.gate.", "shared_expert_gate.",
"A_log", "dt_bias", "conv1d", ".bias", ".scales",
"vision",
]):
return False
# ── 2-bit: MoE routed experts (switch_mlp) ← THIS HANDLES _exps ───────
# GGUF: ffn_{gate,up,down}_exps.weight → HF: switch_mlp.{gate,up,down}_proj.weight
if "switch_mlp" in path:
if any(proj in path for proj in ["gate_proj", "up_proj"]):
return {"group_size": 128, "bits": 2, "mode": "affine"} # IQ2_XXS equivalent
if "down_proj" in path:
# Optional: use 3-bit for down_proj to mirror IQ2_S > IQ2_XXS
return {"group_size": 32, "bits": 2, "mode": "affine"}
# ── 4-bit: Token embeddings ────────────────────────────────────────────
if "embed_tokens" in path:
return {"group_size": 32, "bits": 4, "mode": "affine"}
# ── 5-bit: Shared expert gate/up ───────────────────────────────────────
if "shared_expert" in path and any(p in path for p in ["gate_proj", "up_proj"]):
return {"group_size": 128, "bits": 5, "mode": "affine"}
# ── 6-bit: Shared expert down ──────────────────────────────────────────
if "shared_expert" in path and "down_proj" in path:
return {"group_size": 32, "bits": 6, "mode": "affine"}
# ── 5-bit: Linear/full attention projections ───────────────────────────
if "linear_attn" in path and any(p in path for p in ["in_proj", "out_proj"]):
return {"group_size": 128, "bits": 5, "mode": "affine"}
if "self_attn" in path and any(p in path for p in ["q_proj", "k_proj", "v_proj", "o_proj"]):
return {"group_size": 128, "bits": 5, "mode": "affine"}
# ── 6-8-bit: SSM dynamics, lm_head & fallback ─────────────────────────────────────
if any(kw in path for kw in ["in_proj_a", "in_proj_b", "ssm_alpha", "ssm_beta"]):
return {"group_size": 32, "bits": 6, "mode": "affine"}
if "lm_head" in path:
return {"group_size": 128, "bits": 8, "mode": "affine"}
return {"group_size": 128, "bits": 6, "mode": "affine"}
repo = "Qwen/Qwen3.5-397B-A17B"
upload_repo = "m-i/Qwen3.5-397B-A17B-2.592bit"
convert(repo, quantize=True, upload_repo=upload_repo, quant_predicate=qwen397b_predicate, )
- Downloads last month
- 37
Model size
39B params
Tensor type
BF16
·
U32 ·
F32 ·
Hardware compatibility
Log In to add your hardware
4-bit
Model tree for m-i/Qwen3.5-397B-A17B-2.592bit
Base model
Qwen/Qwen3.5-397B-A17B