Repository navigation
Implicit language-model-only mode via limit-mm-per-prompt - #22299
Conversation
Signed-off-by: Roger Wang <hey@rogerw.me>
Enable text-only mode for Llama4 when image limit is zero
Signed-off-by: Roger Wang <hey@rogerw.me>
There was a problem hiding this comment.
Code Review
This pull request introduces a feature to disable multimodal capabilities by setting limit_mm_per_prompt to 0 for all modalities. The implementation correctly modifies the main configuration logic. However, this change introduces a critical bug in all modified model-specific files, where they might try to access methods on a None object, leading to an AttributeError. I've provided comments with suggestions to fix these issues by adding None checks before accessing the multimodal configuration.
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
|
@DarkLight1337 @Isotr0py If you think this is a good approach I will go ahead and add this functionality to all multimodal models. |
NickLucche
left a comment
There was a problem hiding this comment.
Not a huge fan of wrapping all backbones initialization with
if multimodal_config.get_limit_per_prompt("image"):
I feel like it's incrementally making it harder to add new MM models from the ground up.
Can we perhaps take this chance to abstract that patter into a maybe_initialize_tower method or similar..?
Maybe we can have something like |
|
That would be great imo |
Yea I'm fine with doing that |
I'm going to merge this PR first since this change is only applied to a few models and not exposed to the users. Will follow up in the next PR to abstract this and apply to all LMMs. |
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.Purpose
Similar to #22224, this PR enables an implicit language-model-only model for certain models that are released as a hybrid-only model when
limit-mm-per-promptis set 0 for all modalities. This PR also skips loading certain modality modules when they're set to 0 individually (See Qwen2.5-Omni as an example)Some followup work:
Co-authored by @sfeng33
Part of #21943
Test Plan
Running Qwen2.5VL-7B on L40S
Command:
vllm serve Qwen/Qwen2.5-VL-7B-InstructCommand:
vllm serve Qwen/Qwen2.5-VL-7B-Instruct --limit-mm-per-prompt '{"image": 0, "video": 0}'Test Result
(Optional) Documentation Update