Skip to content

Fix custom processors that use deleted behaviour for Transformers v5#35107

Merged
vllm-bot merged 7 commits intovllm-project:mainfrom
hmellor:v5-fix-optional-attributes
Feb 25, 2026
Merged

Fix custom processors that use deleted behaviour for Transformers v5#35107
vllm-bot merged 7 commits intovllm-project:mainfrom
hmellor:v5-fix-optional-attributes

Conversation

@hmellor
Copy link
Member

@hmellor hmellor commented Feb 23, 2026

Some remote code processors may define optional_attributes in their ProcessorMixin subclass, and then pass these arbitrary attributes directly to ProcessorMixin.__init__, which is no longer allowed in Transformers v5. For backward compatibility, we intercept these optional attributes and set them on the processor instance before calling the original ProcessorMixin.__init__.

In vLLM CI, one architecture which does this is Molmo2ForConditionalGeneration. If we upstream this architecture to Transformers, we can remove this backward compatibility patch in vLLM.

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@hmellor
Copy link
Member Author

hmellor commented Feb 23, 2026

(this will have merge conflicts with #35101 so it must be merged after)

Copy link
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 introduces a compatibility layer for Transformers v4 processors in vLLM to address a breaking change in Transformers v5. It ensures that processors defining optional_attributes in their ProcessorMixin subclasses can still be initialized correctly. The solution involves intercepting these optional attributes and setting them on the processor instance before calling the original ProcessorMixin.__init__. This change is crucial for maintaining backward compatibility, particularly for models like Molmo2ForConditionalGeneration. The code introduces a new function _transformers_v4_compatibility_from_pretrained to apply this patch.

@DarkLight1337
Copy link
Member

Please fix docs though

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@mergify
Copy link

mergify bot commented Feb 23, 2026

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @hmellor.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Feb 23, 2026
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
@mergify mergify bot removed the needs-rebase label Feb 23, 2026
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) February 24, 2026 02:51
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Feb 24, 2026
@DarkLight1337 DarkLight1337 enabled auto-merge (squash) February 25, 2026 09:26
@vllm-bot vllm-bot merged commit 90fc7f9 into vllm-project:main Feb 25, 2026
42 of 44 checks passed
@hmellor hmellor deleted the v5-fix-optional-attributes branch February 25, 2026 10:38
haanjack pushed a commit to haanjack/vllm that referenced this pull request Feb 26, 2026
…llm-project#35107)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
tom-zju pushed a commit to tom-zju/vllm that referenced this pull request Feb 26, 2026
…llm-project#35107)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
llsj14 pushed a commit to llsj14/vllm that referenced this pull request Mar 1, 2026
…llm-project#35107)

Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
tunglinwood pushed a commit to tunglinwood/vllm that referenced this pull request Mar 4, 2026
…llm-project#35107)

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.

3 participants