QwenLM/Qwen3-VL

▲ 10 stars today★ 19,948⑂ 1,848

Qwen3-VL is the multimodal large language model series developed by Qwen team, Alibaba Cloud.

About QwenLM/Qwen3-VL

QwenLM/Qwen3-VL is an open-source project on GitHub, mainly written in Jupyter Notebook. Qwen3-VL is the multimodal large language model series developed by Qwen team, Alibaba Cloud. It currently holds 19,948 stars and 1,848 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).

Project Overview

AI Homed tracks it on the Today's Trending board, currently at rank #74 with 10 new stars today.

GitHub Repository Details

Repository QwenLM/Qwen3-VL · default branch - · size 0 KB · watchers 0 · source: GitHub REST API and repository README

README

Qwen3-VL

💜 Qwen Chat&nbsp&nbsp | &nbsp&nbsp🤗 Hugging Face&nbsp&nbsp | &nbsp&nbsp🤖 ModelScope&nbsp&nbsp | &nbsp&nbsp📑 Blog&nbsp&nbsp | &nbsp&nbsp📚 Cookbooks&nbsp&nbsp | &nbsp&nbsp📑 Paper&nbsp&nbsp
🖥️ Demo&nbsp&nbsp | &nbsp&nbsp💬 WeChat (微信)&nbsp&nbsp | &nbsp&nbsp🫨 Discord&nbsp&nbsp | &nbsp&nbsp📑 API&nbsp&nbsp | &nbsp&nbsp🖥️ PAI-DSW

Introduction

Meet Qwen3-VL — the most powerful vision-language model in the Qwen series to date.

This generation delivers comprehensive upgrades across the board: superior text understanding & generation, deeper visual perception & reasoning, extended context length, enhanced spatial and video dynamics comprehension, and stronger agent interaction capabilities.

Available in Dense and MoE architectures that scale from edge to cloud, with Instruct and reasoning‑enhanced Thinking editions for flexible, on‑demand deployment.

Key Enhancements:

Model Architecture Updates:

1. Interleaved-MRoPE: Full‑frequency allocation over time, width, and height via robust positional embeddings, enhancing long‑horizon video reasoning.

2. DeepStack: Fuses multi‑level ViT features to capture fine‑grained details and sharpen image–text alignment.

3. Text–Timestamp Alignment: Moves beyond T‑RoPE to precise, timestamp‑grounded event localization for stronger video temporal modeling.

News

Performance

Visual Tasks

Text-Centric Tasks

Cookbooks

We are preparing cookbooks for many capabilities, including recognition, localization, document parsing, video understanding, key information extraction, and more. Welcome to learn more!

| Cookbook | Description | Open | | -------- | ----------- | ---- | | Omni Recognition | Not only identify animals, plants, people, and scenic spots but also recognize various objects such as cars and merchandise. | Colab | | Powerful Document Parsing Capabilities | The parsing of documents has reached a higher level, including not only text but also layout position information and our Qwen HTML format. | Colab | | Precise Object Grounding Across Formats | Using relative position coordinates, it supports both boxes and points, allowing for diverse combinations of positioning and labeling tasks. | Colab | | General OCR and Key Information Extraction | Stronger text recognition capabilities in natural scenes and multiple languages, supporting diverse key information extraction needs. | Colab | | Video Understanding | Better video OCR, long video understanding, and video grounding. | Colab | | Mobile Agent | Locate and think for mobile phone control. | Colab | | Computer-Use Agent | Locate and think for controlling computers and Web. | Colab | | 3D Grounding | Provide accurate 3D bounding boxes for both indoor and outdoor objects. | Colab | | Thinking with Images | Utilize image_zoom_in_tool and search_tool to facilitate the model’s precise comprehension of fine-grained visual details within images. | Colab | | MultiModal Coding | Generate accurate code based on rigorous comprehension of multimodal information. | Colab | | Long Document Understanding | Achieve rigorous semantic comprehension of ultra-long documents. | Colab | | Spatial Understanding | See, understand and reason about the spatial information | Colab |

Quickstart

