Repository navigation
Conversation
shihaobai
self-requested a review
October 12, 2026 09:05
sufubao
force-pushed
the
mtp-output-refactor
branch
2 times, most recently
from
October 13, 2026 09:13
9a79666 to
4620950
Compare
sufubao
force-pushed
the
mtp-output-refactor
branch
from
October 13, 2026 09:44
4620950 to
5d94fa8
Compare
This reverts commit eb7a3a4.
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.
将 post layer 输出的收集职责统一到 MtpCollector.collect_post_output()。post layer 返回 logits、final_hidden 及可选的 token/confidence,BaseModel 交给 collector,collector 最终输出 ModelMtpOutput.spec_hidden 和 token/confidence。
基于 #1614 的 69ff8c0:draft registry 的 MtpPairConfig 按 draft checkpoint 的 model_type 与模式分别声明 main_final_hidden_policy、draft_final_hidden_policy。MtpManager 按 main/draft 角色解析并缓存配置,由 BaseModel 写入 infer_state.final_hidden_policy,post layer 直接读取。模型类不再持有 mtp_final_hidden_policy。collector 不持有 policy,也不参与 norm 决策。PostLayerOutput.final_hidden 保留“最终层 hidden”的含义;collector 将它或收集到的中间层 hidden 整理为投机解码使用的 spec_hidden。需要 final_hidden 却收到 None 时保留报错检查。
工作对象命名为 MtpCollector / infer_state.mtp_collector,结果对象命名为 ModelMtpOutput / model_output.mtp_output。DSpark、DFlash2 通过 PostLayerOutput 返回 token/confidence,同步 CUDA graph、proposer、静态 benchmark 和相关测试。普通 post layer 的计算逻辑与 #1614 一致。已同步最新 main,并适配 DFlash2 的 post layer、proposer 和测试。
依赖 #1614。当前 base qwen35-norm-fix 已快进至 69ff8c0,与 #1614 的最新 head 一致,分支间 diff 只包含后续重构及测试适配。本轮保留分支上已有提交并合入新基线,按要求保持 PR 关闭。若后续继续合并,先合并 #1614,再将本 PR 的 base 切回 main;不要直接合并到临时基线分支。
验证:547 项相关测试全部通过,覆盖 collector、infer-state 策略传递、模型输出、各模型 norm 与连续两步 draft、post layer、DSpark、CUDA graph 状态与布局、proposer、speculative utils、draft registry 和 tokenizer 导入隔离;pre-commit(Black、flake8)和 diff 检查通过。测试通过 exp 留档:261014-151958-python-m-pytest-q-unit-tests-common-basemodel-te。本轮未运行完整模型接受率、吞吐或真实 TP/DP 多卡对照。
最新分支提交为 a78370e。GitHub 保留了关闭时的 PR head/base 快照,且不允许刷新关闭 PR 的 base;此处按要求保持关闭。请通过最新分支差异查看本次代码。