Views
No views yet
mlx-lm.--trust-remote-code. This is not something that the mlx-community added, but comes from the model provider.1pip install mlx-lm
2
3mlx_lm.generate --model mlx-community/Kimi-K2.7-Code-mlx-DQ3_K_M-q8 --trust-remote-code --prompt "Hallo"We further proposeDQ3_K_M, a dynamic 3-bit quantization method that significantly outperforms traditionalQ3_K_Mvariant on various benchmarks, which is also comparable with 4-bit quantization (Q4_K_M) approach in most tasks.
dynamic 3-bit quantization method (DQ3_K_M) that outperforms the 3-bit quantization implementation inllama.cppand achieves performance comparable to 4-bit quantization across multiple benchmarks.
convert.py file of mlx-lm on your system ( you can see the original code here ), replace the code inside def mixed_quant_predicate() with something like1 index = (
2 int(path.split(".")[layer_location])
3 if len(path.split(".")) > layer_location
4 else 0
5 )
6 # Build a mixed quant like "DQ3" similar to the "DQ3" of Arxiv paper https://arxiv.org/abs/2505.02390
7 # Quantitative Analysis of Performance Drop in DeepSeek Model Quantization
8 q_bits = 8
9 if "switch_mlp.up_proj" in path:
10 q_bits = 3
11 if "switch_mlp.gate_proj" in path:
12 q_bits = 3
13 if "switch_mlp.down_proj" in path:
14 q_bits = 3
15 # Layers up to 5 are higher quality
16 if index < 5:
17 q_bits = 5
18 # Every 5th layer is "medium" quality
19 if (index % 5) == 0:
20 q_bits = 4
21 print("path:", path, "index:", index, "q_bits:", q_bits)
22 return {"group_size": group_size, "bits": q_bits, "mode": mode}mlx_lm.convert --hf-path moonshotai/Kimi-K2.7-Code --mlx-path your-model-DQ3_K_M -q --quant-predicate mixed_3_4 --trust-remote-code