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

[Model][LoRA]LoRA support added for MolmoForCausalLM #11439

Merged
merged 12 commits into from
Dec 31, 2024

Conversation

ayylemao
Copy link
Contributor

@ayylemao ayylemao commented Dec 23, 2024

[Model][LoRA]LoRA support added for MolmoForCausalLM
LoRA supported for inference in MolmoForCausalLM

Need some help with verifying this works correctly since my own tests revealed the same results for base_model and base_model+ lora.

ping @jeejeelee

FIX #11431

Copy link

👋 Hi! Thank you for contributing to the vLLM project.
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 do one of these:

  • Add ready label to the PR
  • Enable auto-merge.

🚀

@jeejeelee
Copy link
Collaborator

Need some help with verifying this works correctly since my own tests revealed the same results for base_model and base_model+ lora.

I roughly know what the reason is. I will resolve it today, and we also need to update the documentation,see :https://docs.vllm.ai/en/latest/models/supported_models.html#id3

Copy link

mergify bot commented Dec 24, 2024

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @ayylemao.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@ayylemao
Copy link
Contributor Author

ayylemao commented Dec 24, 2024

i might have done goofed by syncing my fork and pushing to the PR branch
I fixed what i could, sorry for all the review requests...

Matthias Vogler added 3 commits December 24, 2024 09:54
Signed-off-by: Matthias Vogler <[email protected]>
Signed-off-by: Matthias Vogler <[email protected]>
Signed-off-by: Matthias Vogler <[email protected]>
Signed-off-by: Matthias Vogler <[email protected]>
@jeejeelee jeejeelee removed the request for review from njhill December 24, 2024 12:38
Copy link

mergify bot commented Dec 24, 2024

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @ayylemao.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify bot added the needs-rebase label Dec 24, 2024
@jeejeelee
Copy link
Collaborator

@ayylemao could you plz address the branch conflict ?

@ayylemao
Copy link
Contributor Author

Thank you for your review.

I will get back to it after christmas!

@ayylemao ayylemao marked this pull request as draft December 26, 2024 12:31
@mergify mergify bot removed the needs-rebase label Dec 26, 2024
@ayylemao ayylemao marked this pull request as ready for review December 26, 2024 12:59
@jeejeelee
Copy link
Collaborator

@ayylemao I've added modules with LoRA support. Could you test if it generates reasonable results?

Signed-off-by: Jee Jee Li <[email protected]>
@ayylemao
Copy link
Contributor Author

ayylemao commented Dec 27, 2024

@ayylemao I've added modules with LoRA support. Could you test if it generates reasonable results?

@jeejeelee After testing i still get the same results for the base model and base_model+lora when serving via vllm serve.
I think my lora adapter still does not get applied correctly, even though when evaluating via transformers+peft it works as expected.

I am not sure how to test more accuratly if the lora adapters get correctly applied or not beyond just comparing the actual model output.
Do you have any idea what might be the issue or how to pinpoint further?

@jeejeelee
Copy link
Collaborator

@ayylemao I've added modules with LoRA support. Could you test if it generates reasonable results?

@jeejeelee After testing i still get the same results for the base model and base_model+lora when serving via vllm serve. I think my lora adapter still does not get applied correctly, even though when evaluating via transformers+peft it works as expected.

I am not sure how to test more accuratly if the lora adapters get correctly applied or not beyond just comparing the actual model output. Do you have any idea what might be the issue or how to pinpoint further?

I'm training a LoRA model for this model and will test it tomorrow.

Signed-off-by: Jee Jee Li <[email protected]>
@jeejeelee
Copy link
Collaborator

@ayylemao I've added modules with LoRA support. Could you test if it generates reasonable results?

@jeejeelee After testing i still get the same results for the base model and base_model+lora when serving via vllm serve. I think my lora adapter still does not get applied correctly, even though when evaluating via transformers+peft it works as expected.
I am not sure how to test more accuratly if the lora adapters get correctly applied or not beyond just comparing the actual model output. Do you have any idea what might be the issue or how to pinpoint further?

I'm training a LoRA model for this model and will test it tomorrow.

@ayylemao After merging with #11551, when testing 100 samples, 99 generated results matched exactly with the transformers output. The remaining one also produced a reasonable result.

@ayylemao
Copy link
Contributor Author

ayylemao commented Dec 30, 2024

@ayylemao I've added modules with LoRA support. Could you test if it generates reasonable results?

@jeejeelee After testing i still get the same results for the base model and base_model+lora when serving via vllm serve. I think my lora adapter still does not get applied correctly, even though when evaluating via transformers+peft it works as expected.
I am not sure how to test more accuratly if the lora adapters get correctly applied or not beyond just comparing the actual model output. Do you have any idea what might be the issue or how to pinpoint further?

I'm training a LoRA model for this model and will test it tomorrow.

@ayylemao After merging with #11551, when testing 100 samples, 99 generated results matched exactly with the transformers output. The remaining one also produced a reasonable result.

Thank you for testing.

After your merge with #11551 i also get correct results!
Thank you very much for your help with this PR.

Copy link
Collaborator

@jeejeelee jeejeelee left a comment

Choose a reason for hiding this comment

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

@ayylemao Thanks for your contribution

@jeejeelee jeejeelee enabled auto-merge (squash) December 30, 2024 10:08
@github-actions github-actions bot added the ready ONLY add when PR is ready to merge/full CI is needed label Dec 30, 2024
@ayylemao
Copy link
Contributor Author

Do i still need to do something here because of the failing buildkite/ci/pr/lora-test-1 check?
It seems that a Qwen2-VL check has failed.

[2024-12-30T10:24:42Z] =================================== FAILURES ===================================
--
  | [2024-12-30T10:24:42Z] ______________________________ test_qwen2vl_lora _______________________________
  | [2024-12-30T10:24:42Z]
  | [2024-12-30T10:24:42Z] qwen2vl_lora_files = '/root/.cache/huggingface/hub/models--jeeejeee--qwen2-vl-lora-pokemon/snapshots/6c85687748763f7449fa15c345520b43ba6e522f'
  | [2024-12-30T10:24:42Z]
  | [2024-12-30T10:24:42Z]     @pytest.mark.xfail(current_platform.is_rocm(),
  | [2024-12-30T10:24:42Z]                        reason="Qwen2-VL dependency xformers incompatible with ROCm"
  | [2024-12-30T10:24:42Z]                        )
  | [2024-12-30T10:24:42Z]     def test_qwen2vl_lora(qwen2vl_lora_files):
  | [2024-12-30T10:24:42Z]         llm = vllm.LLM(
  | [2024-12-30T10:24:42Z]             MODEL_PATH,
  | [2024-12-30T10:24:42Z]             max_num_seqs=2,
  | [2024-12-30T10:24:42Z]             enable_lora=True,
  | [2024-12-30T10:24:42Z]             max_loras=2,
  | [2024-12-30T10:24:42Z]             max_lora_rank=16,
  | [2024-12-30T10:24:42Z]             trust_remote_code=True,
  | [2024-12-30T10:24:42Z]             mm_processor_kwargs={
  | [2024-12-30T10:24:42Z]                 "min_pixels": 28 * 28,
  | [2024-12-30T10:24:42Z]                 "max_pixels": 1280 * 28 * 28,
  | [2024-12-30T10:24:42Z]             },
  | [2024-12-30T10:24:42Z]             max_model_len=4096,
  | [2024-12-30T10:24:42Z]         )
  | [2024-12-30T10:24:42Z]         output1 = do_sample(llm, qwen2vl_lora_files, lora_id=1)
  | [2024-12-30T10:24:42Z]         for i in range(len(EXPECTED_OUTPUT)):
  | [2024-12-30T10:24:42Z] >           assert EXPECTED_OUTPUT[i].startswith(output1[i])
  | [2024-12-30T10:24:42Z] E           AssertionError: assert False
  | [2024-12-30T10:24:42Z] E            +  where False = <built-in method startswith of str object at 0x7f462c0639f0>('A vibrant street scene with')
  | [2024-12-30T10:24:42Z] E            +    where <built-in method startswith of str object at 0x7f462c0639f0> = 'A red stop sign stands prominently in the foreground, with a traditional Chinese gate and a black SUV in the background, illustrating a blend of modern and cultural elements.'.startswith
  | [2024-12-30T10:24:42Z]
  | [2024-12-30T10:24:42Z] lora/test_qwen2vl.py:78: AssertionError

@jeejeelee
Copy link
Collaborator

@ayylemao This is a known issue and is not related to this PR.

@simon-mo simon-mo disabled auto-merge December 31, 2024 01:33
@simon-mo simon-mo merged commit a2a40bc into vllm-project:main Dec 31, 2024
68 of 71 checks passed
xcnick pushed a commit to xcnick/vllm that referenced this pull request Dec 31, 2024
)

Signed-off-by: Matthias Vogler <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]>
Co-authored-by: Matthias Vogler <[email protected]>
Co-authored-by: Jee Jee Li <[email protected]>
Signed-off-by: xcnick <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/build documentation Improvements or additions to documentation frontend 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.

[Feature]: AssertionError: MolmoForCausalLM does not support LoRA yet.
3 participants