[Model] Enable LoRA support for Pixtral#31724
Conversation
|
Documentation preview: https://vllm--31724.org.readthedocs.build/en/31724/ |
There was a problem hiding this comment.
Code Review
This pull request enables LoRA support for the vision tower and connector components of Pixtral models. The changes include adding the SupportsLoRA interface to PixtralForConditionalGeneration and implementing the necessary methods for LoRA integration with multi-modal components, such as get_mm_mapping, get_num_mm_encoder_tokens, and get_num_mm_connector_tokens. My review found a critical issue in the implementation of get_mm_mapping that would prevent LoRA from being applied correctly. I've provided a suggestion to fix it.
|
Hi @A1c0r-Z, the pre-commit checks have failed. Please run: uv pip install pre-commit
pre-commit install
pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is
|
dc5cf7f to
15d574c
Compare
57957a5 to
383d556
Compare
|
Thank you for contribution, have you tested it locally? |
Yes, I have tested it locally using a "probe test" method. I inserted debug print statements into the Here is the test detail: 1. MethodologyI instrumented the code to print:
# Instrumentation Logic
def get_num_mm_encoder_tokens(self, num_image_tokens: int) -> int:
# ... logic ...
print(f"[DEBUG PROBE encoder]: {calculated_val}")
return calculated_val
def get_num_mm_connector_tokens(self, num_vision_tokens: int) -> int:
# ... logic ...
print(f"[DEBUG PROBE connector]: {calculated_val}")
return calculated_val
def _process_image_input(self, ...):
# ...
image_features = self.vision_encoder(images)
print(f"[DEBUG PROBE 1] Vision Encoder Output Shape: {image_features[0].shape}")
if self.patch_merger is not None:
image_features = self.patch_merger(...)
print(f"[DEBUG PROBE 2] Shape BEFORE connector: {image_features.shape}")
# ...2. Test Case A:
|
Head branch was pushed to by a user without write access
115c313 to
383d556
Compare
Signed-off-by: 赵策 <alcor@zhaocedeMacBook-Air.local> Signed-off-by: <> Signed-off-by: 赵策 <alcor@zhaocedeMacBook-Air.local> Signed-off-by: 赵策 <alcor@mac.mynetworksettings.com>
383d556 to
471bfb0
Compare
Signed-off-by: <> Signed-off-by: 赵策 <alcor@zhaocedeMacBook-Air.local> Signed-off-by: 赵策 <alcor@mac.mynetworksettings.com> Co-authored-by: 赵策 <alcor@mac.mynetworksettings.com>
Signed-off-by: <> Signed-off-by: 赵策 <alcor@zhaocedeMacBook-Air.local> Signed-off-by: 赵策 <alcor@mac.mynetworksettings.com> Co-authored-by: 赵策 <alcor@mac.mynetworksettings.com>
Signed-off-by: <> Signed-off-by: 赵策 <alcor@zhaocedeMacBook-Air.local> Signed-off-by: 赵策 <alcor@mac.mynetworksettings.com> Co-authored-by: 赵策 <alcor@mac.mynetworksettings.com> Signed-off-by: dsuhinin <suhinin.dmitriy@gmail.com>
Signed-off-by: <> Signed-off-by: 赵策 <alcor@zhaocedeMacBook-Air.local> Signed-off-by: 赵策 <alcor@mac.mynetworksettings.com> Co-authored-by: 赵策 <alcor@mac.mynetworksettings.com>
Purpose
Enable LoRA adapters on the vision tower and connector components of Pixtral models (Part of #31479).
Technical Details
get_mm_mapping(),get_num_mm_encoder_tokens(), andget_num_mm_connector_tokens().SupportsLoRAtoPixtralForConditionalGenerationinheritance.get_num_mm_encoder_tokensscales up the LLM budget byget_num_mm_connector_tokensscales down the raw count byPart of #31479
FIX #8802