The current Pull Request has been closed by hanboyou.
🤖 正在生成合并请求摘要,请稍候…


🤖 AI 代码检视正在进行中,请稍候…


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: zhuofanshen, hwcaifubi, xuyujun, zhaowei1936, zhanghz1) | ❌ (0/1)(You can also ask: wanghui0, zhuofanshen, 张德鹏, xuyujun, zhaowei1936) |
💡 Tip:
- Committer can comment
/approveor/lgtm- Commenting
/approveimplies 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. 👍


⚠️ 本次变更过大(217 个可审文件、12750 行,预估需 11 轮分片审查),已超出 AI 代码评审的处理范围,本次跳过。建议拆分为更小的 PR 以获得有效评审。


⚠️ 本次变更过大(217 个可审文件、12750 行,预估需 11 轮分片审查),已超出 AI 代码评审的处理范围,本次跳过。建议拆分为更小的 PR 以获得有效评审。


当前PR改动代码超过1k行,建议拆分PR后合入。
问题编号:R1173-001
审查版本:c859839d7e5dfb6912721d4f0ad7033770a5112a


当前PR改动代码超过1k行,建议拆分PR后合入。
问题编号:R1173-001
审查版本:c859839d7e5dfb6912721d4f0ad7033770a5112a


Resolved on dev_0.4.0. The package now declares torchtitan==0.4.0 for the native recipes. The dc3985ad pin is from the earlier packaged-recipe draft.


Resolved on dev_0.4.0. The supported launcher loads a Python recipe and forwards the native CLI options. The recipe now owns the HF assets and checkpoint settings that this shell wrapper supplied as legacy flags.


Resolved on dev_0.4.0. The V4 A3 factory now applies the native deepseek_v4_lora_transform(rank=16, alpha=32) and derives the optimizer from the transformed model.


Could the V4.1 default schedule create a resumable checkpoint before its final PEFT export? The current public factory still inherits 100 training steps and the 500-step checkpoint interval, while the guide overrides the schedule to produce an intermediate DCP.


Could the native replacement keep a first-update check for expert adapter ownership after freezing Engram? The pre-migration recipe builds a derived Muon config here, while the current recipe assembles typed groups after the LoRA transform.


Could a supported V4.1 text recipe expose its Grain corpus source? This archived factory accepted a dataset argument, whereas the current text recipe sets the source to the bundled C4 fixture. Making the source explicit would prevent an otherwise successful launch from using sample data.


Could the supported native recipe test assert its resolved RoPE and optimizer-override list in a fresh process? This archived factory selected a golden or fused list. The current public V4.1 LoRA factory explicitly selects fused_attention=False and swap_optimizer=False, and any opt-in fused variant can be validated separately.


The golden switch defaults to a CPT factory in either branch when CONFIG is unset. Could any A5 LoRA documentation name the explicit adapter recipe and verify that its first update uses the intended block-FP8 policy for frozen weights and BF16 adapter tensors? The default CPT run covers its own configuration.


描述
迁移到上游 TorchTitan 0.4.0(
dc3985ad)的「配置即 Python」启动方式:一次运行由返回完整Trainer.Config的 recipe 函数描述,通过--module <module> --config <function>选择,--section.optionCLI 仅作为兼容层保留。本 PR 分两层完成:
Python recipe + thin launcher(
refactor: move text and vision training configurations into Python recipes)torchtitan_npu_recipes/,把原先散落在examples/**/*.sh的--section.option拼接、环境变量数据注入(DATASET/DATASET_PATH/USE_GOLDEN/USE_TILELANG等)收敛为具名 recipe。examples/**/*.sh瘦身为只保留进程数、节点地址、CANN/HCCL 环境、资源路径与MODULE/CONFIG选择。对齐上游 recipes 布局 + 移出 opt-in override(
refactor: adopt torchtitan recipes layout and move opt-in overrides)torchtitan_npu_recipes/重构为models/、graph_trainer/、overrides/、tests/,镜像上游torchtitan_recipes。_apply_*配置改写函数,改为直接构造 typed config 块 + 小步derive(base, type(base), **typed_blocks)变体;override.imports保持显式有序元组。torchtitan_npu.override迁到torchtitan_npu_recipes.overrides(common 与各模型),可复用实现类留在torchtitan_npu/models/*、extensions/cpu_offload,核心插件包不再反向依赖 recipes。类型
Checklist:
如何测试
cd torchtitan-npu-config-migration TORCH_DEVICE_BACKEND_AUTOLOAD=0 OMP_NUM_THREADS=4 TORCHTITAN_DIR=/tmp/torchtitan \ PYTHONPATH=/tmp/torchtitan:$PWD:$PWD/../.test-deps/attn_gym_016:$PYTHONPATH \ python -m pytest tests/unit_tests -q --tb=line -p no:cacheprovider结果:1308 passed, 97 skipped, 0 failed, 0 errors(已基于当前
dev_0.4.0重新 rebase 并全量跑通;迁移前冻结基线在首个失败处停止)。其他验证:
ConfigManager的--module/--config+ 生产apply_overrides覆盖 RoPE/RMSNorm/dispatcher/sparse attention,并传递参数化几何{"num_heads":16,"index_num_heads":8}。精度和性能验证结果
纯配置形状/归属重构,不改动数学、dtype、checkpoint key、DTensor/分片或编译语义。以同一 seed checkpoint 做 100 步 loss/grad_norm 逐值对比(未截断)为 bitwise 一致。未在真实 NPU 上重新训练;已存在的 V4 golden 数值差异(12.2756 vs 12.2360)与 NPU 阻塞项(Qwen CUDA-only
causal_conv1d、CANN SMLAG tiling、Triton mHC/GDN CI 排除)均不在此变更范围,未声称修复。其他信息
dev_0.4.0(93f956c1),固定 TorchTitandc3985ad4912f67f71d5a125f2fdf40144ec8354。已 rebase 到当前dev_0.4.0,与既有的 V3.2 varlen-CP 移除(!1150)和 Muon/NovaSwap 适配(!1153)做了归并(主要影响测试用例的 override 路径与 Muon profile 命名)。migration/vision-grain-040)分离,只包含配置迁移。torchtitan_npu/override/已删除;torchtitan_npu不再(直接或惰性)导入torchtitan_npu_recipes,由子进程契约测试约束。runs/config-layout-migration-20261103/dsh/completion-report.md。