biosai-official commited on
Commit
494c26a
·
verified ·
1 Parent(s): 6d124e5

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +107 -0
README.md ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model:
4
+ - thinkingmachines/Inkling
5
+ library_name: transformers
6
+ pipeline_tag: text-generation
7
+ tags:
8
+ - amd-quark
9
+ - mxfp4
10
+ - rocm
11
+ - tokenspeed
12
+ ---
13
+
14
+ # Inkling-MXFP4
15
+
16
+ ## Model Overview
17
+
18
+ - **Model Architecture:** Thinking Machines Lab Inkling
19
+ - **Input:** Text, Image, Audio
20
+ - **Output:** Text
21
+ - **Inference Engine:** [TokenSpeed](https://github.com/lightseekorg/tokenspeed)
22
+ - **Model Optimizer:** [AMD Quark](https://github.com/amd/quark) (0.12.post1+rocm72.torch2.11)
23
+ - **Quantized layers:** MoE routed experts only
24
+ - **Weight quantization:** OCP MXFP4, static
25
+ - **Activation quantization:** OCP MXFP4, dynamic
26
+
27
+ This model was built by applying AMD Quark MXFP4 quantization to the BF16 Thinking Machines Lab Inkling checkpoint. The quantization targets the MoE routed experts, while attention layers and shared experts are kept in BF16.
28
+
29
+ ## Environment
30
+
31
+ The quantization workflow was prepared on an AMD gfx950 system. The inspected container environment was:
32
+
33
+ - **GPU:** AMD MI350/MI355
34
+ - **Target graphics version:** gfx950
35
+ - **ROCm:** 7.2.1
36
+ - **amdgpu driver:** 6.16.13
37
+ - **OS:** Linux 6.8.0-84, x86_64
38
+ - **Python:** 3.12.3
39
+ - **PyTorch:** 2.13.0+rocm7.1
40
+ - **AMD Quark:** 0.12.post1+rocm72.torch2.11
41
+ - **Safetensors:** 0.8.0
42
+ - **Transformers:** 5.13.1
43
+
44
+ Create and activate the Quark environment:
45
+
46
+ ```bash
47
+ python3 -m venv ~/.venv-quark
48
+ source ~/.venv-quark/bin/activate
49
+ ```
50
+
51
+ Install the required packages:
52
+
53
+ ```bash
54
+ python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/rocm7.1
55
+ python -m pip install amd-quark --extra-index-url https://pypi.amd.com/quark/rocm72/simple
56
+ python -m pip install safetensors transformers accelerate tqdm
57
+ ```
58
+
59
+ ## Model Quantization
60
+
61
+ The model was quantized with the Quark file-to-file flow. This avoids loading the full BF16 checkpoint into GPU memory at once, which is important for very large MoE checkpoints. Run the quantization script:
62
+
63
+ ```bash
64
+ python quantize_quark.py \
65
+ --model_dir /path/to/model \
66
+ --output_dir /path/to/output \
67
+ --quant_scheme mxfp4 \
68
+ --file2file_quantization
69
+ ```
70
+
71
+ The script applies the model-specific exclusion policy automatically in file-to-file mode. The resulting checkpoint stores MXFP4 routed-expert weights and scales while preserving non-routed-expert components in BF16.
72
+
73
+ ## Deployment
74
+
75
+ This model can be served with [TokenSpeed](https://github.com/lightseekorg/tokenspeed):
76
+
77
+ ```bash
78
+ tokenspeed serve \
79
+ --model lightseekorg/Inkling-MXFP4 \
80
+ --attn-tp-size 4 \
81
+ --moe-tp-size 4 \
82
+ --max-model-len 81920 \
83
+ --max-num-seqs 16 \
84
+ --max-prefill-tokens 8192 \
85
+ --chunked-prefill-size 8192 \
86
+ --gpu-memory-utilization 0.95 \
87
+ --disable-cuda-graph-padding \
88
+ --trust-remote-code \
89
+ --dtype bfloat16 \
90
+ --disable-kvstore \
91
+ --kvstore-ratio 0 \
92
+ --block-size 128 \
93
+ --host 127.0.0.1 \
94
+ --port 22015
95
+ ```
96
+
97
+ ## Evaluation
98
+
99
+ The following validation results are placeholders and will be updated before public release.
100
+
101
+ | Benchmark | BF16 Reference | MXFP4 |
102
+ | --- | ---: | ---: |
103
+ | BFCL exact calls | 78.3% | 79.1% |
104
+ | BFCL all-live macro | 75.4% | 75.3% |
105
+ | MMAU | 77.2% | 76.0% |
106
+ | GPQA Diamond | 88.1% | 85.4% |
107
+ | AIME26 | 96.4% | 96.7% |