Skip to content

Conversation

myselvess
Copy link
Contributor

@myselvess myselvess commented Aug 4, 2025

Essential Elements of an Effective PR Description Checklist

  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.

Purpose

Adding support for the ovis2.5

Test Plan

Test Result

(Optional) Documentation Update

Updated supported_models.md

Signed-off-by: myselvess <[email protected]>
@myselvess myselvess requested a review from hmellor as a code owner August 4, 2025 09:27
@mergify mergify bot added the documentation Improvements or additions to documentation label Aug 4, 2025
Copy link

mergify bot commented Aug 4, 2025

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

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

@mergify mergify bot added new-model Requests to new models needs-rebase labels Aug 4, 2025
Copy link

github-actions bot commented Aug 4, 2025

👋 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 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 either: Add ready label to the PR or enable auto-merge.

🚀

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

@mergify mergify bot removed the needs-rebase label Aug 4, 2025
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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.

Copy link
Contributor Author

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.

I will check and try this method. :)

Copy link
Contributor Author

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.

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?

Copy link
Member

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 :)

Copy link
Member

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 😭

Copy link
Contributor Author

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.

Copy link
Member

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.

Comment on lines +451 to +395
@MULTIMODAL_REGISTRY.register_processor(Ovis2_5MultiModalProcessor,
info=Ovis2_5ProcessingInfo,
dummy_inputs=Ovis2_5DummyInputsBuilder)
class Ovis2_5(nn.Module, SupportsMultiModal):
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

@Isotr0py Isotr0py Aug 5, 2025

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.

Copy link
Contributor Author

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?

Copy link
Member

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 :)

Comment on lines +451 to +395
@MULTIMODAL_REGISTRY.register_processor(Ovis2_5MultiModalProcessor,
info=Ovis2_5ProcessingInfo,
dummy_inputs=Ovis2_5DummyInputsBuilder)
class Ovis2_5(nn.Module, SupportsMultiModal):
Copy link
Member

@Isotr0py Isotr0py Aug 5, 2025

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.

Copy link

mergify bot commented Aug 6, 2025

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

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

Copy link
Member

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 :)

@mergify mergify bot added the multi-modality Related to multi-modality (#4194) label Aug 7, 2025
myselvess and others added 10 commits August 7, 2025 20:35
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]>
Copy link

mergify bot commented Aug 7, 2025

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

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

@DarkLight1337
Copy link
Member

DarkLight1337 commented Aug 16, 2025

I see Ovis 2.5 is available on HF Hub now. Are you planning to open a new PR for this model?

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 multi-modality Related to multi-modality (#4194) needs-rebase new-model Requests to new models performance Performance-related issues qwen Related to Qwen models rocm Related to AMD ROCm speculative-decoding structured-output tool-calling tpu Related to Google TPUs v1
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.