Fix verifier kwarg leaking into draft model constructors - #669
Merged
Conversation
Contributor
📝 WalkthroughWalkthrough
ChangesVerifier routing in loading
Sequence Diagram(s)sequenceDiagram
participant U as User
participant SPF as "SpeculatorModel.from_pretrained"
participant ECP as "external-checkpoint conversion path"
participant CAK as "callable_accepts_kwarg"
participant TSI as "target subclass __init__"
U->>SPF: verifier
SPF->>ECP: verifier string/path or None
SPF->>CAK: inspect TSI for verifier
CAK-->>SPF: accepts / rejects
SPF->>TSI: kwargs with verifier when accepted
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
rahul-tuli
force-pushed
the
fix/from-pretrained-verifier-kwarg-leak
branch
from
June 26, 2026 13:34
3dffa2e to
f562cf2
Compare
rahul-tuli
marked this pull request as ready for review
June 26, 2026 13:36
Signed-off-by: shanjiaz <hezhao@redhat.com>
build_draft_model passes verifier=... to from_pretrained for the external-checkpoint auto-convert path. SpeculatorModel.from_pretrained had no verifier parameter, so it stayed in **kwargs, was forwarded to HF's from_pretrained, and reached the model constructor cls(config, **kwargs). Draft models take only `config`, so this raised: TypeError: Eagle3DraftModel.__init__() got an unexpected keyword argument 'verifier' Make verifier an explicit named parameter of from_pretrained so it is consumed (never forwarded to the constructor) and used directly for auto-conversion; forward it through the base-class re-dispatch alongside t2d/d2t. Stacked on #672 (eagle converter removal): with the attachment-style EagleSpeculator gone, no model constructor needs verifier, so consuming it at the loader boundary is sufficient. Signed-off-by: Rahul-Tuli <rtuli@redhat.com>
rahul-tuli
force-pushed
the
fix/from-pretrained-verifier-kwarg-leak
branch
from
June 26, 2026 15:19
f2a6e21 to
b135ff3
Compare
shanjiaz
approved these changes
Jun 26, 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.
Purpose
Fix
TypeError: Eagle3DraftModel.__init__() got an unexpected keyword argument 'verifier'raised during draft model construction inscripts/train.py --from-pretrained.This breaks the EAGLE3 finetuning smoke test:
build_draft_modelpassesverifier=args.verifier_name_or_pathtofrom_pretrained(for the external-checkpoint auto-convert path added in #617).SpeculatorModel.from_pretrainedhad noverifierparameter, so it stayed in**kwargs, was forwarded to HF'sfrom_pretrained, and reached the model constructorcls(config, **kwargs). Draft models take onlyconfigand reject it.Fix
Make
verifieran explicit named parameter ofSpeculatorModel.from_pretrainedso it is consumed at the loader boundary (never forwarded into the constructor), used directly for auto-conversion, and forwarded through the base-class re-dispatch alongsidet2d/d2t.With the attachment-style
EagleSpeculatorremoved in #672, no model constructor takesverifieranymore, so consuming it is sufficient — no per-model special-casing needed.Tests
tests/e2e/smoke/test_finetuning_sanity.py::test_finetuning_weight_sanity(covered on CI).make style/make quality: pass.pytest tests/unit/test_model.py tests/unit/convert/test_entrypoints.py: 20 passed.Checklist
I have filled in: