Closed
[refactor] 删除 DeepSeek-V4 未使用的初始化辅助项 #1288
hanboyouAdd on 19 days agoClosed at 19 days ago
[refactor] 删除 DeepSeek-V4 未使用的初始化辅助项 #1288
Closed
hanboyouAdd on 19 days agoClosed at 19 days ago
hanboyou
hanboyouCollaborators
19 days ago

描述

__init__.py 留有当前构建路径不再调用的初始化常量和两个 depth helper。删除这些定义及独占的 depth_scaled_std 导入;继续使用当前实际生效的初始化配置和上游 block 构造。

功能归属:models/deepseek_v4/__init__.py 的未使用初始化定义;mHC 导入仍保留原路径,由独立 imports PR 处理。

类型

Checklist:

如何测试

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

TORCH_DEVICE_BACKEND_AUTOLOAD=0 OMP_NUM_THREADS=1 python -m pytest -v --tb=short tests/unit_tests/models/deepseek_v4/test_dsv4_config.py tests/unit_tests/models/deepseek_v4/test_import_order.py

CPU 结果:9 项通过。现有 fresh-process 检查分别覆盖 upstream-first 与 plugin-first 导入顺序,并比较 routed expert 前向和反向的独立 CPU 预期。

完整本地 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,执行全部收集用例):1247 passed / 75 skipped / 1 xfailed / 2 failed,原始 exit 1。另一项 tooling 临时路径失败在物理可执行短路径下重跑通过。剩余可复现失败均为 test_virtual_optimizer_dcp_roundtrip_preserves_two_rank_dtensor_shards:原生 DCP 在 fork 子进程中初始化 NPU,未修改的目标分支同样失败;未发现新增可复现失败,完整套件仍未全绿。

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

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

精度和性能验证结果

删除项不参与当前模型构建或计算;本轮复用配置与导入顺序 CPU 检查。当前分支的 NPU smoke/ST、100 步整网对齐及性能测试均未执行,保留草稿。

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

其他信息

仅删除未使用的私有定义;本 PR 没有修改初始化采样规则或 checkpoint 布局。 本 PR 是 #1257 的独立功能拆分,以草稿提交,等待对应分支的后续验证。

likedislike
The current Pull Request has been closed by hanboyou.
hanboyouhanboyouCollaborators
19 days ago Created pull request, commit 3dec7baa
CANN-robotCANN-robotCollaborators
19 days ago Added label: cann-cla/yes
CANN-robot
CANN-robotCollaborators
19 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

⚠️ 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/torchtitan-npu ❌ (0/2)(You can also ask: 盛楠, 钟林, 徐道鸿, zhanghz1, zzyyjj012) ❌ (0/1)(You can also ask: xuyujun, 钟林, panchao-gitcode, zhanghz1, 徐道鸿)

💡 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
19 days ago Set hwcaifubi,lrwei0709,zhaowei1936,zhong_lin,zhanghz1,depeng1994,shengnan666,XDaoHong,xuyujun,zhuofanshen,wanghui0,panchao-gitcode,zzyyjj012 as approver
CANN-robotCANN-robotCollaborators
19 days ago Set hwcaifubi,lrwei0709,zhaowei1936,zhong_lin,zhanghz1,depeng1994,shengnan666,XDaoHong,xuyujun,zhuofanshen,wanghui0,panchao-gitcode,zzyyjj012 as approver
hanboyouhanboyouCollaborators
19 days ago Modify description of pull request
hanboyou
hanboyouCollaborators
19 days ago Comments:

compile

likedislike
hanboyouhanboyouCollaborators
19 days ago Pre merge succeeded (commit_id: 1cff1f0381fa57f772f07ba1ee5dae8a8d9cfb82)
CANN-robot
CANN-robotCollaborators
19 days ago Comments:
🚀 CI 流水线已启动
📋 执行详情: 点击查看流水线
likedislike
CANN-robotCANN-robotCollaborators
19 days ago Added label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
19 days ago Removed label: ci-pipeline-running
CANN-robotCANN-robotCollaborators
19 days ago Added label: ci-pipeline-passed
hanboyouhanboyouCollaborators
19 days ago Modify description of pull request
hanboyouhanboyouCollaborators
19 days ago Draft state has been cancelled
hanboyouhanboyouCollaborators
19 days ago Close pull request