Skip to content
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

[Quant] Molmo SupportsQuant #13336

Merged
merged 5 commits into from
Feb 18, 2025

Conversation

kylesayrs
Copy link
Contributor

@kylesayrs kylesayrs commented Feb 15, 2025

Purpose

  • Add SupportsQuant interface to Molo models which
    • Initializes the quant_config attribute and updates the quant_config with the relevant packed_modules_mapping
    • Marks a model as being capable of supporting quantized inference
    • In the future, will check if a model has been correctly defined, for example if prefixes and quant_configs have been passed correctly
  • This mixin will replace the configure_quant_config function after it has been added to a sufficient number of models
  • These changes reflect the issue that configure_quant_config assumes that all packed_modules_mappings will be declared prior to initialization. In reality, some models are submodels of each other, so their mappings can only be determined at init time.
    • Using a mixin which updates after class is initialized but the mapping before the parameters init guarantees that the config is up to date w.r.t. mappings before the parameters init

Prerequisites

Changes

  • Add SupportsQuant interface to MolmoVisionBackbone, MolmoModel, and MolmoForCausalLM

Copy link

👋 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 fastcheck CI which starts running only a small and essential subset of CI tests to quickly catch errors. You can run other CI tests on top of those by going to your fastcheck build on Buildkite UI (linked in the PR checks section) and unblock them. If you do not have permission to unblock, ping simon-mo or khluu to add you in our Buildkite org.

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 ready label to the PR or enable auto-merge.

🚀

@DarkLight1337 DarkLight1337 changed the title [Quant] Molo SupportsQuant [Quant] Molmo SupportsQuant Feb 16, 2025
@kylesayrs kylesayrs marked this pull request as ready for review February 17, 2025 02:00
@@ -633,7 +634,8 @@ def forward(
return hidden_states, residual


class MolmoVisionBackbone(nn.Module):
class MolmoVisionBackbone(nn.Module, SupportsQuant):
packed_modules_mapping = {"merged_linear": ["gate_proj", "up_proj"]}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we remove this from L1440 now that it's defined in the inner model?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that that line is still required by SupportsLoRA

vllm/vllm/lora/models.py

Lines 342 to 343 in ce77eb9

self.packed_modules_mapping = copy.deepcopy(
self.model.packed_modules_mapping)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Theoretically, the packed_modules_mapping attribute should be defined at the lowest level possible, ie on every Module with packed modules.

I think in practice we should add the SupportsQuant and packed_modules_mapping to all classes which define a load_weights method, as it seems like these are the classes which are composable with other models

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for the explanation!

I think in practice we should add the SupportsQuant and packed_modules_mapping to all classes which define a load_weights method, as it seems like these are the classes which are composable with other models

Sounds good to me!

@DarkLight1337 DarkLight1337 enabled auto-merge (squash) February 18, 2025 03:49
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Feb 18, 2025
@simon-mo simon-mo merged commit 88787bc into vllm-project:main Feb 18, 2025
57 of 59 checks passed
panf2333 pushed a commit to yottalabsai/vllm that referenced this pull request Feb 18, 2025
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