-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[MODEL] Qwen Multimodal Support (Qwen-VL / Qwen-VL-Chat) #8029
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] Qwen Multimodal Support (Qwen-VL / Qwen-VL-Chat) #8029
Conversation
👋 Hi! Thank you for contributing to the vLLM project. Once the PR is approved and ready to go, please make sure to run full CI as it is required to merge (or just use auto-merge). To run full CI, you can do one of these:
🚀 |
f206635
to
4d0d15c
Compare
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
Signed-off-by: Alex-Brooks <[email protected]>
4d0d15c
to
cb5802c
Compare
Signed-off-by: Alex-Brooks <[email protected]>
cb5802c
to
fcdd6f1
Compare
/ready |
Cool, sounds good, thanks @DarkLight1337! 🤞 I saw you had resolved this comment: #8029 (comment) - I added parallel linear layers for the MLP in the visual encoder, but am still trying to rework the Did you want me to try to make that get that into this PR once the test is resolved, or would it be better off in a follow-up PR to optimize this model? I think the rest of changes should be taken care of 🙂 |
I wanted to parallelize the MLP first as it's easier. We can parallelize the attention module layer in another PR as it's a bit more complicated. |
Cool, that sounds good to me! |
For the dummy data, you should pad the input with text tokens so that (combined with the image tokens) there are at least a total of |
Signed-off-by: Alex-Brooks <[email protected]>
2ac3008
to
00c2e09
Compare
Nice catch! Pushed the fix to pad it if the image prompt isn't long enough |
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.
VLM tests pass now. Thanks again for your effort!
The PR has been merged. Some follow-ups to be done:
|
Can we support qwen2-vl-7B? |
It is WIP in #7905 |
I want to launch the model as an API server. But I am catching this as an error. Here I have downloaded and installed vllm in its latest form. (v.0.6.0 and after)
|
This PR only adds support for Qwen-VL (version 1). For Qwen2-VL, please refer to #7905 . |
I still have the same bug after pulling down the latest github code |
It's not a bug. Qwen2-VL hasn't been added to vLLM yet. Please read my above comment. |
When do we expect to support qwen2 vl series? |
We are waiting for |
…t#8029) Signed-off-by: Alex-Brooks <[email protected]> Co-authored-by: DarkLight1337 <[email protected]>
…t#8029) Signed-off-by: Alex-Brooks <[email protected]> Co-authored-by: DarkLight1337 <[email protected]> Signed-off-by: Alvant <[email protected]>
Hi and I followed the sample code to deploy Qwen-VL-Chat with vllm docker. While deployment was successful, I kept getting ou of vocabulary OOV errors no matter how I test my inputs. How I deployed:
Error msg:
Test code:
I tried to search the whole observable web and could not find any similar case. So I'm replying here for possible help. Much appreciated! |
…t#8029) Signed-off-by: Alex-Brooks <[email protected]> Co-authored-by: DarkLight1337 <[email protected]> Signed-off-by: LeiWang1999 <[email protected]>
FIX #962
FIX #7017
FIX #7192
Currently Qwen models in VLLM skip loading the visual transformer weights. This PR adds support for loading the visual weights (if they're present) and adds multimodal support, e.g., for
qwen-vl
andqwen-vl-chat
.This PR only concerns Qwen-VL (version 1). For Qwen2-VL, please refer to #7905.
Summary:
.chat
for qwen models, adds an example forqwen-vl
to the offline visual language samplesQwen/Qwen-7B-Chat
to make sure we can still load non multimodal Qwen modelsSome examples that may be helpful:
i. Running qwen-vl as a model in the offline inference vision language examples:
Sample output
The Tokyo Skytree tower is seen through cherry blossoms.
ii. Example of running a text only model:
Sample output:
Microsoft was founded by Bill Gates and Paul Allen in 1975.<|im_end|>
iii. Visual embeddings example
Multiple pictures may be passed as embeddings. In general, these should be of shape
# image, 256, 4096
, since Qwen-vl/chat encode images into fixed 256 token contexts. Sample and output below.Sample output:
Picture 1 is of a woman sitting on the beach with her dog, both of them holding hands and smiling at each other. Picture 2 is of the Tokyo Skytree tower in Japan, surrounded by pink cherry blossom trees.<|im_end|>
iv. Chat example
Here's an example of calling qwen-vl-chat with an image with OpenAPI and the sample chatml template.
Start the server:
python vllm/entrypoints/openai/api_server.py \ --device cuda \ --model Qwen/Qwen-VL-Chat \ --tokenizer Qwen/Qwen-VL-Chat \ --trust-remote-code \ --api-key token-abc123 \ --chat-template examples/template_chatml.jinja &
Client example:
Example Response:
BEFORE SUBMITTING, PLEASE READ THE CHECKLIST BELOW AND FILL IN THE DESCRIPTION ABOVE
PR Checklist (Click to Expand)
Thank you for your contribution to vLLM! Before submitting the pull request, please ensure the PR meets the following criteria. This helps vLLM maintain the code quality and improve the efficiency of the review process.
PR Title and Classification
Only specific types of PRs will be reviewed. The PR title is prefixed appropriately to indicate the type of change. Please use one of the following:
[Bugfix]
for bug fixes.[CI/Build]
for build or continuous integration improvements.[Doc]
for documentation fixes and improvements.[Model]
for adding a new model or improving an existing model. Model name should appear in the title.[Frontend]
For changes on the vLLM frontend (e.g., OpenAI API server,LLM
class, etc.)[Kernel]
for changes affecting CUDA kernels or other compute kernels.[Core]
for changes in the core vLLM logic (e.g.,LLMEngine
,AsyncLLMEngine
,Scheduler
, etc.)[Hardware][Vendor]
for hardware-specific changes. Vendor name should appear in the prefix (e.g.,[Hardware][AMD]
).[Misc]
for PRs that do not fit the above categories. Please use this sparingly.Note: If the PR spans more than one category, please include all relevant prefixes.
Code Quality
The PR need to meet the following code quality standards:
format.sh
to format your code.docs/source/
if the PR modifies the user-facing behaviors of vLLM. It helps vLLM user understand and utilize the new features or changes.Notes for Large Changes
Please keep the changes as concise as possible. For major architectural changes (>500 LOC excluding kernel/data/config/test), we would expect a GitHub issue (RFC) discussing the technical design and justification. Otherwise, we will tag it with
rfc-required
and might not go through the PR.What to Expect for the Reviews
The goal of the vLLM team is to be a transparent reviewing machine. We would like to make the review process transparent and efficient and make sure no contributor feel confused or frustrated. However, the vLLM team is small, so we need to prioritize some PRs over others. Here is what you can expect from the review process:
action-required
label on the PR if there are changes required. The contributor should address the comments and ping the reviewer to re-review the PR.Thank You
Finally, thank you for taking the time to read these guidelines and for your interest in contributing to vLLM. Your contributions make vLLM a great tool for everyone!