已开启
[Feature]: 支持 DSA/MHC/MTP/shared expert 结构切分模板 #386
liu_luobin创建于 11 天前
11 天前 添加了label:feature
Lliu_luobin
11 天前 关联了pull request:feat: add DSA/MHC/MTP/shared_expert sharding templates and adapt category refactor
11 天前 关联了pull request:feat: add DSA/MHC/MTP/shared_expert sharding templates and adapt category refactor
Lliu_luobin
7 天前 关联了pull request:feat: add DSA/MHC/MTP/shared_expert sharding templates and rework TP head-count and loss parallel
7 天前 关联了pull request:feat: add DSA/MHC/MTP/shared_expert sharding templates and rework TP head-count and loss parallel
🚀 功能描述
背景
distributed/_builder的切分规划仅覆盖标准 attention/mlp/norm 边界,DSA/MLA 稀疏注意力、MTP 层、TP-extends-EP 下的 MoE shared expert 等模型专属结构只能由用户手写 plan override 才能正确切分;且 DSA 的 query/index 投影按 TP 切分后,缓存的 head 数挂在父 attention 模块上,现有逻辑只更新叶边界自身,导致 head 数不生效。目标
num_index_headshead 属性。loss_parallel_ops反传去除高级索引写入,改为掩码 + 安全索引的等价实现。交付
dsa_template.py、mtp_template.py、mhc_template.py、shared_expert_template.py,注册进 planner 的结构模板 provider 列表。recipe_spec.py新增 head-count 归属字段,rule_resolver.py纳入 override 合并,parameter_sharding.py在切分后写回归属模块。tests/components/distributed/下四个模板用例、tests/ut/platform/torch/test_loss_parallel_ops.py。验证
单卡 CPU 执行模板 UT 12 passed、loss parallel UT 6 passed;多卡 ST 与全量 UT 待补充。
关联 PR:<PR 链接>
现有替代方案
扩充现有的TP模板
与DFX相关性DF
提议的新API
是否影响现有API
无
补充信息
Thanks for contributing 🎉!