Below, we provide simple examples to show how to use Qwen3-VL with 🤖 ModelScope and 🤗 Transformers.

# The Qwen3-VL model requires transformers >= 4.57.0
pip install "transformers>=4.57.0"

🤖 ModelScope

We strongly advise users especially those in mainland China to use ModelScope. snapshot_download can help you solve issues concerning downloading checkpoints.

Using 🤗 Transformers to Chat

Here we show a code snippet to show you how to use the chat model with transformers:

from transformers import AutoModelForImageTextToText, AutoProcessor

default: Load the model on the available device(s)

model = AutoModelForImageTextToText.from_pretrained( "Qwen/Qwen3-VL-235B-A22B-Instruct", dtype="auto", device_map="auto" )

We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.

model = AutoModelForImageTextToText.from_pretrained(

"Qwen/Qwen3-VL-235B-A22B-Instruct",

dtype=torch.bfloat16,

attn_implementation="flash_attention_2",

device_map="auto",

)

processor = AutoProcessor.from_pretrained("Qwen/Qwen3-VL-235B-A22B-Instruct")

messages = [ { "role": "user", "content": [ { "type": "image", "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg", }, {"type": "text", "text": "Describe this image."}, ], } ]

Preparation for inference

inputs = processor.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_dict=True, return_tensors="pt" ) inputs = inputs.to(model.device)

Inference: Generation of the output

generated_ids = model.generate(inputs, max_new_tokens=128) generated_ids_trimmed = [ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids) ] output_text = processor.batch_decode( generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False ) print(output_text)
Multi image inference
# Messages containing multiple images and a text query
messages = [
    {
        "role": "user",
        "content": [
            {"type": "image", "image": "file:///path/to/image1.jpg"},
            {"type": "image", "image": "file:///path/to/image2.jpg"},
            {"type": "text", "text": "Identify the similarities between these images."},
        ],
    }
]

Preparation for inference

inputs = processor.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_dict=True, return_tensors="pt" ) inputs = inputs.to(model.device)

Inference: Generation of the output

generated_ids = model.generate(
inputs, max_new_tokens=128) generated_ids_trimmed = [ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids) ] output_text = processor.batch_decode( generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False ) print(output_text)
Video inference
# Messages containing a video url(or a local path) and a text query
messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "video",
                "video": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-VL/space_woaudio.mp4",
            },
            {"type": "text", "text": "Describe this video."},
        ],
    }
]

Preparation for inference

inputs = processor.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_dict=True, return_tensors="pt" ) inputs = inputs.to(model.device)

Inference: Generation of the output

generated_ids = model.generate(inputs, max_new_tokens=128) generated_ids_trimmed = [ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids) ] output_text = processor.batch_decode( generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False ) print(output_text)
Batch inference
# for batch generation, padding_side should be set to left!
processor.tokenizer.padding_side = 'left'

Sample messages for batch inference

