Skip to content

[model-gateway] add qwen3_vl model image processor#14377

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

[model-gateway] add qwen3_vl model image processor#14377
slin1237 merged 3 commits intomainfrom
smg-mm-6/n

Conversation

@slin1237
Copy link
Copy Markdown
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
Copy Markdown
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 integrates the Qwen3-VL vision-language model into the system by introducing a dedicated image processor. The new processor handles the unique preprocessing requirements of Qwen3-VL, including dynamic image resizing and specific normalization parameters. This ensures that Qwen3-VL can correctly process visual inputs, and the inclusion of golden tests guarantees the accuracy and compatibility of the Rust implementation with the reference HuggingFace processor.

Highlights

  • Qwen3-VL Image Processor Added: A new image processor for the Qwen3-VL model has been implemented and integrated, enabling its support within the model gateway.
  • Specific Preprocessing Logic: The Qwen3VLProcessor incorporates dynamic resolution with smart resizing, a patch size of 16, and a normalization scheme using [0.5, 0.5, 0.5] for mean and standard deviation, tailored to the Qwen3-VL model's requirements.
  • Golden Test Generation Support: The generate_vision_golden.py script has been updated to include functionality for generating golden outputs specifically for Qwen3-VL, ensuring compatibility and correctness with HuggingFace's reference implementation.
  • Rust Integration and Registry Update: The Rust ImageProcessorRegistry now registers the Qwen3VLProcessor for qwen3-vl and qwen3_vl model keys, with necessary module exports and documentation updates to reflect the new processor.
  • Comprehensive Golden Testing: New golden tests have been added to thoroughly validate the Qwen3VLProcessor's output, comparing image_grid_thw, num_tokens, and pixel values against pre-computed golden values for various image aspect ratios and sizes.
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.

Copy link
Copy Markdown
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 qwen3_vl model image processor. The changes include a new Rust implementation for the processor, updates to the processor registry, a Python script for generating golden test files, and new golden tests. The implementation for Qwen3VLProcessor is well-tested and seems correct. However, it introduces significant code duplication from the existing Qwen2VLProcessor, which could be a maintenance concern. I've left a few suggestions to address this and other minor points.

Comment thread sgl-router/src/multimodal/vision/processors/qwen3_vl.rs
Comment thread sgl-router/src/multimodal/vision/image_processor.rs
// Load golden values
let golden_grid_thw = load_golden_grid_thw(&npz_path);
let golden_num_tokens = load_golden_num_tokens(&npz_path);
let (golden_pixels, golden_shape) = load_golden_qwen2_vl_pixels(&npz_path);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The function name load_golden_qwen2_vl_pixels is a bit confusing here, as it's being used for qwen3_vl tests. While it works because the data format is the same, consider renaming it to something more generic like load_golden_patched_pixels in a future refactoring to improve maintainability and avoid confusion.

@slin1237 slin1237 added the run-ci label Dec 4, 2025
@slin1237 slin1237 merged commit d42c167 into main Dec 4, 2025
51 of 54 checks passed
@slin1237 slin1237 deleted the smg-mm-6/n branch December 4, 2025 01:16
tom-jerr pushed a commit to tom-jerr/sglang that referenced this pull request Dec 4, 2025
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
Kevin-XiongC pushed a commit to novitalabs/sglang that referenced this pull request Dec 9, 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
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