-
-
Notifications
You must be signed in to change notification settings - Fork 10k
[Model] support new model ovis2.5 #22187
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
Conversation
Signed-off-by: myselvess <[email protected]>
This pull request has merge conflicts that must be resolved before it can be |
👋 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 🚀 |
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 adds support for the new ovis2.5
model. The changes are comprehensive, including the model implementation, configuration, processor, and updates to the model registry and documentation. My review has identified several potential issues that should be addressed. These include a copy-paste error in an error message, incorrect logic for handling multimodal inputs, a potential AttributeError
during training with gradient checkpointing, a potential AttributeError
in the model configuration, and missing keys in the special tokens dictionary which could lead to a KeyError
.
Signed-off-by: myselvess <[email protected]>
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.
Could this be imported from Transformers instead?
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.
Thank you for the suggestion! Unfortunately, this cannot be imported from Transformers because the library does not currently support or recognize the ovis25 architecture.
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.
If this config is copied from model repo's configuration_*.py
, we can simply add trust_remote_code=True
to use remote implementation.
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.
If this config is copied from model repo's
configuration_*.py
, we can simply addtrust_remote_code=True
to use remote implementation.
I will check and try this method. :)
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.
If this config is copied from model repo's
configuration_*.py
, we can simply addtrust_remote_code=True
to use remote implementation.
I noticed that vllm/transformers_utils/configs/ovis.py was reintroduced in this PR (#21931). Could you clarify the reasoning behind this change? Should I still need to remove ovis2.5 config?
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.
Ah, it's because Ovis2's remote config file is broken after Transformers v4.54 due to these lines about AimV2 ViT: https://huggingface.co/AIDC-AI/Ovis2-1B/blob/main/configuration_ovis.py#L14-L15.
Seems Ovis2.5 has different model_type
and ViT (ovis
vs ovis2_5
) which won't be affected by re-added config, so I think it should still be fine to remove ovis2.5 config if it can run with trust_remote_code=True
.
If remote code is also broken in Ovis2.5, we can keep it here :)
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.
Unmaintained remote code models are the worst 😭
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.
The DCO check shows that there are several commits without signatures. So I tried to revise the signatures, but after force pushing, this PR ended up with too many commits.😭 I will close this PR and resubmit a new one.
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.
If this config is copied from model repo's configuration_*.py
, we can simply add trust_remote_code=True
to use remote implementation.
@MULTIMODAL_REGISTRY.register_processor(Ovis2_5MultiModalProcessor, | ||
info=Ovis2_5ProcessingInfo, | ||
dummy_inputs=Ovis2_5DummyInputsBuilder) | ||
class Ovis2_5(nn.Module, SupportsMultiModal): |
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.
Any difference between Ovis2/Ovis1.6 and Ovis2.5? Seems they have similar architecture.
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.
Ovis2.5 introduces several differences compared to Ovis2/Ovis1.6:
1.The LLM and ViT components use different backbone models.
2.There are updates in input preprocessing and multi-modal embedding fusion.
3.Ovis2.5 supports video inference.
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.
1.The LLM and ViT components use different backbone models.
The existing Ovis implementation can initialize arbitrary backbone, so this won't be a blocker.
3.Ovis2.5 supports video inference.
IIRC, Ovis2/Ovis1.6 should also support video inputs though I didn't finish its implementation before. (https://huggingface.co/AIDC-AI/Ovis2-2B#usage)
2.There are updates in input preprocessing and multi-modal embedding fusion.
So the only large issue is the updates for preprocessing and multi-modal embedding fusion. I wonder if we can make update on existing Ovis
implementation (both model and processor implementation) for Ovis2.5 support, so that Ovis2/Ovis1.6 can also benefit from video support in this PR.
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.
It will require handling many specific details depending on the model type. For example, some fields in the config have different names or position, and indicator definitions also vary.
Perhaps I could first add video input support to the existing Ovis implementation, and then define a new Ovis2.5 class that inherits from Ovis to handle the specific adjustments for Ovis2.5?
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.
It will require handling many specific details depending on the model type. For example, some fields in the config have different names or position, and indicator definitions also vary.
I see, seems that the difference between Ovis2 and Ovis2.5 is a little bit large, let's focus on Ovis2.5 in this PR and leave video input support for existing Ovis implementation in a following PR :)
@MULTIMODAL_REGISTRY.register_processor(Ovis2_5MultiModalProcessor, | ||
info=Ovis2_5ProcessingInfo, | ||
dummy_inputs=Ovis2_5DummyInputsBuilder) | ||
class Ovis2_5(nn.Module, SupportsMultiModal): |
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.
1.The LLM and ViT components use different backbone models.
The existing Ovis implementation can initialize arbitrary backbone, so this won't be a blocker.
3.Ovis2.5 supports video inference.
IIRC, Ovis2/Ovis1.6 should also support video inputs though I didn't finish its implementation before. (https://huggingface.co/AIDC-AI/Ovis2-2B#usage)
2.There are updates in input preprocessing and multi-modal embedding fusion.
So the only large issue is the updates for preprocessing and multi-modal embedding fusion. I wonder if we can make update on existing Ovis
implementation (both model and processor implementation) for Ovis2.5 support, so that Ovis2/Ovis1.6 can also benefit from video support in this PR.
This pull request has merge conflicts that must be resolved before it can be |
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.
Ah, it's because Ovis2's remote config file is broken after Transformers v4.54 due to these lines about AimV2 ViT: https://huggingface.co/AIDC-AI/Ovis2-1B/blob/main/configuration_ovis.py#L14-L15.
Seems Ovis2.5 has different model_type
and ViT (ovis
vs ovis2_5
) which won't be affected by re-added config, so I think it should still be fine to remove ovis2.5 config if it can run with trust_remote_code=True
.
If remote code is also broken in Ovis2.5, we can keep it here :)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: myselvess <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: myselvess <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: myselvess <[email protected]>
Signed-off-by: myselvess <[email protected]>
Signed-off-by: myselvess <[email protected]>
Signed-off-by: myselvess <[email protected]>
Signed-off-by: 22quinn <[email protected]>
Signed-off-by: DarkLight1337 <[email protected]>
…#21725) Signed-off-by: alyosha-swamy <[email protected]>
vllm-project#22185) Signed-off-by: Woosuk Kwon <[email protected]>
This pull request has merge conflicts that must be resolved before it can be |
I see Ovis 2.5 is available on HF Hub now. Are you planning to open a new PR for this model? |
Essential Elements of an Effective PR Description Checklist
supported_models.md
andexamples
for a new model.Purpose
Adding support for the ovis2.5
Test Plan
Test Result
(Optional) Documentation Update
Updated supported_models.md