messages1 = [ { "role": "user", "content": [ {"type": "image", "image": "file:///path/to/image1.jpg"}, {"type": "image", "image": "file:///path/to/image2.jpg"}, {"type": "text", "text": "What are the common elements in these pictures?"}, ], } ] messages2 = [ {"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]}, {"role": "user", "content": [{"type": "text", "text": "Who are you?"}]}, ]

Combine messages for batch processing

messages = [messages1, messages2]

Preparation for inference

inputs = processor.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_dict=True, return_tensors="pt", padding=True # padding should be set for batch generation! ) inputs = inputs.to(model.device)

Inference: Generation of the output

generated_ids = model.generate(
inputs, max_new_tokens=128) generated_ids_trimmed = [ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids) ] output_text = processor.batch_decode( generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False ) print(output_text)
Pixel Control via Official Processor

Using the official HF processor, we can conveniently control the budget of visual tokens. Since the Qwen3-VL processor separates image and video processing, we can independently configure the pixel budget for each modality.

  • For the image processor:
The parameter size['longest_edge'] originally corresponds to max_pixels, which defines the maximum number of pixels allowed for an image (i.e., for an image of height H and width W, H × W must not exceed max_pixels; image channels are ignored for simplicity). Similarly, size['shortest_edge'] corresponds to min_pixels, specifying the minimum allowable pixel count for an image.
  • For the video processor:
The interpretation differs slightly. size['longest_edge'] represents the maximum total number of pixels across all frames in a video — for a video of shape T×H×W, the product T×H×W must not exceed size['longest_edge']. Similarly, size['shortest_edge'] sets the minimum total pixel budget for the video.

processor = AutoProcessor.from_pretrained("Qwen/Qwen3-VL-235B-A22B-Instruct")

budget for image processor, since the compression ratio is 32 for Qwen3-VL, we can set the number of visual tokens of a single image to 256-1280 (32× spatial compression)

processor.image_processor.size = {"longest_edge": 1280*32*32, "shortest_edge": 256*32*32}

budget for video processor, we can set the number of visual tokens of a single video to 256-16384 (32× spatial compression + 2× temporal compression)

processor.video_processor.size = {"longest_edge": 16384*32*32*2, "shortest_edge": 256*32*32*2}
  • You can further control the sample fps or sample frames of video, as shown below.
messages = [
    {
        "role": "user",
        "content": [
            {
                "type": "video",
                "video": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-VL/space_woaudio.mp4",
            },
            {"type": "text", "text": "Describe this video."},
        ],
    }
]

for video input, we can further control the fps or num_frames. \

defaultly, fps is set to 2

set fps = 4

inputs = processor.apply_chat_template( messages, tokenize=True, add_generation_prompt=True, return_dict=True, return_tensors="pt", fps=4 ) inputs = inputs.to(model.device)

set num_frames = 128 and overwrite the fps to None!

inputs = processor.apply_chat_template(

messages,

tokenize=True,

add_generation_prompt=True,

return_dict=True,

return_tensors="pt",

num_frames=128,

fps=None,

)

inputs = inputs.to(model.device)

Inference: Generation of the output

generated_ids = model.generate(**inputs, max_new_tokens=128) generated_ids_trimmed = [ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids) ] output_text = processor.batch_decode( generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False ) print(output_text)

New qwen-vl-utils Usage

With the latest qwen-vl-utils toolkit (backward compatible with Qwen2.5-VL), you can control pixel constraints per visual input.

pip install qwen-vl-utils==0.0.14

It's highly recommended to use [decord] feature for faster video loading.

pip install qwen-vl-utils[decord]

Compared to previous version, the new qwen-vl-utils introduces:

```python

for Qwen2.5VL, you can simply call

images, videos, video_kwargs = process_vision_info(messages, return_video_kwargs=True)

For Qwen3VL series, you should call

images, videos, video_kwargs = process_vision_inf

GitHub Stars & Activity

19,948Stars
1,848Forks
0Open issues
Jupyter NotebookLanguage

GitHub Popularity

GitHub stars19,948
Forks1,848
Open issues0
Primary languageJupyter Notebook
License-
Stars gained today10
Created-
Last pushed-

Trending History

Daily boardrank #74 · ▲ 10 stars

Related AI Projects

1

microsoft / generative-ai-for-beginners

Jupyter Notebook★ 119,834⑂ 63,090▲ 77 stars
2

microsoft / ai-agents-for-beginners

Jupyter Notebook★ 74,827⑂ 24,674▲ 81 stars
3

Lordog / dive-into-llms

Jupyter Notebook★ 54,341⑂ 6,489▲ 190 stars
4

anthropics / prompt-eng-interactive-tutorial

Jupyter Notebook★ 38,193⑂ 4,230▲ 24 stars
5

datawhalechina / happy-llm

Jupyter Notebook★ 33,836⑂ 3,205▲ 36 stars
6

shap / shap

Jupyter Notebook★ 25,759⑂ 3,750▲ 3 stars
7

karpathy / nn-zero-to-hero

Jupyter Notebook★ 24,403⑂ 3,571▲ 12 stars
8

NVIDIA / cosmos

Jupyter Notebook★ 11,824⑂ 879▲ 4 stars

More AI Rankings