Fix custom processors that use deleted behaviour for Transformers v5#35107
Fix custom processors that use deleted behaviour for Transformers v5#35107vllm-bot merged 7 commits intovllm-project:mainfrom
Conversation
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
|
(this will have merge conflicts with #35101 so it must be merged after) |
There was a problem hiding this comment.
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.
|
Please fix docs though |
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
…llm-project#35107) Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
…llm-project#35107) Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
…llm-project#35107) Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
…llm-project#35107) Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Some remote code processors may define
optional_attributesin theirProcessorMixinsubclass, and then pass these arbitrary attributes directly toProcessorMixin.__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 originalProcessorMixin.__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.