Repository navigation
fix(dtensor): 支持常数初始化并保持原位张量身份 - #1470
Closed
xingleixu123 wants to merge 1 commit into
Closed
xingleixu123 wants to merge 1 commit into
xingleixu123 wants to merge 1 commit into
Conversation
复用逐元素布局推导注册 constant_,并支持关键字 tensor 的原位返回。 保留 Partial 与 Ragged 的现有拒绝规则,不引入随机初始化路径。
Contributor
Author
|
/check-pr |
This was referenced Nov 5, 2026
This was referenced Nov 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
/kind bug
What does this PR do / why do we need it:
FSDP包装后的HF模型调用torch.nn.init.constant_时,HP DTensor因缺少布局规则而在训练前报错。PyTorch以tensor关键字进入分发,仅补算子注册还会返回新wrapper,不满足原位初始化返回原对象的契约。
本补丁仅改两文件(+11/−4):通过YAML复用ElementWiseDistributedOp,并在原位结果恢复中支持constant_及tensor关键字。没有复制初始化算法或增加模型专用分支;HF已加载tensor的guard、现有Partial/Ragged拒绝边界保留,不消耗随机状态,不改变训练数学。
Which issue(s) this PR fixes:
关联 #1469。#1439/#1466的guarded初始化需要这项通用能力;#1468是独立HF部分加载问题。
Test Plan and Test result:
Code review checklist [illustration]:
本轮保持逻辑代码提交范围,复用测试及必要外置回归脚本/原始结果随总跟踪证据归档。外部CI按本提交另查,不以旧通过标签代替新head的门禁结果。