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

[Bugfix]Start Failed with param --limit-mm-per-prompt image=N for Molmo #10028

Closed
wants to merge 2 commits into from

Conversation

congwupiece
Copy link

Fix bug run api_server with param --limit-mm-per-prompt image=N for model_type molmo
image

in function dummy_data_for_profiling .there is a assertion num_items >= num_expected
which is always failed because in molmo model, milti-modal image is in a dict of only one item 'images'
you can find it in file molmo.py . function dummy_data_for_molmo
image
this commit make num_items correct and make vllm start correct.

汪从武 and others added 2 commits November 5, 2024 15:05
当启动molmo模型时候如果带上 --limit-mm-per-prompt image=N 参数
vllm启动时在dummy_data_for_profiling里的assert num_items >= num_expected 会失败
因为molmo模型定义的输入和一般多模态不一致详细可见molmo.py dummy_data_for_molmo方法
这个改进对于输入图片个数做出正确判断
Copy link

github-actions bot commented Nov 5, 2024

👋 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.

🚀

@DarkLight1337
Copy link
Member

According to the supported models page, we don't support multi-image input for this model yet. Are you willing to update the implementation of this model?

@congwupiece
Copy link
Author

congwupiece commented Nov 5, 2024

According to the supported models page, we don't support multi-image input for this model yet. Are you willing to update the implementation of this model?

i found that this model Molmo may have already support multi-image input.
if the vllm start success with -limit-mm-per-prompt image=N
code below work quite well

res = client.chat.completions.create(
    model=MODEL_NAME, 
    messages=[
        { 
            "role": "user", 
            "content": [{
                "type": "image_url",
                "image_url": {
                    "url": image_to_base64("case/case2.jpg")
                }
            },
            {
                "type": "image_url",
                "image_url": {
                    "url": image_to_base64("case/case1.jpg")
                }
            },
            {
                "type": "text",
                "text": "describe the pictures i show you"
            }]
        }
    ]
)
# it success return and give back  description of 2 images

i think this model has already support mliti-image .but i am not sure. related code is below .
https://github.com/vllm-project/vllm/blob/bbc3619dc806b25fd5e14eef90819052ab76e1c6/vllm/model_executor/models/molmo.py

@@ -244,6 +244,10 @@ def dummy_data_for_profiling(
if dummy_data.multi_modal_data is not None:
for k, v in dummy_data.multi_modal_data.items():
num_items = len(v) if isinstance(v, list) else 1
#fix for molmo
if k == "image" and model_config.hf_config.model_type == "molmo":
Copy link
Member

Choose a reason for hiding this comment

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

In any case, let's not hard code this here. Can you instead modify the dummy data inside the model's file?

Copy link
Author

Choose a reason for hiding this comment

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

ok

@congwupiece congwupiece closed this Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants