Merged
[refactor] 退役 DeepSeek-V4 旧注意力 backend 转换入口 #1292
[refactor] 退役 DeepSeek-V4 旧注意力 backend 转换入口 #1292
Merged
hanboyouAdd on 20 days ago
hanboyou
hanboyouCollaborators
20 days ago

描述

维护中的配方已经使用原生 attention 配置与组件 override,旧 backend.py 只服务显式 legacy 调用。删除旧整层注意力/布局转换入口及其专属测试,将共用 LoRA 测试改为原生配置,并保留模型并行入口的 CP 拒绝检查。

功能归属:models/deepseek_v4/backend.py;关联原生组件/LoRA 验证与旧 TND 设计的支持范围说明一并处理。

类型

Checklist:

如何测试

基线:6e3c9320453c0e36875a1fb7f9af59abb57ed3b8;本分支:d7a9f0de542ab917a8dbf844596a0ea94daab1ec,目标为 dev_0.4.0。

TORCH_DEVICE_BACKEND_AUTOLOAD=0 OMP_NUM_THREADS=1 python -m pytest -v --tb=short -x tests/unit_tests/models/deepseek_v4/test_dsv4_config.py tests/unit_tests/models/deepseek_v4/test_lora_layers.py tests/unit_tests/models/deepseek_v4/test_lora.py tests/unit_tests/models/deepseek_v4/test_lora_training.py tests/unit_tests/models/deepseek_v4/test_lora_state_dict_adapter.py tests/unit_tests/override/deepseek_v4/test_components.py tests/unit_tests/override/deepseek_v4/test_native_compressor.py tests/unit_tests/override/deepseek_v4/test_native_sparse_attn.py

CPU 结果:34 项通过。本组共 1,056 行增删,其中 866 行为三份旧 backend 专属测试的删除。依照本次按文件/功能拆分的要求保留完整功能单元;未将其声明为低于 1k 行。

完整本地 pre-commit --all-files 已在 CI 对应的 Torch 2.14 类型环境通过;仅在独立配置中将 Pyrefly 查找路径指向固定 TorchTitan 0.4.0,保留全部 15 个 hooks,并使用实际 checkpoint/grain 依赖别名。训练 CPU 测试使用 Torch 2.15;其全项目类型检查与目标分支有相同 8 条既有诊断、无新增。OAT 另对本 PR 的实际变更文件完成实扫。

完整 CPU 套件使用 TORCH_DEVICE_BACKEND_AUTOLOAD=0 python -m pytest -v --tb=short tests/unit_tests(去掉 -x,执行全部收集用例):1203 passed / 75 skipped / 1 xfailed / 1 failed,原始 exit 1。剩余可复现失败均为 test_virtual_optimizer_dcp_roundtrip_preserves_two_rank_dtensor_shards:原生 DCP 在 fork 子进程中初始化 NPU,未修改的目标分支同样失败;未发现新增可复现失败,完整套件仍未全绿。

本地原始日志、JUnit、复现环境与基线比较;保留全量运行与失败项重跑的独立结果,未修改测试或增加跳过。

远端 CI #2700 已通过,UT 为 1196 passed / 82 skipped / 1 xfailed。已核对实际检出的合并提交父节点,分别为上述目标基线与本分支;CI 的 workflow head 与被测代码 head 分开核对。该结果补充 compile 入口的验证,NPU ST 和训练对齐状态见下文。

精度和性能验证结果

维护配方原已使用原生布局;本轮 CPU 检查覆盖原生组件、compressor/attention 前反向、LoRA 和 CP guard。当前分支的 NPU smoke/ST、100 步训练对齐与性能测试均未执行,保留草稿。

历史整组记录见 #1257,其基线为 c84d8b76、整组版本为 7c4f16f0;该记录不是本拆分分支的独立验证,也不用于声明本分支精度或性能通过。

其他信息

旧 backend/converter API 有意退役,不承诺其专属 checkpoint 的转换兼容性。维护中的 eager 路径仍要求 TP=CP=PP=1;文档明确区分旧版 geometry/CP 设计。 本 PR 是 #1257 的独立功能拆分,以草稿提交,等待对应分支的后续验证。

likedislike
Pull Request has been successfully merged by CANN-robot.
(Thank you for hanboyou's contribution.)
hanboyouhanboyouCollaborators
20 days ago Created pull request, commit 0578f3b6
CANN-robotCANN-robotCollaborators
20 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
20 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.
For more, you also can visit HICANN.


PR Approval Progress

✅ Congratulations! All modules have met the lgtm and approve requirements.

Module Approval Details

module lgtm status approve status
repo-cann/torchtitan-npu ✅ xuyujun, lrwei0709 (2/2) ✅ xuyujun (1/1)

💡 Tip:

  • Committer can comment /approve or /lgtm
  • Commenting /approve implies both code review (lgtm) and intent to merge (approve)

CLA Signature Pass

mystri, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
CANN-robotCANN-robotCollaborators
20 days ago Set hwcaifubi,lrwei0709,zhaowei1936,zhong_lin,zhanghz1,depeng1994,shengnan666,XDaoHong,xuyujun,zhuofanshen,wanghui0,panchao-gitcode,zzyyjj012 as approver
CANN-robotCANN-robotCollaborators
20 days ago Set hwcaifubi,lrwei0709,zhaowei1936,zhong_lin,zhanghz1,depeng1994,shengnan666,XDaoHong,xuyujun,zhuofanshen,wanghui0,panchao-gitcode,zzyyjj012 as approver
49 messages are collapsed here。 See more
weijinyi
weijinyiCollaborators
17 days ago Comments:

/lgtm

likedislike
xuyujun
xuyujunCollaborators
17 days ago Comments:

/approve

likedislike
CANN-robotCANN-robotCollaborators
17 days ago Added label: lgtmapproved
CANN-robotCANN-robotCollaborators
17 days ago Merged pull request
CANN-robot
CANN-robotCollaborators
17 days ago Comments:

Pull Request 已合并或已关闭。

If you want to solve this problem, you can click here to do it in the FAQs.

likedislike