Repository navigation
fix(checkpoint): 初始化被忽略的缺失模型状态 - #1468
Closed
xingleixu123 wants to merge 1 commit into
Closed
xingleixu123 wants to merge 1 commit into
xingleixu123 wants to merge 1 commit into
Conversation
将缺失状态初始化与告警过滤分离,保留 strict 和 DTensor 初始化边界。
This was referenced Nov 5, 2026
Contributor
Author
|
/check-pr |
Contributor
|
lgtm |
5 tasks done
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:
模型声明 _keys_to_ignore_on_load_missing 时,当前 finalizer 先过滤缺键,再据此选择初始化目标,导致被忽略的持久参数/buffer既没加载、也没初始化,strict=True却返回成功。真实meta/to_empty模型的缺失存储预置为71后,legacy、DCP都复现保留71。
本补丁只修改checkpoint_loader.py(+4/−2):在tied aliases消解后保留初始化用missing集合;ignore规则继续作用于strict检查及报告,真实缺失的持久状态仍进入现有guarded initializer。已加载值、tied别名、nonpersistent rebuild及其他strict缺键行为保持;缺失DTensor明确要求DTensor-aware initialization,从原静默跳过改为拒绝。
沿用HF guarded nn.init契约,不新增初始化框架、全量权重副本或模型专用条件。自定义_init_weights直接调用Tensor.zero_/copy_绕过guard不在自动保护范围;Xing4此类写入由#1439的e4013cfb单独修复。
Which issue(s) this PR fixes:
关联 #1467;模型初始化问题 #1466 / #1439 是独立修复。保持草稿问题开放,不因创建PR关闭。
Test Plan and Test result:
复现脚本、原始输出、源码绑定及限制
Code review checklist [illustration]:
本轮依请求只提交逻辑代码;必要的回归和复用用例按上方报告留在仓外。外部CI按新head另查,不将旧门禁结果归给本提交。