ichbinblau commited on
Commit
b1e3dae
·
verified ·
1 Parent(s): 0dfed84

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +131 -0
README.md ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ base_model:
4
+ - deepseek-ai/DeepSeek-R1-0528
5
+ ---
6
+
7
+
8
+ # Model Overview
9
+
10
+ - **Model Architecture:** DeepSeek-R1-0528
11
+ - **Input:** Text
12
+ - **Output:** Text
13
+ - **Supported Hardware Microarchitecture:** AMD MI350/MI355
14
+ - **ROCm**: 7.0
15
+ - **PyTorch**: 2.8.0
16
+ - **Transformers**: 4.53.0
17
+ - **Operating System(s):** Linux
18
+ - **Inference Engine:** [SGLang](https://docs.sglang.ai/)/[vLLM](https://docs.vllm.ai/en/latest/)
19
+ - **Model Optimizer:** [AMD-Quark](https://quark.docs.amd.com/latest/index.html) (V0.10)
20
+ - **Weight quantization:** OCP MXFP4, Static
21
+ - **Activation quantization:** OCP MXFP4, Dynamic
22
+ - **Calibration Dataset:** [Pile](https://huggingface.co/datasets/mit-han-lab/pile-val-backup)
23
+
24
+ This model was built with deepseek-ai DeepSeek-R1-0528 model by applying [AMD-Quark](https://quark.docs.amd.com/latest/index.html) for MXFP4 quantization.
25
+
26
+ # Model Quantization
27
+
28
+ The model was quantized from [deepseek-ai/DeepSeek-R1-0528](https://huggingface.co/deepseek-ai/DeepSeek-R1-0528) using [AMD-Quark](https://quark.docs.amd.com/latest/index.html). Both weights and activations were quantized to MXFP4 format.
29
+
30
+ **Preprocessing requirement:**
31
+
32
+ Before executing the quantization script below, the original FP8 model must first be dequantized to BFloat16.
33
+ You can either perform the dequantization manually using this [conversion script](https://github.com/deepseek-ai/DeepSeek-V3/blob/main/inference/fp8_cast_bf16.py), or use the pre-converted BFloat16 model available at [amd/DeepSeek-R1-0528-BF16](https://huggingface.co/amd/DeepSeek-R1-0528-BF16).
34
+
35
+ **Quantization scripts:**
36
+ ```
37
+ cd Quark/examples/torch/language_modeling/llm_ptq/
38
+ exclude_layers="*lm_head model.layers.61.*"
39
+ python3 quantize_quark.py --model_dir $MODEL_DIR \
40
+ --quant_scheme w_mxfp4_a_mxfp4 \
41
+ --group_size 32 \
42
+ --num_calib_data 128 \
43
+ --exclude_layers $exclude_layers \
44
+ --skip_evaluation \
45
+ --multi_gpu \
46
+ --model_export hf_format \
47
+ --output_dir amd/DeepSeek-R1-0528-MXFP4-V2
48
+ ```
49
+
50
+ # Deployment
51
+
52
+ This model can be deployed efficiently using the [SGLang](https://docs.sglang.ai/) and [vLLM](https://docs.vllm.ai/en/latest/) backends.
53
+
54
+ ## Evaluation
55
+
56
+ The model was evaluated on AIME24, and GSM8K benchmarks using the [lm-evaluation-harness](https://github.com/EleutherAI/lm-evaluation-harness) framework.
57
+
58
+ ### Accuracy
59
+
60
+ <table>
61
+ <tr>
62
+ <td><strong>Benchmark</strong>
63
+ </td>
64
+ <td><strong>DeepSeek-R1-0528-MXFP4-V2 (non MTP) </strong>
65
+ </td>
66
+ <td><strong>DeepSeek-R1-0528-MXFP4-V2 (MTP=3)</strong>
67
+ </td>
68
+ </tr>
69
+ <tr>
70
+ <td>AIME24
71
+ </td>
72
+ <td>80.00
73
+ </td>
74
+ <td>83.33
75
+ </td>
76
+ </tr>
77
+ <tr>
78
+ <td>GSM8K
79
+ </td>
80
+ <td>95.00
81
+ </td>
82
+ <td>95.30
83
+ </td>
84
+ </tr>
85
+ </table>
86
+
87
+ ### Reproduction
88
+
89
+ The results of AIME24 and GSM8K, were obtained using forked [lm-evaluation-harness](https://github.com/BowenBao/lm-evaluation-harness/tree/cot).
90
+
91
+ ### Launch Server
92
+ ```
93
+ #!/bin/bash
94
+ MODEL=/models/amd/DeepSeek-R1-0528-MXFP4-V2
95
+ LOG="sglang-serving.log"
96
+
97
+ SGLANG_AITER_MLA_PERSIST=1 \
98
+ python3 -m sglang.launch_server \
99
+ --model-path $MODEL \
100
+ --tensor-parallel-size 8 \
101
+ --trust-remote-code \
102
+ --chunked-prefill-size 131072 \
103
+ --host 0.0.0.0 \
104
+ --port 8321 \
105
+ --disable-radix-cache \
106
+ --mem-fraction-static 0.8 \
107
+ --max-running-requests 64 \
108
+ --attention-backend aiter 2>&1 | tee $LOG
109
+ ```
110
+
111
+ ### AIME24
112
+ ```
113
+ lm_eval --model local-completions \
114
+ --model_args model=/models/amd/DeepSeek-R1-0528-MXFP4-V2,base_url=http://0.0.0.0:8321/v1/completions,num_concurrent=999999,timeout=999999,tokenized_requests=False,max_length=32000,temperature=0.6,top_p=0.95 \
115
+ --tasks aime24 \
116
+ --num_fewshot 0 \
117
+ --gen_kwargs "do_sample=True,temperature=0.6,top_p=0.95,max_tokens=32000" \
118
+ --batch_size auto 2>&1 | tee aime24.log
119
+ ```
120
+
121
+ ### GSM8K
122
+ ```
123
+ lm_eval --model local-completions \
124
+ --model_args model=/models/amd/DeepSeek-R1-0528-MXFP4-V2,base_url=http://0.0.0.0:8321/v1/completions,num_concurrent=256,max_retries=10,max_gen_toks=2048,tokenized_requests=False \
125
+ --tasks gsm8k \
126
+ --num_fewshot 5 \
127
+ --batch_size auto 2>&1 | tee gsm8k.log
128
+ ```
129
+
130
+ # License
131
+ Modifications Copyright(c) 2025 Advanced Micro Devices, Inc. All rights reserved.