已开启
feat: 支持量化结果持久化与恢复第一里程碑 #267
sunshine750创建于 17 天前
feat: 支持量化结果持久化与恢复第一里程碑 #267
已开启
合并受阻
17 天前 创建了 pull request,commit 236b2933
atomgit-bot
17 天前 评论:
17 天前 评论:
🤖 正在生成合并请求摘要,请稍候…


不准确?
atomgit-bot
17 天前 评论:
17 天前 评论:
🤖 AI 代码检视正在进行中,请稍候…


不准确?
17 天前 添加了label:cann-cla/yes
CANN-robot
17 天前 评论:
17 天前 评论:
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.
For more, you also can visit HICANN.
PR Approval Progress
⚠️ This PR does not yet meet the following requirements:lgtm (requires ≥ 2 person(s) per module)、approve (requires ≥ 1 person(s) per module)
Module Approval Details
| module | lgtm status | approve status |
|---|---|---|
| repo-cann/amct | ❌ (0/2)(You can also ask: wulinyu, fujun19, 金瑛琪, sophia1213, 姚广修) | ❌ (0/1)(You can also ask: wulinyu, 梁横溢, sophia1213, 姚广修, li_ting) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies both code review (lgtm) and intent to merge (approve)
CLA Signature Pass
sunshine750, thanks for your pull request. All authors of the commits have signed the CLA. 👍


此处折叠了124条消息 查看更多
Ssunshine750
5 天前 update merge request[project id: 8782573, iid: 267, commit_id: 8c4d5a20276af6837f035caeb047f270b8b46311] virtual merging success
5 天前 update merge request[project id: 8782573, iid: 267, commit_id: 8c4d5a20276af6837f035caeb047f270b8b46311] virtual merging success
5 天前 推送 1 个提交:166445ec-Revert "docs: publish week1-4 requirement documents"
Ssunshine750
5 天前 update merge request[project id: 8782573, iid: 267, commit_id: 700837c8bad11a677519b2da3416195733383c61] virtual merging success
5 天前 update merge request[project id: 8782573, iid: 267, commit_id: 700837c8bad11a677519b2da3416195733383c61] virtual merging success
5 天前 删除了label:cann-cla/yes
5 天前 添加了label:cann-cla/yes
描述
本 PR 完成 Classic 量化结果持久化与恢复的第一里程碑,范围仅包含 Classic API,不包含 Qwen3.8、LLM CLI、benchmark、模型文件或样例改动。
原有
quantize(model, config)只把校准结果保留在当前进程的量化模块中,进程结束后无法复用。本次为quantize()和convert()增加可选的quant_result_dir:quant_result_dir=None时沿用原有内存量化和转换流程,convert(model)的返回值仍为None。quant_manifest.json。文件大小、SHA-256、header、tensor key/dtype/shape 和 entry digest 在发布前重新校验。fsync和os.replace原子落盘;manifest 最后发布。这样中断运行只会留下没有 manifest 的未发布目录,不会被误当成完整产物。convert(model, quant_result_dir)先校验 manifest、目录、源模型指纹和全部单元,再从注册表反查量化类并恢复校准态,最后复用既有 deploy 转换流程。这里没有按文件名扫描目录或从 artifact 动态导入类。文件名不能表达完整量化配置,也无法判断目录是否完整;动态导入则会扩大不可信输入的执行面。manifest 是唯一配置源,量化类只能从现有
AlgorithmRegistry反查。本次同时落实了评审意见:生产代码使用最终格式命名;目录必须由调用方创建且允许无关文件共存;writer 只管理自己的文件并保持内部实现属性最小化;指纹参数统一命名为
model_fingerprint;不在 reload 中重复convert()已负责的模型入口检查;仅暴露真正稳定的用户接口。额外审查补齐了算法状态完整性校验:MinMax 根据渐进量化、激活量化和对称配置检查必需 scale/offset;AWQ、GPTQ 在非对称配置下检查
offset_w;GPTQ 必须携带不可重算的优化后weight。校验发生在事务提交前,避免结构合法但算法参数不完整的 artifact 被加载。如何测试
聚焦测试:
结果:466 passed。包含 MinMax、AWQ、GPTQ 的 artifact 往返、事务回滚、格式/完整性负例和真实 NPU deploy-forward 对照。
全量回归对照:
最新 master:48 failed / 1510 passed / 7 skipped / 130 errors。
本分支:48 failed / 1868 passed / 17 skipped / 130 errors。
两侧 JUnit 中 178 个 failed/error 测试 ID 集合完全一致,本分支无新增失败;现有失败来自环境缺少可选依赖及上游既有用例。
工程检查:
pre-commit全部通过,包含 ruff、format、codespell、私钥检测和 OAT 开源合规检查;git diff --check通过。构建:
bash build.sh --torch成功生成amct_pytorch-1.1.0-py3-none-linux_aarch64.tar.gz。文档更新
无。协议字段、行为边界和兼容性说明已写入新增模块及公开 API 的 docstring;本 PR 不引入独立用户文档,避免带入第一里程碑以外的内容。
类型标签