Merged
feat(w4a16): 支持 Qwen3 Dense 和 MoE 权重量化推理 #145
chen_pengyuAdd on 7 days ago
feat(w4a16): 支持 Qwen3 Dense 和 MoE 权重量化推理 #145
Merged
Pull Request has been successfully merged by ascend-robot.
(Thank you for chen_pengyu's contribution.)7 days ago Created pull request, commit 9c540037
7 days ago Associated issue: [Feature]: 支持 W4A16 QAT 权重转换及 Dense/MoE 推理
7 days ago Added label: stat/needs-squash
7 days ago Added label: ascend-cla/yes
ascend-robot
7 days ago Comments:
7 days ago Comments:
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.
You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
PR Approval Progress
✅ Congratulations! All modules have met the lgtm and approve requirements.
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-Ascend/torchao-ascend | ✅ wanglijun55, 褚博宁 (2/2) | ✅ wanglijun55 (1/1) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
chen_pengyu, thanks for your pull request. All authors of the commits have signed the CLA. 👍


158 messages are collapsed here。 See more
1 day ago Merged pull request
ascend-robot
1 day ago Comments:
1 day ago Comments:
Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


1 day ago Modify description of pull request
ascend-robot
1 day ago Comments:
1 day ago Comments:
Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


ascend-robot
1 day ago Comments:
1 day ago Comments:
Pull Request 已合并或已关闭。
If you want to solve this problem, you can click here to do it in the FAQs.


【合入来源】
基于当前
main更新 PR #130 的 W4A16 推理实现。【修改方案】
ee79318。实现 Dense 和融合 MoE 的 W4A16 Tensor,以及对应的 NPU 推理路径。Dense 导出直接保留沿 K 轴打包的原生 MXFP4 权重和 E8M0 scale,加载时搬运连续张量,前向使用转置视图调用npu_weight_quant_batchmatmul。MoE 保留 QAT 的输出轴量化,首次使用时反量化并缓存 BF16 权重,两组投影分别执行 grouped matmul。prepare入口。配对推断 MoE 专家布局,并在训练后独立打包推理权重。Dense 和 MoE Tensor 注册到通用 safetensors 编解码。9c1029d。覆盖 QAT、Dense 和 MoE 推理、权重布局、导出字节检查和 safetensors 往返。【资料变更】
增加了推理代码使用文档
【接口变更】
W4A16LinearConfig和W4A16GMMConfig新增仅限关键字的step,默认且支持prepare。训练结束后通过pack_checkpoint_weights()导出供推理使用的权重。torchao_ascend.features.inference.w4a16提供 Dense 和 GMM 推理 Tensor。Dense checkpoint 使用原生 K 轴打包格式。【功能验证】
【CheckList】