已合并
[feature]FA MXFP8 特性提交,新注册标识字符串“MXFP8_DYNAMIC”,并同步提交量化代码类 #375
乐加维林创建于 6月22日
[feature]FA MXFP8 特性提交,新注册标识字符串“MXFP8_DYNAMIC”,并同步提交量化代码类 #375
已合并
乐
乐加维林
6月22日
6月22日
# Purpose
接入FA MXFP8_DYNAMIC量化算法:
读取模型权重描述文件,识别对应attn层使能MXFP8_DYNAMIC量化算法,保存对应attn层的旋转矩阵
为对应的attn添加FA量化算法'fa_quant':在传入FA算子前,先将Q、K进行@旋转&MXFP8量化
# Test Plan
> 设计了哪些测试内容,指导他人如何对你的PR进行测试\
> Apply information to show others your test design and how to test your Pull Request
模型侧通过对应层是否包含'fa_quant"成员判断是否使能FA量化,并传入对应layout的Q/K/V,观察量化前后的加速比和精度损失情况。
参考test_quantize.py:test_add_fa_quant_with_valid_layer
# Test Report
Wan2.2-T2V-A14B测试情况:精度肉眼观测无问题,单算子性能接近FP8 tiling256
UT运行结果:
```
python test_quantize.py
.................../usr/local/lib/python3.11/site-packages/mindiesd/quantization/layer.py:185: UserWarning: The use of `x.T` on tensors of dimension other than 2 to reverse their shape is deprecated and it will throw an error in a future release. Consider `x.mT` to transpose batches of matrices or `x.permute(*torch.arange(x.ndim - 1, -1, -1))` to reverse the dimensions of a tensor. (Triggered internally at /pytorch/aten/src/ATen/native/TensorShape.cpp:4416.)
weight_scale = get_quant_weight(weights, f'{prefix}.weight_scale').T.to(self.dtype)
.....s...............
----------------------------------------------------------------------
Ran 40 tests in 0.179s
OK (skipped=1)
```


Pull Request已成功合入, 合并人@ascend-robot
(感谢 乐加维林 的贡献)6月22日 添加了label:stat/needs-squash
6月22日 添加了label:ascend-cla/yes
ascend-robot
6月22日 评论:
6月22日 评论:
Thanks for your pull-request.
The full list of commands accepted by me can be found at here。
You can get sig-info at here
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/MindIE-SD | ✅ 胡英红, mazhixin00_00 (2/2) | ✅ 胡英红 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
LagavulinNeat, thanks for your pull request. All authors of the commits have signed the CLA. 👍


6月22日 添加了label:ci-pipeline-running
此处折叠了200条消息 查看更多
阿红
6月25日 评论:
6月25日 评论:
/check-pr


ascend-robot
6月25日 评论:
6月25日 评论:
The following label is not ready.
keeper_approved: Please wait for keeper to merge the code.


6月25日 添加了label:keeper_approved
6月25日 合入了pull request