Skip to content

Add Ovis2.5 model support - #47659

Open
sushmanthreddy wants to merge 189 commits into
huggingface:mainfrom
sushmanthreddy:add-ovis2-5
Open

sushmanthreddy wants to merge 189 commits into
huggingface:mainfrom
sushmanthreddy:add-ovis2-5

Conversation

@sushmanthreddy

@sushmanthreddy sushmanthreddy commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

🤗 Transformers CI

What does this PR do?

Support Ovis2.5 multimodal models from AIDC-AI.

This PR adds native model support, checkpoint conversion, image and video processing, Auto class registrations, documentation, and tests. Converted checkpoints can be loaded without trust_remote_code.

This continues the work from the closed WIP PR #40321.

Fixes #40841

Who can review?

@zucchini-nlp @Cyrilvallez

Ovis2.5 is available in 2B and 9B variants and supports variable-resolution images, multiple images, video inputs, and multimodal reasoning. Looking forward to your feedback!

@sushmanthreddy

Copy link
Copy Markdown
Contributor Author

cc @ArthurZucker @zucchini-nlp

@zucchini-nlp

Copy link
Copy Markdown
Member

Thanks for working on it! We'll pass by a bit later since there are a few other model releases atm 🤗

susmered added 3 commits August 6, 2026 09:53
Load official checkpoints through the registered Ovis2.5 WeightRenaming rules instead of materializing a duplicate state dict. Save with save_original_format=False so native Transformers names are serialized, then strictly reload the model and processor without remote code.

Normalize the config, tokenizer, processor, and generation metadata for the released 2B and 9B variants. Both variants were validated with complete key coverage, including the tied 2B language head and the separate 9B language head.
Reuse Qwen2-VL packed-patch processing with Ovis2.5's native resize policy and preprocessing defaults. Keep video-only helpers in the video processor and cover native patch ordering directly.
@sushmanthreddy

Copy link
Copy Markdown
Contributor Author

@zucchini-nlp I’ve completed an end-to-end review and validation of the changes. Could you please review the PR and let me know if any further changes are needed?
I compared the implementation with existing multimodal models in Transformers and followed the same code structure where applicable. I mainly used VideoLLaMA3 as a reference for the packed vision and image/video flow, and Qwen2-VL for the preprocessing structure.
Ovis2.5 uses a Qwen3 language backbone together with its own vision tower and visual-tokenizer mechanism.
The weight conversion follows the Transformers v5 weight-renaming and native save_pretrained flow. I validated both official 2B and 9B checkpoints with native loading using trust_remote_code=False, followed by text, image, and video inference.
I also removed redundant tests and retained the tests covering Ovis2.5-specific behavior and the standard Transformers model, processor, image, and video contracts. The complete Ovis2.5 test suite and style checks pass locally.

@zucchini-nlp

Copy link
Copy Markdown
Member

thanks a lot, reviewing tonight or tmrw morning

@zucchini-nlp zucchini-nlp left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oke, overall looks fine if we can push for even more modular. Especially, I didn't get why the vision block is re-inventing the wheel for some things we already have in QwenVL-family
See my comments 👇🏻 for details, that should help guide you where to copy from

Also, please lmk why we need a conversion script since it looks like we can load from existing remote-code repo

Comment thread docs/source/en/model_doc/ovis2_5.md Resolved
Comment thread docs/source/en/model_doc/ovis2_5.md Resolved
Comment thread docs/source/en/model_doc/ovis2_5.md Resolved
@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: auto, ovis2_5

@sushmanthreddy

Copy link
Copy Markdown
Contributor Author

@vasqu Thanks for the detailed review. I’ve gone through your comments and pushed the updates, including the merge conflict fix. Could you take another look when you have time? I’m still a bit unsure about the Ovis test files, so I’d especially appreciate a close review of their structure and coverage. Please let me know if anything else needs changing.

@vasqu

vasqu commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

@sushmanthreddy could we potentially first fix the tests / fast CI? Will try to check when I can but expect a bit of delays

@sushmanthreddy

Copy link
Copy Markdown
Contributor Author

@sushmanthreddy could we potentially first fix the tests / fast CI? Will try to check when I can but expect a bit of delays

Fixed the tests @vasqu

@github-actions

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: auto, ovis2_5

@github-actions

Copy link
Copy Markdown
Contributor

CI recap

Dashboard: View test results in Grafana
Latest run: 38338025774:2
Result: success | Jobs: 16 | Tests: 199,920 | Failures: 1 | Duration: 13h 47m

@sushmanthreddy sushmanthreddy mentioned this pull request Oct 20, 2026
@zucchini-nlp

Copy link
Copy Markdown
Member

Anton is off for a week so we will pass by in 1-2 weeks. IPing us agai then pls @sushmanthreddy

@sushmanthreddy

Copy link
Copy Markdown
Contributor Author

sure @zucchini-nlp

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

[For maintainers] Suggested jobs to run (before merge)

run-slow: auto, ovis2_5

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Support for Ovis2.5 Multi-Modal Model​

5 participants