[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-73971":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":10,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},73971,"Qwen3-VL","QwenLM\u002FQwen3-VL","QwenLM","Qwen3-VL is the multimodal large language model series developed by Qwen team, Alibaba Cloud.","",null,"Jupyter Notebook",19352,1783,90,380,0,28,84,206,44.75,"Apache License 2.0",false,"main",[],"2026-06-12 02:03:20","# Qwen3-VL\n\n\n\u003Cp align=\"center\">\n    \u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Fqwen3vllogo.png\" width=\"400\"\u002F>\n\u003Cp>\n\n\u003Cp align=\"center\">\n        💜 \u003Ca href=\"https:\u002F\u002Fchat.qwenlm.ai\u002F\">\u003Cb>Qwen Chat\u003C\u002Fb>\u003C\u002Fa>&nbsp&nbsp | &nbsp&nbsp🤗 \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fcollections\u002FQwen\u002Fqwen3-vl-68d2a7c1b8a8afce4ebd2dbe\">Hugging Face\u003C\u002Fa>&nbsp&nbsp | &nbsp&nbsp🤖 \u003Ca href=\"https:\u002F\u002Fmodelscope.cn\u002Fcollections\u002FQwen3-VL-5c7a94c8cb144b\">ModelScope\u003C\u002Fa>&nbsp&nbsp | &nbsp&nbsp📑 \u003Ca href=\"https:\u002F\u002Fqwen.ai\u002Fblog?id=99f0335c4ad9ff6153e517418d48535ab6d8afef&from=research.latest-advancements-list\">Blog\u003C\u002Fa>&nbsp&nbsp | &nbsp&nbsp📚 \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Ftree\u002Fmain\u002Fcookbooks\">Cookbooks\u003C\u002Fa>&nbsp&nbsp | &nbsp&nbsp📑 \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fpdf\u002F2511.21631\">Paper\u003C\u002Fa>&nbsp&nbsp\n\u003Cbr>\n🖥️ \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fspaces\u002FQwen\u002FQwen3-VL-Demo\">Demo\u003C\u002Fa>&nbsp&nbsp | &nbsp&nbsp💬 \u003Ca href=\"https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen\u002Fblob\u002Fmain\u002Fassets\u002Fwechat.png\">WeChat (微信)\u003C\u002Fa>&nbsp&nbsp | &nbsp&nbsp🫨 \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FCV4E9rpNSD\">Discord\u003C\u002Fa>&nbsp&nbsp | &nbsp&nbsp📑 \u003Ca href=\"https:\u002F\u002Fhelp.aliyun.com\u002Fzh\u002Fmodel-studio\u002Fdeveloper-reference\u002Fqwen-vl-api\">API\u003C\u002Fa>&nbsp&nbsp | &nbsp&nbsp🖥️ \u003Ca href=\"https:\u002F\u002Fgallery.pai-ml.com\u002F#\u002Fpreview\u002FdeepLearning\u002Fcv\u002Fqwen2.5-vl\">PAI-DSW\u003C\u002Fa>\n\u003C\u002Fp>\n\n\n\n## Introduction\nMeet Qwen3-VL — the most powerful vision-language model in the Qwen series to date.\n\nThis 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.\n\nAvailable in Dense and MoE architectures that scale from edge to cloud, with Instruct and reasoning‑enhanced Thinking editions for flexible, on‑demand deployment.\n\n\n#### Key Enhancements:\n\n* **Visual Agent**: Operates PC\u002Fmobile GUIs—recognizes elements, understands functions, invokes tools, completes tasks.\n\n* **Visual Coding Boost**: Generates Draw.io\u002FHTML\u002FCSS\u002FJS from images\u002Fvideos.\n\n* **Advanced Spatial Perception**: Judges object positions, viewpoints, and occlusions; provides stronger 2D grounding and enables 3D grounding for spatial reasoning and embodied AI.\n\n* **Long Context & Video Understanding**: Native 256K context, expandable to 1M; handles books and hours-long video with full recall and second-level indexing.\n\n* **Enhanced Multimodal Reasoning**: Excels in STEM\u002FMath—causal analysis and logical, evidence-based answers.\n\n* **Upgraded Visual Recognition**: Broader, higher-quality pretraining is able to “recognize everything”—celebrities, anime, products, landmarks, flora\u002Ffauna, etc.\n\n* **Expanded OCR**: Supports 32 languages (up from 10); robust in low light, blur, and tilt; better with rare\u002Fancient characters and jargon; improved long-document structure parsing.\n\n* **Text Understanding on par with pure LLMs**: Seamless text–vision fusion for lossless, unified comprehension.\n\n\n#### Model Architecture Updates:\n\n\u003Cp align=\"center\">\n    \u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Fqwen3vl_arc.jpg\" width=\"80%\"\u002F>\n\u003Cp>\n\n\n1. **Interleaved-MRoPE**: Full‑frequency allocation over time, width, and height via robust positional embeddings, enhancing long‑horizon video reasoning.\n\n2. **DeepStack**: Fuses multi‑level ViT features to capture fine‑grained details and sharpen image–text alignment.\n\n3. **Text–Timestamp Alignment:** Moves beyond T‑RoPE to precise, timestamp‑grounded event localization for stronger video temporal modeling.\n\n\n\n\n\n\n## News\n* 2025.11.27: We have released the [**Qwen3-VL paper**](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2511.21631), which introduces many technical details about Qwen3-VL, and we hope it will be helpful to everyone.\n* 2025.10.21: We have released the **Qwen3-VL-2B** ([Instruct](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-2B-Instruct)\u002F[Thinking](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-2B-Thinking)) and **Qwen3-VL-32B** ([Instruct](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-32B-Instruct)\u002F[Thinking](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-32B-Thinking)). Enjoy it!\n* 2025.10.15: We have released the **Qwen3-VL-4B** ([Instruct](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-4B-Instruct)\u002F[Thinking](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-4B-Thinking)) and **Qwen3-VL-8B** ([Instruct](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-8B-Instruct)\u002F[Thinking](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-8B-Thinking)). Enjoy it!\n* 2025.10.4: We have released the [Qwen3-VL-30B-A3B-Instruct](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-30B-A3B-Instruct) and [Qwen3-VL-30B-A3B-Thinking](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-30B-A3B-Thinking). We have also released the FP8 version of the Qwen3-VL models — available in our [HuggingFace collection](https:\u002F\u002Fhuggingface.co\u002Fcollections\u002FQwen\u002Fqwen3-vl-68d2a7c1b8a8afce4ebd2dbe) and [ModelScope collection](https:\u002F\u002Fmodelscope.cn\u002Fcollections\u002FQwen3-VL-5c7a94c8cb144b).\n* 2025.09.23: We have released the [Qwen3-VL-235B-A22B-Instruct](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-235B-A22B-Instruct) and [Qwen3-VL-235B-A22B-Thinking](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen3-VL-235B-A22B-Thinking). For more details, please check our [blog](https:\u002F\u002Fqwen.ai\u002Fblog?id=99f0335c4ad9ff6153e517418d48535ab6d8afef&from=research.latest-advancements-list)!\n* 2025.04.08: We provide the [code](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen2.5-VL\u002Ftree\u002Fmain\u002Fqwen-vl-finetune) for fine-tuning Qwen2-VL and Qwen2.5-VL.\n* 2025.03.25: We have released the [Qwen2.5-VL-32B](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen2.5-VL-32B-Instruct). It is smarter and its responses align more closely with human preferences. For more details, please check our [blog](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen2.5-vl-32b\u002F)!\n* 2025.02.20: we have released the [Qwen2.5-VL Technical Report](https:\u002F\u002Farxiv.org\u002Fabs\u002F2502.13923). Alongside the report, we have also released AWQ-quantized models for Qwen2.5-VL in three different sizes: [3B](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen2.5-VL-3B-Instruct-AWQ), [7B](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen2.5-VL-7B-Instruct-AWQ) , and [72B](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen2.5-VL-72B-Instruct-AWQ) parameters.\n* 2025.01.28: We have released the [Qwen2.5-VL series](https:\u002F\u002Fhuggingface.co\u002FQwen). For more details, please check our [blog](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen2.5-vl\u002F)!\n* 2024.12.25: We have released the [QvQ-72B-Preview](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQVQ-72B-Preview). QvQ-72B-Preview is an experimental research model, focusing on enhancing visual reasoning capabilities. For more details, please check our [blog](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqvq-72b-preview\u002F)!\n* 2024.09.19: The instruction-tuned [Qwen2-VL-72B model](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen2-VL-72B-Instruct) and its quantized version [[AWQ](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen2-VL-72B-Instruct-AWQ), [GPTQ-Int4](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen2-VL-72B-Instruct-GPTQ-Int4), [GPTQ-Int8](https:\u002F\u002Fhuggingface.co\u002FQwen\u002FQwen2-VL-72B-Instruct-GPTQ-Int8)] are now available. We have also released the [Qwen2-VL paper](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2409.12191) simultaneously.\n* 2024.08.30: We have released the [Qwen2-VL series](https:\u002F\u002Fhuggingface.co\u002Fcollections\u002FQwen\u002Fqwen2-vl-66cee7455501d7126940800d). The 2B and 7B models are now available, and the 72B model for open source is coming soon. For more details, please check our [blog](https:\u002F\u002Fqwenlm.github.io\u002Fblog\u002Fqwen2-vl\u002F)!\n\n\n## Performance\n\n### Visual Tasks\n\n\u003Cdiv style=\"display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;\">\n    \u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Ftable_nothinking_vl.jpg\" width=\"24%\" \u002F>\n    \u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-cn-beijing.aliyuncs.com\u002FQwen3-VL\u002Ftable_thinking_vl_.jpg\" width=\"24%\" \u002F>\n\t\u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Ftable_nothinking_vl-30a3.jpg\" width=\"26%\" \u002F>\n    \u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Ftable_thinking_vl_30A3.jpg\" width=\"22.5%\" \u002F>\n\u003C\u002Fdiv>\n\n\u003Cdiv style=\"display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;\">\n    \u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Fqwen3vl_2b_32b_vl_instruct.jpg\" width=\"30%\" \u002F>\n    \u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Fqwen3vl_2b_32b_vl_thinking.jpg\" width=\"24%\" \u002F>\n\u003C\u002Fdiv>\n\n\n### Text-Centric Tasks\n\n\u003Cdiv style=\"display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;\">\n    \u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Ftable_nothinking_text.jpg\" width=\"30%\" \u002F>\n    \u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Ftable_thinking_text.jpg\" width=\"32%\" \u002F>\n\t\u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Ftable_nothinking_text-30a3.jpg\" width=\"30%\" \u002F>\n\u003C\u002Fdiv>\n\n\n\n\u003Cdiv style=\"display: flex; justify-content: center; gap: 16px; flex-wrap: wrap;\">\n    \u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Fqwen3vl_4b_8b_text_instruct.jpg\" width=\"33%\" \u002F>\n    \u003Cimg src=\"https:\u002F\u002Fqianwen-res.oss-accelerate.aliyuncs.com\u002FQwen3-VL\u002Fqwen3vl_4b_8b_text_thinking.jpg\" width=\"28%\" \u002F>\n\u003C\u002Fdiv>\n\n\n## Cookbooks\n\nWe are preparing [cookbooks](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Ftree\u002Fmain\u002Fcookbooks) for many capabilities, including recognition, localization, document parsing, video understanding, key information extraction, and more. Welcome to learn more!\n\n| Cookbook | Description | Open |\n| -------- | ----------- | ---- |\n| [Omni Recognition](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fomni_recognition.ipynb) | Not only identify animals, plants, people, and scenic spots but also recognize various objects such as cars and merchandise. | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fomni_recognition.ipynb) |\n| [Powerful Document Parsing Capabilities](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fdocument_parsing.ipynb) | The parsing of documents has reached a higher level, including not only text but also layout position information and our Qwen HTML format. | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fdocument_parsing.ipynb) |\n| [Precise Object Grounding Across Formats](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002F2d_grounding.ipynb) | Using relative position coordinates, it supports both boxes and points, allowing for diverse combinations of positioning and labeling tasks. | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002F2d_grounding.ipynb) |\n| [General OCR and Key Information Extraction](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Focr.ipynb) | Stronger text recognition capabilities in natural scenes and multiple languages, supporting diverse key information extraction needs. | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Focr.ipynb) |\n| [Video Understanding](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fvideo_understanding.ipynb) | Better video OCR, long video understanding, and video grounding. | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fvideo_understanding.ipynb) |\n| [Mobile Agent](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fmobile_agent.ipynb) | Locate and think for mobile phone control. | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fmobile_agent.ipynb) |\n| [Computer-Use Agent](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fcomputer_use.ipynb) | Locate and think for controlling computers and Web. | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fcomputer_use.ipynb) |\n| [3D Grounding](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002F3d_grounding.ipynb) | Provide accurate 3D bounding boxes for both indoor and outdoor objects. | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002F3d_grounding.ipynb) |\n| [Thinking with Images](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fthink_with_images.ipynb) | Utilize image_zoom_in_tool and search_tool to facilitate the model’s precise comprehension of fine-grained visual details within images. | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fthink_with_images.ipynb) |\n| [MultiModal Coding](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fmmcode.ipynb) | Generate accurate code based on rigorous comprehension of multimodal information. | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fmmcode.ipynb) |\n| [Long Document Understanding](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Flong_document_understanding.ipynb) | Achieve rigorous semantic comprehension of ultra-long documents. | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Flong_document_understanding.ipynb) |\n| [Spatial Understanding](https:\u002F\u002Fgithub.com\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fspatial_understanding.ipynb) | See, understand and reason about the spatial information | [![Colab](https:\u002F\u002Fcolab.research.google.com\u002Fassets\u002Fcolab-badge.svg)](https:\u002F\u002Fcolab.research.google.com\u002Fgithub\u002FQwenLM\u002FQwen3-VL\u002Fblob\u002Fmain\u002Fcookbooks\u002Fspatial_understanding.ipynb) |\n\n## Quickstart\n\nBelow, we provide simple examples to show how to use Qwen3-VL with 🤖 ModelScope and 🤗 Transformers.\n\n```\n# The Qwen3-VL model requires transformers >= 4.57.0\npip install \"transformers>=4.57.0\"\n```\n\n### 🤖 ModelScope\nWe strongly advise users especially those in mainland China to use ModelScope. `snapshot_download` can help you solve issues concerning downloading checkpoints.\n\n### Using 🤗 Transformers to Chat\n\nHere we show a code snippet to show you how to use the chat model with `transformers`:\n\n```python\nfrom transformers import AutoModelForImageTextToText, AutoProcessor\n\n# default: Load the model on the available device(s)\nmodel = AutoModelForImageTextToText.from_pretrained(\n    \"Qwen\u002FQwen3-VL-235B-A22B-Instruct\", dtype=\"auto\", device_map=\"auto\"\n)\n\n# We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.\n# model = AutoModelForImageTextToText.from_pretrained(\n#     \"Qwen\u002FQwen3-VL-235B-A22B-Instruct\",\n#     dtype=torch.bfloat16,\n#     attn_implementation=\"flash_attention_2\",\n#     device_map=\"auto\",\n# )\n\nprocessor = AutoProcessor.from_pretrained(\"Qwen\u002FQwen3-VL-235B-A22B-Instruct\")\n\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"image\",\n                \"image\": \"https:\u002F\u002Fqianwen-res.oss-cn-beijing.aliyuncs.com\u002FQwen-VL\u002Fassets\u002Fdemo.jpeg\",\n            },\n            {\"type\": \"text\", \"text\": \"Describe this image.\"},\n        ],\n    }\n]\n\n# Preparation for inference\ninputs = processor.apply_chat_template(\n    messages,\n    tokenize=True,\n    add_generation_prompt=True,\n    return_dict=True,\n    return_tensors=\"pt\"\n)\ninputs = inputs.to(model.device)\n\n# Inference: Generation of the output\ngenerated_ids = model.generate(**inputs, max_new_tokens=128)\ngenerated_ids_trimmed = [\n    out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)\n]\noutput_text = processor.batch_decode(\n    generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False\n)\nprint(output_text)\n```\n\n\u003C!-- \u003Cdetails>\n\u003Csummary>Minimum VRAM requirements\u003C\u002Fsummary>\n\n| Precision | Qwen2.5-VL-3B | Qwen2.5-VL-7B | Qwen2.5-VL-72B |\n|-----------|------------| --------- | -------- |\n| FP32      | 11.5 GB    | 26.34 GB  | 266.21 GB |\n| BF16      | 5.75 GB    | 13.17 GB  | 133.11 GB |\n| INT8      | 2.87 GB    | 6.59 GB   | 66.5 GB |\n| INT4      | 1.44 GB    | 3.29 GB   | 33.28 GB |\n\nNote: The table above presents the theoretical minimum video memory requirements for inference with `transformers`; however, in practice, the actual memory usage is typically at least 1.2 times higher. For more information, see the linked resource [here](https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Faccelerate\u002Fmain\u002Fen\u002Fusage_guides\u002Fmodel_size_estimator).\n\u003C\u002Fdetails> -->\n\n\n\u003Cdetails>\n\u003Csummary>Multi image inference\u003C\u002Fsummary>\n\n```python\n# Messages containing multiple images and a text query\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\"type\": \"image\", \"image\": \"file:\u002F\u002F\u002Fpath\u002Fto\u002Fimage1.jpg\"},\n            {\"type\": \"image\", \"image\": \"file:\u002F\u002F\u002Fpath\u002Fto\u002Fimage2.jpg\"},\n            {\"type\": \"text\", \"text\": \"Identify the similarities between these images.\"},\n        ],\n    }\n]\n\n# Preparation for inference\ninputs = processor.apply_chat_template(\n    messages,\n    tokenize=True,\n    add_generation_prompt=True,\n    return_dict=True,\n    return_tensors=\"pt\"\n)\ninputs = inputs.to(model.device)\n\n# Inference: Generation of the output\ngenerated_ids = model.generate(**inputs, max_new_tokens=128)\ngenerated_ids_trimmed = [\n    out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)\n]\noutput_text = processor.batch_decode(\n    generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False\n)\nprint(output_text)\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Video inference\u003C\u002Fsummary>\n\n```python\n# Messages containing a video url(or a local path) and a text query\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"video\",\n                \"video\": \"https:\u002F\u002Fqianwen-res.oss-cn-beijing.aliyuncs.com\u002FQwen2-VL\u002Fspace_woaudio.mp4\",\n            },\n            {\"type\": \"text\", \"text\": \"Describe this video.\"},\n        ],\n    }\n]\n\n# Preparation for inference\ninputs = processor.apply_chat_template(\n    messages,\n    tokenize=True,\n    add_generation_prompt=True,\n    return_dict=True,\n    return_tensors=\"pt\"\n)\ninputs = inputs.to(model.device)\n\n# Inference: Generation of the output\ngenerated_ids = model.generate(**inputs, max_new_tokens=128)\ngenerated_ids_trimmed = [\n    out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)\n]\noutput_text = processor.batch_decode(\n    generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False\n)\nprint(output_text)\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Batch inference\u003C\u002Fsummary>\n\n```python\n# for batch generation, padding_side should be set to left!\nprocessor.tokenizer.padding_side = 'left'\n\n# Sample messages for batch inference\nmessages1 = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\"type\": \"image\", \"image\": \"file:\u002F\u002F\u002Fpath\u002Fto\u002Fimage1.jpg\"},\n            {\"type\": \"image\", \"image\": \"file:\u002F\u002F\u002Fpath\u002Fto\u002Fimage2.jpg\"},\n            {\"type\": \"text\", \"text\": \"What are the common elements in these pictures?\"},\n        ],\n    }\n]\nmessages2 = [\n    {\"role\": \"system\", \"content\": [{\"type\": \"text\", \"text\": \"You are a helpful assistant.\"}]},\n    {\"role\": \"user\", \"content\": [{\"type\": \"text\", \"text\": \"Who are you?\"}]},\n]\n# Combine messages for batch processing\nmessages = [messages1, messages2]\n\n# Preparation for inference\ninputs = processor.apply_chat_template(\n    messages,\n    tokenize=True,\n    add_generation_prompt=True,\n    return_dict=True,\n    return_tensors=\"pt\",\n    padding=True # padding should be set for batch generation!\n)\ninputs = inputs.to(model.device)\n\n# Inference: Generation of the output\ngenerated_ids = model.generate(**inputs, max_new_tokens=128)\ngenerated_ids_trimmed = [\n    out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)\n]\noutput_text = processor.batch_decode(\n    generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False\n)\nprint(output_text)\n```\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Pixel Control via Official Processor\u003C\u002Fsummary>\n\nUsing 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.\n- **For the image processor**:  \n  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).  \n  Similarly, `size['shortest_edge']` corresponds to `min_pixels`, specifying the minimum allowable pixel count for an image.\n\n- **For the video processor**:  \n  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']`.  \n  Similarly, `size['shortest_edge']` sets the minimum total pixel budget for the video.\n\n```python\nprocessor = AutoProcessor.from_pretrained(\"Qwen\u002FQwen3-VL-235B-A22B-Instruct\")\n\n# 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)\nprocessor.image_processor.size = {\"longest_edge\": 1280*32*32, \"shortest_edge\": 256*32*32}\n\n# 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)\nprocessor.video_processor.size = {\"longest_edge\": 16384*32*32*2, \"shortest_edge\": 256*32*32*2}\n```\n\n- You can further control the **sample fps** or **sample frames** of video, as shown below.\n\n```python\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"video\",\n                \"video\": \"https:\u002F\u002Fqianwen-res.oss-cn-beijing.aliyuncs.com\u002FQwen2-VL\u002Fspace_woaudio.mp4\",\n            },\n            {\"type\": \"text\", \"text\": \"Describe this video.\"},\n        ],\n    }\n]\n\n# for video input, we can further control the fps or num_frames. \\\n# defaultly, fps is set to 2\n\n# set fps = 4\ninputs = processor.apply_chat_template(\n    messages,\n    tokenize=True,\n    add_generation_prompt=True,\n    return_dict=True,\n    return_tensors=\"pt\",\n    fps=4\n)\ninputs = inputs.to(model.device)\n\n# set num_frames = 128 and overwrite the fps to None!\n# inputs = processor.apply_chat_template(\n#     messages,\n#     tokenize=True,\n#     add_generation_prompt=True,\n#     return_dict=True,\n#     return_tensors=\"pt\",\n#     num_frames=128,\n#     fps=None,\n# )\n# inputs = inputs.to(model.device)\n\n# Inference: Generation of the output\ngenerated_ids = model.generate(**inputs, max_new_tokens=128)\ngenerated_ids_trimmed = [\n    out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)\n]\noutput_text = processor.batch_decode(\n    generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False\n)\nprint(output_text)\n```\n\u003C\u002Fdetails>\n\n### New `qwen-vl-utils` Usage\n\nWith the latest `qwen-vl-utils` toolkit (backward compatible with Qwen2.5-VL), you can control pixel constraints per visual input.\n\n```bash\npip install qwen-vl-utils==0.0.14\n# It's highly recommended to use `[decord]` feature for faster video loading.\n# pip install qwen-vl-utils[decord]\n```\n\nCompared to previous version, the new `qwen-vl-utils` introduces:\n\n- \"image_patch_size\": `14` for Qwen2.5-VL and `16` for Qwen3-VL. Default set to `14`.\n\n- \"return_video_metadata\"(Qwen3-VL only): Due to the new video processor, if True, each video returns as (video_tensor, video_metadata). Default set to `False`.\n\n```python\n# for Qwen2.5VL, you can simply call \nimages, videos, video_kwargs = process_vision_info(messages, return_video_kwargs=True)\n\n# For Qwen3VL series, you should call \nimages, videos, video_kwargs = process_vision_info(messages, image_patch_size=16, return_video_kwargs=True, return_video_metadata=True)\n```\n\n📌 Note: Since `qwen-vl-utils` already resizes images\u002Fvideos, pass `do_resize=False` to the processor to avoid duplicate resizing.\n\n\u003Cdetails>\n\u003Csummary>Process Images\u003C\u002Fsummary>\n\nFor input images, we support local files, base64, and URLs. \n\n```python\n# You can directly insert a local file path, a URL, or a base64-encoded image into the position where you want in the text.\n## Local file path\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\"type\": \"image\", \"image\": \"file:\u002F\u002F\u002Fpath\u002Fto\u002Fyour\u002Fimage.jpg\"},\n            {\"type\": \"text\", \"text\": \"Describe this image.\"},\n        ],\n    }\n]\n## Image URL\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\"type\": \"image\", \"image\": \"http:\u002F\u002Fpath\u002Fto\u002Fyour\u002Fimage.jpg\"},\n            {\"type\": \"text\", \"text\": \"Describe this image.\"},\n        ],\n    }\n]\n## Base64 encoded image\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\"type\": \"image\", \"image\": \"data:image;base64,\u002F9j\u002F...\"},\n            {\"type\": \"text\", \"text\": \"Describe this image.\"},\n        ],\n    }\n]\n```\n\nWe provide two methods for fine-grained control over the image size input to the model:\n\n- Specify exact dimensions: Directly set resized_height and resized_width. These values will be rounded to the nearest multiple of 32 (32 for Qwen3VL, 28 for Qwen2.5VL).\n\n- Define min_pixels and max_pixels: Images will be resized to maintain their aspect ratio within the range of min_pixels and max_pixels\n\n```python\nfrom transformers import AutoModelForImageTextToText, AutoProcessor\nfrom qwen_vl_utils import process_vision_info\n\nmodel = AutoModelForImageTextToText.from_pretrained(\n    \"Qwen\u002FQwen3-VL-235B-A22B-Instruct\", dtype=\"auto\", device_map=\"auto\"\n)\n\nprocessor = AutoProcessor.from_pretrained(\"Qwen\u002FQwen3-VL-235B-A22B-Instruct\")\n\n# resized_height and resized_width\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"image\",\n                \"image\": \"https:\u002F\u002Fqianwen-res.oss-cn-beijing.aliyuncs.com\u002FQwen-VL\u002Fassets\u002Fdemo.jpeg\",\n                \"resized_height\": 280,\n                \"resized_width\": 420,\n            },\n            {\"type\": \"text\", \"text\": \"Describe this image.\"},\n        ],\n    }\n]\n\n# min_pixels and max_pixels\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"image\",\n                \"image\": \"https:\u002F\u002Fqianwen-res.oss-cn-beijing.aliyuncs.com\u002FQwen-VL\u002Fassets\u002Fdemo.jpeg\",\n                \"min_pixels\": 50176,\n                \"max_pixels\": 50176,\n\n            },\n            {\"type\": \"text\", \"text\": \"Describe this image.\"},\n        ],\n    }\n]\n\n# Preparation for inference with qwen-vl-utils\ntext = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)\nimages, videos = process_vision_info(messages, image_patch_size=16)\n\n# since qwen-vl-utils has resize the images\u002Fvideos, \\\n# we should pass do_resize=False to avoid duplicate operation in processor!\ninputs = processor(text=text, images=images, videos=videos, do_resize=False, return_tensors=\"pt\")\ninputs = inputs.to(model.device)\n\n# Inference: Generation of the output\ngenerated_ids = model.generate(**inputs, max_new_tokens=128)\ngenerated_ids_trimmed = [\n    out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)\n]\noutput_text = processor.batch_decode(\n    generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False\n)\nprint(output_text)\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Process Videos\u003C\u002Fsummary>\n\nFor input videos, we support images lists, local path and url. \n\n```python\n# Messages containing a images list as a video and a text query\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"video\",\n                \"video\": [\n                    \"file:\u002F\u002F\u002Fpath\u002Fto\u002Fframe1.jpg\",\n                    \"file:\u002F\u002F\u002Fpath\u002Fto\u002Fframe2.jpg\",\n                    \"file:\u002F\u002F\u002Fpath\u002Fto\u002Fframe3.jpg\",\n                    \"file:\u002F\u002F\u002Fpath\u002Fto\u002Fframe4.jpg\",\n                ],\n                'sample_fps':'1', # sample_fps: frame sampling rate (frames per second), used to determine timestamps for each frame\n            },\n            {\"type\": \"text\", \"text\": \"Describe this video.\"},\n        ],\n    }\n]\n\n# Messages containing a local video path and a text query\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"video\",\n                \"video\": \"file:\u002F\u002F\u002Fpath\u002Fto\u002Fvideo1.mp4\",\n                \"max_pixels\": 360 * 420,\n                \"fps\": 1.0,\n            },\n            {\"type\": \"text\", \"text\": \"Describe this video.\"},\n        ],\n    }\n]\n\n# Messages containing a video url and a text query\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"video\",\n                \"video\": \"https:\u002F\u002Fqianwen-res.oss-cn-beijing.aliyuncs.com\u002FQwen2-VL\u002Fspace_woaudio.mp4\",\n                \"min_pixels\": 4 * 32 * 32,\n                \"max_pixels\": 256 * 32 * 32,\n                \"total_pixels\": 20480 * 32 * 32,\n            },\n            {\"type\": \"text\", \"text\": \"Describe this video.\"},\n        ],\n    }\n]\n\n```\n\nWe recommend setting appropriate values for the `min_pixels` and `max_pixels` parameters based on available GPU memory and the specific application scenario to restrict the resolution of individual frames in the video. \n\nAlternatively, you can use the `total_pixels` parameter to limit the total number of tokens in the video (it is recommended to set this value below 24576 * 32 * 32 to avoid excessively long input sequences). For more details on parameter usage and processing logic, please refer to the `fetch_video` function in `qwen_vl_utils\u002Fvision_process.py`.\n\n```python\nfrom transformers import AutoModelForImageTextToText, AutoProcessor\nfrom qwen_vl_utils import process_vision_info\n\nmodel = AutoModelForImageTextToText.from_pretrained(\n    \"Qwen\u002FQwen3-VL-235B-A22B-Instruct\", dtype=\"auto\", device_map=\"auto\"\n)\n\nprocessor = AutoProcessor.from_pretrained(\"Qwen\u002FQwen3-VL-235B-A22B-Instruct\")\n\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"video\",\n                \"video\": \"https:\u002F\u002Fqianwen-res.oss-cn-beijing.aliyuncs.com\u002FQwen2-VL\u002Fspace_woaudio.mp4\",\n                \"min_pixels\": 4 * 32 * 32,\n                \"max_pixels\": 256 * 32 * 32,\n                \"total_pixels\": 20480 * 32 * 32,\n            },\n            {\"type\": \"text\", \"text\": \"Describe this video.\"},\n        ],\n    }\n]\n\ntext = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)\nimages, videos, video_kwargs = process_vision_info(messages, image_patch_size=16, return_video_kwargs=True, return_video_metadata=True)\n\n# split the videos and according metadatas\nif videos is not None:\n    videos, video_metadatas = zip(*videos)\n    videos, video_metadatas = list(videos), list(video_metadatas)\nelse:\n    video_metadatas = None\n\n# since qwen-vl-utils has resize the images\u002Fvideos, \\\n# we should pass do_resize=False to avoid duplicate operation in processor!\ninputs = processor(text=text, images=images, videos=videos, video_metadata=video_metadatas, return_tensors=\"pt\", do_resize=False, **video_kwargs)\ninputs = inputs.to(model.device)\n\n# Inference: Generation of the output\ngenerated_ids = model.generate(**inputs, max_new_tokens=128)\ngenerated_ids_trimmed = [\n    out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)\n]\noutput_text = processor.batch_decode(\n    generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False\n)\nprint(output_text)\n```\n\n\u003C\u002Fdetails>\n\n\u003Cdetails>\n\u003Csummary>Video Backends and URL Compatibility\u003C\u002Fsummary>\n\nCurrently, `qwen-vl-utils` supports three video decoding backends: `torchvision`, `decord`, and `torchcodec`. While `decord` and `torchcodec` generally offer significantly faster decoding speeds compared to `torchvision`, we recommend using `torchcodec`. This is because `decord` has known issues, such as decoding hangs, and its project is no longer actively maintained.\n\n- For `decord`, if you are not using Linux, you might not be able to install `decord` from PyPI. In that case, you can use `pip install qwen-vl-utils` which will fall back to using torchvision for video processing. However, you can still [install decord from source](https:\u002F\u002Fgithub.com\u002Fdmlc\u002Fdecord?tab=readme-ov-file#install-from-source) to get decord used when loading video.\n\n- To use `torchcodec` as the backend for video decoding, follow the installation instructions provided in the official [torchcodec repository](https:\u002F\u002Fgithub.com\u002Fpytorch\u002Ftorchcodec\u002Ftree\u002Fmain?tab=readme-ov-file#installing-torchcodec) and install it manually. Note that `torchcodec` depends on FFmpeg for decoding functionality.\n\nVideo URL compatibility is primarily determined by the version of the third-party library being used. For more details, refer to the table below. If you prefer not to use the default backend, you can switch it by setting `FORCE_QWENVL_VIDEO_READER` to `torchvision`, `decord`, or `torchcodec`.\n\n| Backend     | HTTP | HTTPS |\n|-------------|------|-------|\n| torchvision >= 0.19.0 | ✅  | ✅   |\n| torchvision \u003C 0.19.0  | ❌  | ❌   |\n| decord      | ✅  | ❌   |\n| torchcodec  | ✅  | ✅   |\n\n\u003C\u002Fdetails>\n\n\n### More Usage Tips\n\n#### Add ids for Multiple Visual Inputs\nBy default, images and video content are directly included in the conversation. When handling multiple images, it's helpful to add labels to the images and videos for better reference. Users can control this behavior with the following settings:\n\u003Cdetails>\n\u003Csummary>Add vision ids\u003C\u002Fsummary>\n\n```python\nconversation = [\n    {\n        \"role\": \"user\",\n        \"content\": [{\"type\": \"image\"}, {\"type\": \"text\", \"text\": \"Hello, how are you?\"}],\n    },\n    {\n        \"role\": \"assistant\",\n        \"content\": \"I'm doing well, thank you for asking. How can I assist you today?\",\n    },\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\"type\": \"text\", \"text\": \"Can you describe these images and video?\"},\n            {\"type\": \"image\"},\n            {\"type\": \"image\"},\n            {\"type\": \"video\"},\n            {\"type\": \"text\", \"text\": \"These are from my vacation.\"},\n        ],\n    },\n    {\n        \"role\": \"assistant\",\n        \"content\": \"I'd be happy to describe the images and video for you. Could you please provide more context about your vacation?\",\n    },\n    {\n        \"role\": \"user\",\n        \"content\": \"It was a trip to the mountains. Can you see the details in the images and video?\",\n    },\n]\n\n# default:\nprompt_without_id = processor.apply_chat_template(\n    conversation, add_generation_prompt=True\n)\n# Excepted output: '\u003C|im_start|>system\\nYou are a helpful assistant.\u003C|im_end|>\\n\u003C|im_start|>user\\n\u003C|vision_start|>\u003C|image_pad|>\u003C|vision_end|>Hello, how are you?\u003C|im_end|>\\n\u003C|im_start|>assistant\\nI'm doing well, thank you for asking. How can I assist you today?\u003C|im_end|>\\n\u003C|im_start|>user\\nCan you describe these images and video?\u003C|vision_start|>\u003C|image_pad|>\u003C|vision_end|>\u003C|vision_start|>\u003C|image_pad|>\u003C|vision_end|>\u003C|vision_start|>\u003C|video_pad|>\u003C|vision_end|>These are from my vacation.\u003C|im_end|>\\n\u003C|im_start|>assistant\\nI'd be happy to describe the images and video for you. Could you please provide more context about your vacation?\u003C|im_end|>\\n\u003C|im_start|>user\\nIt was a trip to the mountains. Can you see the details in the images and video?\u003C|im_end|>\\n\u003C|im_start|>assistant\\n'\n\n\n# add ids\nprompt_with_id = processor.apply_chat_template(\n    conversation, add_generation_prompt=True, add_vision_id=True\n)\n# Excepted output: '\u003C|im_start|>system\\nYou are a helpful assistant.\u003C|im_end|>\\n\u003C|im_start|>user\\nPicture 1: \u003C|vision_start|>\u003C|image_pad|>\u003C|vision_end|>Hello, how are you?\u003C|im_end|>\\n\u003C|im_start|>assistant\\nI'm doing well, thank you for asking. How can I assist you today?\u003C|im_end|>\\n\u003C|im_start|>user\\nCan you describe these images and video?Picture 2: \u003C|vision_start|>\u003C|image_pad|>\u003C|vision_end|>Picture 3: \u003C|vision_start|>\u003C|image_pad|>\u003C|vision_end|>Video 1: \u003C|vision_start|>\u003C|video_pad|>\u003C|vision_end|>These are from my vacation.\u003C|im_end|>\\n\u003C|im_start|>assistant\\nI'd be happy to describe the images and video for you. Could you please provide more context about your vacation?\u003C|im_end|>\\n\u003C|im_start|>user\\nIt was a trip to the mountains. Can you see the details in the images and video?\u003C|im_end|>\\n\u003C|im_start|>assistant\\n'\n```\n\u003C\u002Fdetails>\n\n#### Flash-Attention 2 to speed up generation\n\nFirst, make sure to install the latest version of Flash Attention 2:\n\n```bash\npip install -U flash-attn --no-build-isolation\n```\n\nAlso, you should have a hardware that is compatible with Flash-Attention 2. Read more about it in the official documentation of the [flash attention repository](https:\u002F\u002Fgithub.com\u002FDao-AILab\u002Fflash-attention). FlashAttention-2 can only be used when a model is loaded in `torch.float16` or `torch.bfloat16`.\n\nTo load and run a model using Flash Attention-2, simply add `attn_implementation=\"flash_attention_2\"` when loading the model as follows:\n\n```python\nimport torch\nfrom transformers import AutoModelForImageTextToText\n\nmodel = AutoModelForImageTextToText.from_pretrained(\n    \"Qwen\u002FQwen3-VL-235B-A22B-Instruct\", \n    torch_dtype=torch.bfloat16, \n    attn_implementation=\"flash_attention_2\",\n)\n```\n\n#### Processing Long Texts\n\nThe current `config.json` is set for context length up to 256K tokens.\nTo handle extensive inputs exceeding 256K tokens, we utilize [YaRN](https:\u002F\u002Farxiv.org\u002Fabs\u002F2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.\n\nFor supported frameworks (currently transformers and vLLM), you could modify `max_position_embeddings` and `rope_scaling` in `config.json` to enable YaRN:\n\n```\n{\n    \"max_position_embeddings\": 1000000,\n\t...,\n    \"rope_scaling\": {\n        \"rope_type\": \"yarn\",\n        \"mrope_section\": [\n            24,\n            20,\n            20\n        ],\n        \"mrope_interleaved\": true,\n        \"factor\": 3.0,\n        \"original_max_position_embeddings\": 262144\n    },\n    ...\n}\n```\n\nWhen using vLLM for serving, you can also enable YaRN by adding the additional arguments `--rope-scaling` and `--max-model-len`.\n\n```\nvllm serve Qwen\u002FQwen3-VL-235B-A22B-Instruct --rope-scaling '{\"rope_type\":\"yarn\",\"factor\":3.0,\"original_max_position_embeddings\": 262144,\"mrope_section\":[24,20,20],\"mrope_interleaved\": true}' --max-model-len 1000000\n```\n\n> Because Interleaved-MRoPE’s position IDs grow more slowly than vanilla RoPE, use a **smaller scaling factor**. For example, to support 1M context with 256K context length, set factor=2 or 3 — not 4.\n\n### Try Qwen3-VL-235B-A22 with API!\n\nTo explore Qwen3-VL-235B-A22, a more fascinating multimodal model, we encourage you to test our cutting-edge API service. Let's start the exciting journey right now!\n```python\nfrom openai import OpenAI\n\n# set your DASHSCOPE_API_KEY here\nDASHSCOPE_API_KEY = \"\"\n\nclient = OpenAI(\n    api_key=DASHSCOPE_API_KEY,\n    base_url=\"https:\u002F\u002Fdashscope.aliyuncs.com\u002Fcompatible-mode\u002Fv1\",\n)\n\ncompletion = client.chat.completions.create(\n    model=\"qwen3-vl-235b-a22b-instruct\",\n    messages=[{\"role\": \"user\", \"content\": [\n        {\"type\": \"image_url\",\n         \"image_url\": {\"url\": \"https:\u002F\u002Fdashscope.oss-cn-beijing.aliyuncs.com\u002Fimages\u002Fdog_and_girl.jpeg\"}},\n        {\"type\": \"text\", \"text\": \"这是什么\"},\n    ]}]\n)\nprint(completion.model_dump_json())\n```\n\nFor more usage, please refer to the tutorial at [aliyun](https:\u002F\u002Fhelp.aliyun.com\u002Fzh\u002Fmodel-studio\u002Fdeveloper-reference\u002Fqwen-vl-api).\n\n\n### Web UI Example\n\nIn this section, we provide instructions for users to build a web-based user interface (UI) demo. This UI demo allows users to interact with a predefined model or application through a web browser. Follow the steps below to get started.\n\nInstall the required dependencies by running the following command:\n\n```bash\npip install -r requirements_web_demo.txt\n```\n\n\nLaunch a browser-based UI to interact with the model:\n\n```bash\npython web_demo_mm.py -c \u002Fyour\u002Fpath\u002Fto\u002Fqwen3vl\u002Fweight\n```\n\nAfter running the command, you’ll see a link generated in the terminal similar to this:\n\n```\nRunning on local: http:\u002F\u002F127.0.0.1:7860\u002F\n```\n\nOpen the link in your browser to interact with the model — try text, images, or other features.  For a quick start, you can also use our pre-built Docker image:\n\n```\ncd docker && bash run_web_demo.sh -c \u002Fyour\u002Fpath\u002Fto\u002Fqwen3vl\u002Fweight --port 8881\n```\n\n\n\n## Deployment\n\nWe recommend using vLLM for fast Qwen3-VL deployment and inference. You need to install `vllm>=0.11.0` to enable Qwen3-VL support. You can also use our [official docker image](#-docker).\n\nPlease check [vLLM official documentation](https:\u002F\u002Fdocs.vllm.ai\u002Fen\u002Flatest\u002Fserving\u002Fmultimodal_inputs.html) for more details about online serving and offline inference for multimodal models.\n\n### Installation\n```bash\npip install accelerate\npip install qwen-vl-utils==0.0.14\n# Install the latest version of vLLM 'vllm>=0.11.0'\nuv pip install -U vllm\n```\n\n### Online Serving\nYou can start either a vLLM or SGLang server to serve LLMs efficiently, and then access it using an OpenAI-style API.\n\nThe following launch command is applicable to H100\u002FH200; for more efficient deployment or deployment on other GPUs, please refer to the [vLLM community guide](https:\u002F\u002Fdocs.vllm.ai\u002Fprojects\u002Frecipes\u002Fen\u002Flatest\u002FQwen\u002FQwen3-VL.html).\n\n* vLLM server\n```shell\n# Efficient inference with FP8 checkpoint\n# Requires NVIDIA H100+ and CUDA 12+\nvllm serve Qwen\u002FQwen3-VL-235B-A22B-Instruct-FP8 \\\n  --tensor-parallel-size 8 \\\n  --mm-encoder-tp-mode data \\\n  --enable-expert-parallel \\\n  --async-scheduling \\\n  --media-io-kwargs '{\"video\": {\"num_frames\": -1}}' \\\n  --host 0.0.0.0 \\\n  --port 22002\n```\n* SGLang server\n```\npython -m sglang.launch_server \\\n   --model-path Qwen\u002FQwen3-VL-235B-A22B-Instruct \\\n   --host 0.0.0.0 \\\n   --port 22002 \\\n   --tp 4\n```\n* Image Request Example\n```python\nimport time\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=\"EMPTY\",\n    base_url=\"http:\u002F\u002F127.0.0.1:22002\u002Fv1\",\n    timeout=3600\n)\n\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"image_url\",\n                \"image_url\": {\n                    \"url\": \"https:\u002F\u002Fofasys-multimodal-wlcb-3-toshanghai.oss-accelerate.aliyuncs.com\u002Fwpf272043\u002Fkeepme\u002Fimage\u002Freceipt.png\"\n                }\n            },\n            {\n                \"type\": \"text\",\n                \"text\": \"Read all the text in the image.\"\n            }\n        ]\n    }\n]\n\nstart = time.time()\nresponse = client.chat.completions.create(\n    model=\"Qwen\u002FQwen3-VL-235B-A22B-Instruct-FP8\",\n    messages=messages,\n    max_tokens=2048\n)\nprint(f\"Response costs: {time.time() - start:.2f}s\")\nprint(f\"Generated text: {response.choices[0].message.content}\")\n```\n* Video Request Example\n```python\nimport time\nfrom openai import OpenAI\n\nclient = OpenAI(\n    api_key=\"EMPTY\",\n    base_url=\"http:\u002F\u002F127.0.0.1:22002\u002Fv1\",\n    timeout=3600\n)\n\nmessages = [\n    {\n        \"role\": \"user\",\n        \"content\": [\n            {\n                \"type\": \"video_url\",\n                \"video_url\": {\n                    \"url\": \"https:\u002F\u002Fqianwen-res.oss-cn-beijing.aliyuncs.com\u002FQwen2-VL\u002Fspace_woaudio.mp4\"\n                }\n            },\n            {\n                \"type\": \"text\",\n                \"text\": \"How long is this video?\"\n            }\n        ]\n    }\n]\n\nstart = time.time()\n\n# When vLLM is launched with `--media-io-kwargs '{\"video\": {\"num_frames\": -1}}'`,\n# video frame sampling can be configured via `extra_body` (e.g., by setting `fps`).\n# This feature is currently supported only in vLLM.\n#\n# By default, `fps=2` and `do_sample_frames=True`.\n# With `do_sample_frames=True`, you can customize the `fps` value to set your desired video sampling rate.\nresponse = client.chat.completions.create(\n    model=\"Qwen\u002FQwen3-VL-235B-A22B-Instruct-FP8\",\n    messages=messages,\n    max_tokens=2048,\n    extra_body={\"mm_processor_kwargs\": {\"fps\": 2, \"do_sample_frames\": True}}\n)\n\nprint(f\"Response costs: {time.time() - start:.2f}s\")\nprint(f\"Generated text: {response.choices[0].message.content}\")\n```\n\n### Offline Inference\n\nYou can also use vLLM or SGLang to inference Qwen3-VL locally:\n\n* vLLM Examples\n``` python\n# -*- coding: utf-8 -*-\nimport torch\nfrom qwen_vl_utils import process_vision_info\nfrom transformers import AutoProcessor\nfrom vllm import LLM, SamplingParams\n\nimport os\nos.environ['VLLM_WORKER_MULTIPROC_METHOD'] = 'spawn'\n\ndef prepare_inputs_for_vllm(messages, processor):\n    text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)\n    # qwen_vl_utils 0.0.14+ reqired\n    image_inputs, video_inputs, video_kwargs = process_vision_info(\n        messages,\n        image_patch_size=processor.image_processor.patch_size,\n        return_video_kwargs=True,\n        return_video_metadata=True\n    )\n    print(f\"video_kwargs: {video_kwargs}\")\n\n    mm_data = {}\n    if image_inputs is not None:\n        mm_data['image'] = image_inputs\n    if video_inputs is not None:\n        mm_data['video'] = video_inputs\n\n    return {\n        'prompt': text,\n        'multi_modal_data': mm_data,\n        'mm_processor_kwargs': video_kwargs\n    }\n\n\nif __name__ == '__main__':\n    # messages = [\n    #     {\n    #         \"role\": \"user\",\n    #         \"content\": [\n    #             {\n    #                 \"type\": \"video\",\n    #                 \"video\": \"https:\u002F\u002Fqianwen-res.oss-cn-beijing.aliyuncs.com\u002FQwen2-VL\u002Fspace_woaudio.mp4\",\n    #             },\n    #             {\"type\": \"text\", \"text\": \"这段视频有多长\"},\n    #         ],\n    #     }\n    # ]\n\n    messages = [\n        {\n            \"role\": \"user\",\n            \"content\": [\n              {\n                  \"type\": \"image\",\n                  \"image\": \"https:\u002F\u002Fofasys-multimodal-wlcb-3-toshanghai.oss-accelerate.aliyuncs.com\u002Fwpf272043\u002Fkeepme\u002Fimage\u002Freceipt.png\",\n              },\n              {\"type\": \"text\", \"text\": \"Read all the text in the image.\"},\n            ],\n        }\n    ]\n\n    # TODO: change to your own checkpoint path\n    checkpoint_path = \"Qwen\u002FQwen3-VL-235B-A22B-Instruct-FP8\"\n    processor = AutoProcessor.from_pretrained(checkpoint_path)\n    inputs = [prepare_inputs_for_vllm(message, processor) for message in [messages]]\n\n    llm = LLM(\n        model=checkpoint_path,\n        mm_encoder_tp_mode=\"data\",\n        enable_expert_parallel=True,\n        tensor_parallel_size=torch.cuda.device_count(),\n        seed=0\n    )\n\n    sampling_params = SamplingParams(\n        temperature=0,\n        max_tokens=1024,\n        top_k=-1,\n        stop_token_ids=[],\n    )\n\n    for i, input_ in enumerate(inputs):\n        print()\n        print('=' * 40)\n        print(f\"Inputs[{i}]: {input_['prompt']=!r}\")\n    print('\\n' + '>' * 40)\n\n    outputs = llm.generate(inputs, sampling_params=sampling_params)\n    for i, output in enumerate(outputs):\n        generated_text = output.outputs[0].text\n        print()\n        print('=' * 40)\n        print(f\"Generated text: {generated_text!r}\")\n```\n\n* SGLang Examples\n```python\nimport time\nfrom PIL import Image\nfrom sglang import Engine\nfrom qwen_vl_utils import process_vision_info\nfrom transformers import AutoProcessor, AutoConfig\n\n\nif __name__ == \"__main__\":\n    # TODO: change to your own checkpoint path\n    checkpoint_path = \"Qwen\u002FQwen3-VL-235B-A22B-Instruct\"\n    processor = AutoProcessor.from_pretrained(checkpoint_path)\n\n    messages = [\n        {\n            \"role\": \"user\",\n            \"content\": [\n              {\n                  \"type\": \"image\",\n                  \"image\": \"https:\u002F\u002Fofasys-multimodal-wlcb-3-toshanghai.oss-accelerate.aliyuncs.com\u002Fwpf272043\u002Fkeepme\u002Fimage\u002Freceipt.png\",\n              },\n              {\"type\": \"text\", \"text\": \"Read all the text in the image.\"},\n            ],\n        }\n    ]\n\n    text = processor.apply_chat_template(\n        messages,\n        tokenize=False,\n        add_generation_prompt=True\n    )\n\n    image_inputs, _ = process_vision_info(messages, image_patch_size=processor.image_processor.patch_size)\n\n    llm = Engine(\n        model_path=checkpoint_path,\n        enable_multimodal=True,\n        mem_fraction_static=0.8,\n        tp_size=4,\n        attention_backend=\"fa3\",\n        context_length=10240,\n        disable_cuda_graph=True,\n    )\n\n    start = time.time()\n    sampling_params = {\"max_new_tokens\": 1024}\n    response = llm.generate(prompt=text, image_data=image_inputs, sampling_params=sampling_params)\n    print(f\"Response costs: {time.time() - start:.2f}s\")\n    print(f\"Generated text: {response['text']}\")\n```\n\n\n## Evaluation Reproduction\nTo facilitate faithful reproduction of our reported results, we summarize our official evaluation settings below.\n- Inference runtime: [vLLM](https:\u002F\u002Fgithub.com\u002Fvllm-project\u002Fvllm)\n- Evaluation frameworks: [VLMEvalKit](https:\u002F\u002Fgithub.com\u002Fopen-compass\u002FVLMEvalKit), [lmms-eval](https:\u002F\u002Fgithub.com\u002FEvolvingLMMs-Lab\u002Flmms-eval)\n- Notes:\n  - For a few benchmarks, we slightly modified the evaluation prompts; detailed changes will be documented in the upcoming technical report.\n  - A small number of benchmarks are internally constructed; we plan to release the code and reproduction assets afterwards.\n### Generation Hyperparameters\n#### Instruct models\n```bash\nexport greedy='false'\nexport seed=3407\nexport top_p=0.8\nexport top_k=20\nexport temperature=0.7\nexport repetition_penalty=1.0\nexport presence_penalty=1.5\nexport out_seq_length=32768\n```\n#### Thinking models\n```bash\nexport greedy='false'\nexport seed=1234\nexport top_p=0.95\nexport top_k=20\nexport repetition_penalty=1.0\nexport presence_penalty=0.0\nexport temperature=0.6\nexport out_seq_length=40960\n```\n\n\n## 🐳 Docker\n\nTo simplify the deploy process, we provide docker images with pre-build environments: [qwenllm\u002Fqwenvl](https:\u002F\u002Fhub.docker.com\u002Fr\u002Fqwenllm\u002Fqwenvl). You only need to install the driver and download model files to launch demos.\n\n```bash\ndocker run --gpus all --ipc=host --network=host --rm --name qwen3vl -it qwenllm\u002Fqwenvl:qwen3vl-cu128 bash\n```\n\n## Citation\n\nIf you find our paper and code useful in your research, please consider giving a star :star: and citation :pencil: :)\n\n\n\n\n```BibTeX\n\n@article{Qwen3-VL,\n      title={Qwen3-VL Technical Report}, \n      author={Shuai Bai and Yuxuan Cai and Ruizhe Chen and Keqin Chen and Xionghui Chen and Zesen Cheng and Lianghao Deng and Wei Ding and Chang Gao and Chunjiang Ge and Wenbin Ge and Zhifang Guo and Qidong Huang and Jie Huang and Fei Huang and Binyuan Hui and Shutong Jiang and Zhaohai Li and Mingsheng Li and Mei Li and Kaixin Li and Zicheng Lin and Junyang Lin and Xuejing Liu and Jiawei Liu and Chenglong Liu and Yang Liu and Dayiheng Liu and Shixuan Liu and Dunjie Lu and Ruilin Luo and Chenxu Lv and Rui Men and Lingchen Meng and Xuancheng Ren and Xingzhang Ren and Sibo Song and Yuchong Sun and Jun Tang and Jianhong Tu and Jianqiang Wan and Peng Wang and Pengfei Wang and Qiuyue Wang and Yuxuan Wang and Tianbao Xie and Yiheng Xu and Haiyang Xu and Jin Xu and Zhibo Yang and Mingkun Yang and Jianxin Yang and An Yang and Bowen Yu and Fei Zhang and Hang Zhang and Xi Zhang and Bo Zheng and Humen Zhong and Jingren Zhou and Fan Zhou and Jing Zhou and Yuanzhi Zhu and Ke Zhu},\n\t  journal={arXiv preprint arXiv:2511.21631},\n      year={2025}\n}\n\n@article{Qwen2.5-VL,\n  title={Qwen2.5-VL Technical Report},\n  author={Bai, Shuai and Chen, Keqin and Liu, Xuejing and Wang, Jialin and Ge, Wenbin and Song, Sibo and Dang, Kai and Wang, Peng and Wang, Shijie and Tang, Jun and Zhong, Humen and Zhu, Yuanzhi and Yang, Mingkun and Li, Zhaohai and Wan, Jianqiang and Wang, Pengfei and Ding, Wei and Fu, Zheren and Xu, Yiheng and Ye, Jiabo and Zhang, Xi and Xie, Tianbao and Cheng, Zesen and Zhang, Hang and Yang, Zhibo and Xu, Haiyang and Lin, Junyang},\n  journal={arXiv preprint arXiv:2502.13923},\n  year={2025}\n}\n\n@article{Qwen2-VL,\n  title={Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution},\n  author={Wang, Peng and Bai, Shuai and Tan, Sinan and Wang, Shijie and Fan, Zhihao and Bai, Jinze and Chen, Keqin and Liu, Xuejing and Wang, Jialin and Ge, Wenbin and Fan, Yang and Dang, Kai and Du, Mengfei and Ren, Xuancheng and Men, Rui and Liu, Dayiheng and Zhou, Chang and Zhou, Jingren and Lin, Junyang},\n  journal={arXiv preprint arXiv:2409.12191},\n  year={2024}\n}\n\n@article{Qwen-VL,\n  title={Qwen-VL: A Versatile Vision-Language Model for Understanding, Localization, Text Reading, and Beyond},\n  author={Bai, Jinze and Bai, Shuai and Yang, Shusheng and Wang, Shijie and Tan, Sinan and Wang, Peng and Lin, Junyang and Zhou, Chang and Zhou, Jingren},\n  journal={arXiv preprint arXiv:2308.12966},\n  year={2023}\n}\n```\n\n\u003Cbr>\n","Qwen3-VL是由阿里云Qwen团队开发的多模态大语言模型系列。它具备卓越的文字理解和生成能力、深度视觉感知与推理功能、扩展的上下文长度以及增强的空间和视频动态理解能力，还拥有强大的代理交互能力。该模型支持密集型和MoE架构，适用于从边缘到云端的部署，并提供指令优化版和增强推理版以满足不同场景需求。其核心功能包括视觉代理操作、视觉编码加速、高级空间感知、长文本及视频理解、增强的多模态推理、升级的视觉识别以及扩展的OCR支持。Qwen3-VL适合需要结合图像与文本进行复杂任务处理的应用场景，如自动办公助手、多媒体内容创作工具等。",2,"2026-06-11 03:48:12","high_star"]