Skip to content

Fix SpeculatorsConfig now that PreTrainedConfig is a dataclass in Transformers#37574

Merged
DarkLight1337 merged 2 commits intovllm-project:mainfrom
hmellor:fix-speculators-config-v5
Mar 19, 2026
Merged

Fix SpeculatorsConfig now that PreTrainedConfig is a dataclass in Transformers#37574
DarkLight1337 merged 2 commits intovllm-project:mainfrom
hmellor:fix-speculators-config-v5

Conversation

@hmellor
Copy link
Copy Markdown
Member

@hmellor hmellor commented Mar 19, 2026

Since Transformers converted PretrainedConfig to a dataclass, users will see unexpected keyword argument errors on SpeculatorsConfig.__init__.

This PR adds a passthrough so that SpeculatorsConfig.__init__ can accept kwargs and passes them directly to PretrainedConfig.__init__ which also accepts kwargs

…in Transformers

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) March 19, 2026 15:46
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request aims to fix an issue with SpeculatorsConfig initialization when used with newer versions of transformers where PretrainedConfig is a dataclass. The proposed change introduces a passthrough __init__ method. However, the implementation might be incomplete, as it could propagate the original error to the superclass constructor call. I've left a comment with a detailed explanation of the potential issue and how it could be addressed.

def __init__(self, **kwargs):
"""PretrainedConfig is a dataclass in Transformers v5.
This pass through is needed to avoid unexpected keyword arguments."""
super().__init__(**kwargs)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This fix may be incomplete. If the unexpected keyword argument error is due to PretrainedConfig being a dataclass with a standard generated __init__, that __init__ won't accept arbitrary **kwargs. Consequently, this call to super().__init__(**kwargs) will likely fail with the same error. The keyword arguments should be filtered to pass only those that PretrainedConfig.__init__ accepts. This can be done by inspecting the parent's __init__ signature.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're wrong, but the docstring didn't tell the whole story, I'll improve it.

@DarkLight1337 DarkLight1337 added ready ONLY add when PR is ready to merge/full CI is needed labels Mar 19, 2026
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@DarkLight1337 DarkLight1337 merged commit e5d96dc into vllm-project:main Mar 19, 2026
45 checks passed
@hmellor hmellor deleted the fix-speculators-config-v5 branch March 19, 2026 18:11
chooper26 pushed a commit to intellistream/vllm-hust that referenced this pull request Mar 21, 2026
…in Transformers (vllm-project#37574)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
SouthWest7 pushed a commit to SouthWest7/vllm that referenced this pull request Mar 27, 2026
…in Transformers (vllm-project#37574)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
khairulkabir1661 pushed a commit to khairulkabir1661/vllm that referenced this pull request Mar 27, 2026
…in Transformers (vllm-project#37574)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Monishver11 pushed a commit to Monishver11/vllm that referenced this pull request Mar 27, 2026
…in Transformers (vllm-project#37574)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Monishver Chandrasekaran <monishverchandrasekaran@gmail.com>
JiantaoXu pushed a commit to JiantaoXu/vllm that referenced this pull request Mar 28, 2026
…in Transformers (vllm-project#37574)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
vrdn-23 pushed a commit to vrdn-23/vllm that referenced this pull request Mar 30, 2026
…in Transformers (vllm-project#37574)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Vinay Damodaran <vrdn@hey.com>
EricccYang pushed a commit to EricccYang/vllm that referenced this pull request Apr 1, 2026
…in Transformers (vllm-project#37574)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: EricccYang <yangyang4991@gmail.com>
liuchenbing2026 pushed a commit to liuchenbing2026/vllm that referenced this pull request Apr 4, 2026
…in Transformers (vllm-project#37574)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
big-yellow-duck pushed a commit to EmbeddedLLM/vllm that referenced this pull request Apr 8, 2026
…in Transformers (vllm-project#37574)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
mtparet pushed a commit to blackfuel-ai/vllm that referenced this pull request Apr 9, 2026
…in Transformers (vllm-project#37574)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ONLY add when PR is ready to merge/full CI is needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants