Merged
增加DeepSeek V3.1模型量化适配 #3973
Matrix_KAdd on Sep 11, 2025
增加DeepSeek V3.1模型量化适配 #3973
Merged
Merged fromMatrix_K/msitmasterintoAscend/msitmaster
Total: 3 files changed+232-1
| @@ -232,6 +232,41 @@ python3 quant_deepseek_w8a8.py --model_path {浮点权重路径} --save_path {W8 | |||
| 232 | --rot | 232 | --rot |
| 233 | ``` | 233 | ``` |
| 234 | 234 | ||
| 235 | +##### DeepSeek-v3.1 w8a8 混合量化 + mtp 量化 | ||
| 236 | +- 生成DeepSeek-v3.1 w8a8 混合量化 + mtp 量化 | ||
| 237 | + ```shell | ||
| 238 | + python3 quant_deepseek_w8a8.py \ | ||
| 239 | + --model_path {浮点权重路径} \ | ||
| 240 | + --save_path {W8A8量化权重路径} \ | ||
| 241 | + --batch_size 8 \ | ||
| 242 | + --anti_dataset ./anti_prompt_50_v3_1.json \ | ||
| 243 | + --calib_dataset ./calib_prompt_50_v3_1.json \ | ||
| 244 | + --anti_method m4 \ | ||
| 245 | + --quant_mtp mix \ | ||
| 246 | + --rot | ||
| 247 | + ``` | ||
| 248 | + | ||
| 249 | +##### DeepSeek-v3.1 w8a8c8 混合量化 + mtp 量化 | ||
| 250 | +- 生成DeepSeek-v3.1 w8a8c8 混合量化 + mtp 量化 | ||
| 251 | + ```shell | ||
| 252 | + python3 quant_deepseek_w8a8.py \ | ||
| 253 | + --model_path {浮点权重路径} \ | ||
| 254 | + --save_path {W8A8量化权重路径} \ | ||
| 255 | + --batch_size 8 \ | ||
| 256 | + --anti_dataset ./anti_prompt_50_v3_1.json \ | ||
| 257 | + --calib_dataset ./calib_prompt_50_v3_1.json \ | ||
| 258 | + --anti_method m4 \ | ||
| 259 | + --quant_mtp mix \ | ||
| 260 | + --rot \ | ||
| 261 | + --fa_quant | ||
| 262 | + ``` | ||
| 263 | + | ||
| 264 | +##### 生成DeepSeek-v3.1模型 w4a8 混合量化权重 | ||
| 265 | + ```shell | ||
| 266 | + python3 quant_deepseek_w4a8.py --model_path {浮点权重路径} --save_path {W4A8量化权重路径} --anti_dataset ./anti_prompt_50_v3_1.json --calib_dataset ././calib_prompt_50_v3_1.json --quant_mtp mix --batch_size 16 | ||
| 267 | + ``` | ||
| 268 | + | ||
| 269 | + | ||
| 235 | ##### DeepSeek-V3/R1量化QA | 270 | ##### DeepSeek-V3/R1量化QA |
| 236 | 271 | ||
| 237 | - Q:报错 This modeling file requires the following packages that were not found in your environment: flash_attn. Run ' | 272 | - Q:报错 This modeling file requires the following packages that were not found in your environment: flash_attn. Run ' |
| @@ -246,4 +281,4 @@ python3 quant_deepseek_w8a8.py --model_path {浮点权重路径} --save_path {W8 | |||
| 246 | - A: 由于当前transformers不支持FP8量化格式加载,需要将权重文件夹中config.json中的以下字段删除: | 281 | - A: 由于当前transformers不支持FP8量化格式加载,需要将权重文件夹中config.json中的以下字段删除: |
| 247 | -  | 282 | -  |
| 248 | - Q: 量化后保存的 description 文件中多出了 61 层的信息,且量化类型为 float | 283 | - Q: 量化后保存的 description 文件中多出了 61 层的信息,且量化类型为 float |
| 249 | -- A: 当前工具并没有对 61 层进行量化,只是将数据先添加到量化后的权重中 | 284 | +- A: 61层为MTP层,目前支持进行量化 |