-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
[Bugfix][Model] Fix LoRA for Mistral-Small-3.1-24B-Instruct-2503 #21183
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
[Bugfix][Model] Fix LoRA for Mistral-Small-3.1-24B-Instruct-2503 #21183
Conversation
👋 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 🚀 |
cc @mgoin @jeejeelee |
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 fixes an issue with LoRA layer replacement for nested multi-modal models like Mistral-Small-3.1. The changes correctly locate the logits_processor
within its parent submodule and also properly discover embedding_modules
defined in submodules.
The logic seems sound and directly addresses the described bug. I've found one area for improvement in vllm/lora/utils.py
regarding a redundant function call, which I've commented on. Otherwise, the changes look good.
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.
Surprising we haven't run into this before, this fix makes a lot of sense. Thanks a lot!
Which model class does this model use? Is it PixtralForConditionalGeneration? But it looks like this model doesn't support LoRA yet, see: vllm/docs/models/supported_models.md Line 602 in 21274ab
|
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.
IIRC, for multi-modal models, we don't explicitly set embedding_modules, so LogitsProcessWithLoRA
never gets instantiated, maybe I remember wrong
Hi @jeejeelee, this is the model definition,
It uses the |
The difference is between |
Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com>
Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com>
Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com>
ba38620
to
c4fde7c
Compare
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Signed-off-by: Himanshu Jaju <hj@mistral.ai>
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com>
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Signed-off-by: avigny <47987522+avigny@users.noreply.github.com>
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Signed-off-by: x22x22 <wadeking@qq.com>
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com>
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com>
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Signed-off-by: Jinzhen Lin <linjinzhen@hotmail.com>
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Signed-off-by: Paul Pak <paulpak58@gmail.com>
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com>
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Signed-off-by: Diego-Castan <diego.castan@ibm.com>
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com>
…m-project#21183) Signed-off-by: Varun Sundar Rabindranath <varun@neuralmagic.com> Co-authored-by: Varun Sundar Rabindranath <varun@neuralmagic.com>
Purpose
Mistral-Small-3.1-24B-Instruct-2503 is a multi-modal model. The model has 3 sub-modules,
The logits_processor module is contained within the
language_model
module.on
main
, due to the nested structure, LoRA layer replacement logic fails to replace theLogitsProcessor
withLogitsProcessWithLoRA
. This results is incorrect outputs when the model is enabled with LoRA.Test Plan
lm_eval
results with and without LoRA.Test Result
base command :
vllm serve mistralai/Mistral-Small-3.1-24B-Instruct-2503 --max-model-len 10K --port 9010 --enforce-eager -tp 2
lm_eval command :
lm_eval --model local-completions --model_args model=mistralai/Mistral-Small-3.1-24B-Instruct-2503,base_url=http://0.0.0.0:9010/v1/completions,num_concurrent=500,tokenized_requests=False --tasks gsm8k --num_fewshot 5
main:
command = base_command
command = base_command +
--enable-lora
This PR:
command = base_command
command = base_command +
--enable-lora