create model
#1
by
haoyang-amd
- opened
README.md
DELETED
|
@@ -1,129 +0,0 @@
|
|
| 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 [unsloth/DeepSeek-R1-0528-BF16](https://huggingface.co/unsloth/DeepSeek-R1-0528-BF16).
|
| 34 |
-
|
| 35 |
-
**Quantization scripts:**
|
| 36 |
-
```
|
| 37 |
-
cd Quark/examples/torch/language_modeling/llm_ptq/
|
| 38 |
-
exclude_layers="*self_attn* *mlp.gate.* *lm_head"
|
| 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-Preview
|
| 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, GPQA Diamond, and MATH-500 benchmarks using the [lighteval](https://github.com/huggingface/lighteval/tree/v0.10.0) framework. Each benchmark was run 10 times with different random seeds for reliable performance estimation.
|
| 57 |
-
|
| 58 |
-
### Accuracy
|
| 59 |
-
|
| 60 |
-
<table>
|
| 61 |
-
<tr>
|
| 62 |
-
<td><strong>Benchmark</strong>
|
| 63 |
-
</td>
|
| 64 |
-
<td><strong>DeepSeek-R1-0528 </strong>
|
| 65 |
-
</td>
|
| 66 |
-
<td><strong>DeepSeek-R1-0528-MXFP4-Preview(this model)</strong>
|
| 67 |
-
</td>
|
| 68 |
-
<td><strong>Recovery</strong>
|
| 69 |
-
</td>
|
| 70 |
-
</tr>
|
| 71 |
-
<tr>
|
| 72 |
-
<td>AIME24
|
| 73 |
-
</td>
|
| 74 |
-
<td>88.00
|
| 75 |
-
</td>
|
| 76 |
-
<td>85.00
|
| 77 |
-
</td>
|
| 78 |
-
<td>96.59%
|
| 79 |
-
</td>
|
| 80 |
-
</tr>
|
| 81 |
-
<tr>
|
| 82 |
-
<td>GPQA Diamond
|
| 83 |
-
</td>
|
| 84 |
-
<td>79.90
|
| 85 |
-
</td>
|
| 86 |
-
<td>79.34
|
| 87 |
-
</td>
|
| 88 |
-
<td>99.31%
|
| 89 |
-
</td>
|
| 90 |
-
</tr>
|
| 91 |
-
<tr>
|
| 92 |
-
<td>MATH-500
|
| 93 |
-
</td>
|
| 94 |
-
<td>97.06
|
| 95 |
-
</td>
|
| 96 |
-
<td>97.84
|
| 97 |
-
</td>
|
| 98 |
-
<td>100.80%
|
| 99 |
-
</td>
|
| 100 |
-
</tr>
|
| 101 |
-
</table>
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
### Reproduction
|
| 105 |
-
|
| 106 |
-
The results of AIME24, MATH-500, and GPQA Diamond, were obtained using forked [lighteval](https://github.com/zhaolin-amd/lighteval/tree/v0.10-release-custom) and vLLM docker (emulation qdq) `rocm/vllm-private:pytorch-vllm-gfx950-mxfp4-mxfp6-v3`.
|
| 107 |
-
|
| 108 |
-
```
|
| 109 |
-
# Set docker env
|
| 110 |
-
export VLLM_QUARK_F4F6_OFFLINE_DEQUANT_TMPENVVAR=1
|
| 111 |
-
|
| 112 |
-
# Set model args
|
| 113 |
-
OUTPUT_DIR="results/DeepSeek-R1-0528-MXFP4-Preview-Seed"
|
| 114 |
-
LOG="logs/deepseek_0528_maxfp4.log"
|
| 115 |
-
|
| 116 |
-
# Evaluating 10 rounds
|
| 117 |
-
for i in $(seq 1 10); do
|
| 118 |
-
# seed in [0, 2**30 - 1]
|
| 119 |
-
SEED=$(shuf -i 0-1073741823 -n 1)
|
| 120 |
-
MODEL_ARGS="model_name=amd/DeepSeek-R1-0528-MXFP4-Preview,dtype=bfloat16,tensor_parallel_size=8,max_model_length=71536,max_num_batched_tokens=32768,gpu_memory_utilization=0.85,generation_parameters={max_new_tokens:65536,temperature:0.6,top_p:0.95,seed:$SEED}"
|
| 121 |
-
|
| 122 |
-
lighteval vllm $MODEL_ARGS "custom|aime24_single|0|0,custom|math_500_single|0|0,custom|gpqa:diamond_single|0|0" \
|
| 123 |
-
--use-chat-template \
|
| 124 |
-
--output-dir "$OUTPUT_DIR/seed_$SEED" \
|
| 125 |
-
2>&1 | tee -a "$LOG"
|
| 126 |
-
```
|
| 127 |
-
|
| 128 |
-
# License
|
| 129 |
-
Modifications Copyright(c) 2025 Advanced Micro Devices, Inc. All rights reserved.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|