-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
[Model] Enable encoder DP for MiniCPM-V #23948
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: zjy0516 <[email protected]>
There was a problem hiding this 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 correctly enables encoder data parallelism for MiniCPM-V models by passing a use_data_parallel flag to the Idefics2VisionTransformer. However, there are two key issues. First, the supports_encoder_tp_data flag is only set for MiniCPMV4_0, which means this feature will likely not be enabled for versions 2.5, 2.6, and 4.5, despite code changes suggesting they should support it. This is a correctness issue. Second, as detailed in a specific comment, there is significant code duplication in init_vision_module across multiple classes, which impacts maintainability.
| model = Idefics2VisionTransformer( | ||
| config.vision_config, | ||
| quant_config=quant_config, | ||
| prefix=prefix, | ||
| use_data_parallel=self.use_data_parallel, | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This init_vision_module implementation is nearly identical across MiniCPMV2_5, MiniCPMV2_6, MiniCPMV4_0, and MiniCPMV4_5. The only significant difference is the conditional logic for quant_config in the v4.x models. This duplication increases maintenance effort. Consider refactoring this into a shared method in a base class to improve code reuse and maintainability.
Signed-off-by: zjy0516 <[email protected]>
|
@DarkLight1337 Could you please take a look at this pr? |
DarkLight1337
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, can you move the flag introduced by #23325 from the V4 model to the base model so that this is actually enabled for the other models?
Signed-off-by: zjy0516 <[email protected]>
Done |
Co-authored-by: Cyrus Leung <[email protected]> Signed-off-by: Jiangyun Zhu <[email protected]>
Signed-off-by: zjy0516 <[email protected]> Signed-off-by: Jiangyun Zhu <[email protected]> Co-authored-by: Cyrus Leung <[email protected]>
Signed-off-by: zjy0516 <[email protected]> Signed-off-by: Jiangyun Zhu <[email protected]> Co-authored-by: Cyrus Leung <[email protected]>
Purpose
Enable encoder DP for MiniCPM-V
Related to: #22743
Test Plan
MiniCPM-V-2_6
Test Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.