| [fix] fix fake backend bug
Co-authored-by: 1Fire4<wangdingyi2@huawei.com>
# message auto-generated for no-merge-commit merge:
!262 merge fix/dsv4_fake_backend_ep into master
[fix] fix fake backend bug
Created-by: hitwdy
Commit-by: 1Fire4
Merged-by: cann-robot
Description: ## 描述
修复开启fake_backend 对 MoE expert-parallel 的 all-to-all split/output shape 处理不正确问题。
解决方案:只在 dist.get_backend(group) == "fake" 时绕过 fake all-to-all 的 token-count 交换,用本地 num_tokens_per_expert 合成稳定 layout,并在 combine 阶段直接 _unpermute
## 类型
- [x] Bug 修复
- [ ] 新功能
- [ ] 重构(即不是新增功能,也不是修改bug的代码变动)
- [ ] 构建过程或辅助工具的变动
- [ ] 文档内容更新
## Checklist:
- [x] 我的代码遵循这个项目的代码风格
- [x] 我已经自己测试过我的代码
- [x] 我已经更新了相应的文档
- [x] 我已经在标题中正确使用了类型标签(例如:feat, fix, refactor, docs, test)
## 如何测试
COMM_MODE="fake_backend" bash scripts/run_train.sh
- 测试结果
deepseekv3 v32 v4均成功跑通
- v3 — loss nan(应该属于fake PG 预期,待进一步check)
- v32 — loss 12.28
- v4 — loss 12.28
See merge request: cann/torchtitan-npu!262 | 15 小时前 |