Skip to content

[model-gateway] add qwen2_vl model image processor and tests#14374

Merged
slin1237 merged 3 commits intomainfrom
smg-mm-4/n
Dec 3, 2025
Merged

[model-gateway] add qwen2_vl model image processor and tests#14374
slin1237 merged 3 commits intomainfrom
smg-mm-4/n

Conversation

@slin1237
Copy link
Collaborator

@slin1237 slin1237 commented Dec 3, 2025

Checklist

@github-actions github-actions bot added Multi-modal multi-modal language model model-gateway labels Dec 3, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @slin1237, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the sgl-router's multimodal capabilities by adding support for the Qwen2-VL model. It provides a dedicated image processor that intelligently handles image resizing and preparation, ensuring that visual inputs are correctly formatted for the Qwen2-VL vision encoder. This expansion allows the router to seamlessly integrate and serve a broader range of advanced multimodal models, with the new functionality thoroughly validated against established reference implementations.

Highlights

  • New Qwen2-VL Image Processor: Introduced a Rust-native Qwen2VLProcessor to handle the specific dynamic resolution and smart resizing requirements for Qwen2-VL models.
  • Smart Resizing Algorithm: Implemented a smart_resize method that preserves image aspect ratios, fits images within configurable pixel bounds, and aligns dimensions to patch boundaries for efficient vision encoding.
  • Comprehensive Golden Tests: Added robust golden tests to ensure pixel-perfect compatibility between the Rust Qwen2VLProcessor and the HuggingFace Python implementation across various image sizes and aspect ratios, validating grid dimensions, token counts, and pixel values.
  • Integration and Export: The new processor is fully integrated into the sgl-router's image processing registry, making it discoverable and usable, and its module is properly exported.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@slin1237 slin1237 added the run-ci label Dec 3, 2025
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 Qwen2-VL model, including its image processor and corresponding golden tests. The implementation is comprehensive and well-tested. I've found a couple of areas for improvement in the new qwen2_vl.rs processor implementation. One is a high-priority suggestion to refactor a complex function for better performance and maintainability, and the other is a medium-priority suggestion to remove some redundant code. Overall, great work on adding this new model support.

@slin1237 slin1237 merged commit 03575ce into main Dec 3, 2025
51 of 54 checks passed
@slin1237 slin1237 deleted the smg-mm-4/n branch December 3, 2025 20:34
yingluosanqian pushed a commit to yingluosanqian/sglang that referenced this pull request Dec 4, 2025
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 5, 2025
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 5, 2025
yuchengz816-bot pushed a commit to yuchengz816-bot/sglang that referenced this pull request Dec 8, 2025
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 12, 2025
tonyluj pushed a commit to openanolis/sglang that referenced this pull request Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

model-gateway Multi-modal multi-modal language model run-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments