Image-Text-to-Text
Transformers
yairzar commited on
Commit
5b5b7cf
·
verified ·
1 Parent(s): 1698252

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +194 -3
README.md CHANGED
@@ -1,3 +1,194 @@
1
- ---
2
- license: apache-2.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ pipeline_tag: image-text-to-text
4
+ library_name: transformers
5
+ base_model:
6
+ - Qwen/Qwen3-VL-32B-Instruct
7
+ ---
8
+ <a href="https://chat.qwenlm.ai/" target="_blank" style="margin: 2px;">
9
+ <img alt="Chat" src="https://img.shields.io/badge/%F0%9F%92%9C%EF%B8%8F%20Qwen%20Chat%20-536af5" style="display: inline-block; vertical-align: middle;"/>
10
+ </a>
11
+
12
+
13
+ # Qwen3-VL-32B-Instruct
14
+
15
+
16
+ Meet Qwen3-VL — the most powerful vision-language model in the Qwen series to date.
17
+
18
+ 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.
19
+
20
+ Available in Dense and MoE architectures that scale from edge to cloud, with Instruct and reasoning‑enhanced Thinking editions for flexible, on‑demand deployment.
21
+
22
+
23
+ #### Key Enhancements:
24
+
25
+ * **Visual Agent**: Operates PC/mobile GUIs—recognizes elements, understands functions, invokes tools, completes tasks.
26
+
27
+ * **Visual Coding Boost**: Generates Draw.io/HTML/CSS/JS from images/videos.
28
+
29
+ * **Advanced Spatial Perception**: Judges object positions, viewpoints, and occlusions; provides stronger 2D grounding and enables 3D grounding for spatial reasoning and embodied AI.
30
+
31
+ * **Long Context & Video Understanding**: Native 256K context, expandable to 1M; handles books and hours-long video with full recall and second-level indexing.
32
+
33
+ * **Enhanced Multimodal Reasoning**: Excels in STEM/Math—causal analysis and logical, evidence-based answers.
34
+
35
+ * **Upgraded Visual Recognition**: Broader, higher-quality pretraining is able to “recognize everything”—celebrities, anime, products, landmarks, flora/fauna, etc.
36
+
37
+ * **Expanded OCR**: Supports 32 languages (up from 19); robust in low light, blur, and tilt; better with rare/ancient characters and jargon; improved long-document structure parsing.
38
+
39
+ * **Text Understanding on par with pure LLMs**: Seamless text–vision fusion for lossless, unified comprehension.
40
+
41
+
42
+ #### Model Architecture Updates:
43
+
44
+ <p align="center">
45
+ <img src="https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3-VL/qwen3vl_arc.jpg" width="80%"/>
46
+ <p>
47
+
48
+
49
+ 1. **Interleaved-MRoPE**: Full‑frequency allocation over time, width, and height via robust positional embeddings, enhancing long‑horizon video reasoning.
50
+
51
+ 2. **DeepStack**: Fuses multi‑level ViT features to capture fine‑grained details and sharpen image–text alignment.
52
+
53
+ 3. **Text–Timestamp Alignment:** Moves beyond T‑RoPE to precise, timestamp‑grounded event localization for stronger video temporal modeling.
54
+
55
+ This is the weight repository for Qwen3-VL-32B-Instruct.
56
+
57
+
58
+ ---
59
+
60
+ ## Model Performance
61
+
62
+ **Multimodal performance**
63
+
64
+ ![](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3-VL/qwen3vl_2b_32b_vl_instruct.jpg)
65
+
66
+ **Pure text performance**
67
+ ![](https://qianwen-res.oss-accelerate.aliyuncs.com/Qwen3-VL/qwen3vl_2b_32b_text_instruct.jpg)
68
+
69
+ ## Quickstart
70
+
71
+ Below, we provide simple examples to show how to use Qwen3-VL with 🤖 ModelScope and 🤗 Transformers.
72
+
73
+ The code of Qwen3-VL has been in the latest Hugging Face transformers and we advise you to build from source with command:
74
+ ```
75
+ pip install git+https://github.com/huggingface/transformers
76
+ # pip install transformers==4.57.0 # currently, V4.57.0 is not released
77
+ ```
78
+
79
+ ### Using 🤗 Transformers to Chat
80
+
81
+ Here we show a code snippet to show how to use the chat model with `transformers`:
82
+
83
+ ```python
84
+ from transformers import Qwen3VLForConditionalGeneration, AutoProcessor
85
+
86
+ # default: Load the model on the available device(s)
87
+ model = Qwen3VLForConditionalGeneration.from_pretrained(
88
+ "Qwen/Qwen3-VL-32B-Instruct", dtype="auto", device_map="auto"
89
+ )
90
+
91
+ # We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
92
+ # model = Qwen3VLForConditionalGeneration.from_pretrained(
93
+ # "Qwen/Qwen3-VL-32B-Instruct",
94
+ # dtype=torch.bfloat16,
95
+ # attn_implementation="flash_attention_2",
96
+ # device_map="auto",
97
+ # )
98
+
99
+ processor = AutoProcessor.from_pretrained("Qwen/Qwen3-VL-32B-Instruct")
100
+
101
+ messages = [
102
+ {
103
+ "role": "user",
104
+ "content": [
105
+ {
106
+ "type": "image",
107
+ "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
108
+ },
109
+ {"type": "text", "text": "Describe this image."},
110
+ ],
111
+ }
112
+ ]
113
+
114
+ # Preparation for inference
115
+ inputs = processor.apply_chat_template(
116
+ messages,
117
+ tokenize=True,
118
+ add_generation_prompt=True,
119
+ return_dict=True,
120
+ return_tensors="pt"
121
+ )
122
+ inputs = inputs.to(model.device)
123
+
124
+ # Inference: Generation of the output
125
+ generated_ids = model.generate(**inputs, max_new_tokens=128)
126
+ generated_ids_trimmed = [
127
+ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
128
+ ]
129
+ output_text = processor.batch_decode(
130
+ generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
131
+ )
132
+ print(output_text)
133
+ ```
134
+
135
+ ### Generation Hyperparameters
136
+ #### VL
137
+ ```bash
138
+ export greedy='false'
139
+ export top_p=0.8
140
+ export top_k=20
141
+ export temperature=0.7
142
+ export repetition_penalty=1.0
143
+ export presence_penalty=1.5
144
+ export out_seq_length=16384
145
+ ```
146
+
147
+ #### Text
148
+ ```bash
149
+ export greedy='false'
150
+ export top_p=1.0
151
+ export top_k=40
152
+ export repetition_penalty=1.0
153
+ export presence_penalty=2.0
154
+ export temperature=1.0
155
+ export out_seq_length=32768
156
+ ```
157
+
158
+
159
+ ## Citation
160
+
161
+ If you find our work helpful, feel free to give us a cite.
162
+
163
+ ```
164
+ @misc{qwen3technicalreport,
165
+ title={Qwen3 Technical Report},
166
+ author={Qwen Team},
167
+ year={2025},
168
+ eprint={2505.09388},
169
+ archivePrefix={arXiv},
170
+ primaryClass={cs.CL},
171
+ url={https://arxiv.org/abs/2505.09388},
172
+ }
173
+
174
+ @article{Qwen2.5-VL,
175
+ title={Qwen2.5-VL Technical Report},
176
+ 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},
177
+ journal={arXiv preprint arXiv:2502.13923},
178
+ year={2025}
179
+ }
180
+
181
+ @article{Qwen2VL,
182
+ title={Qwen2-VL: Enhancing Vision-Language Model's Perception of the World at Any Resolution},
183
+ 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},
184
+ journal={arXiv preprint arXiv:2409.12191},
185
+ year={2024}
186
+ }
187
+
188
+ @article{Qwen-VL,
189
+ title={Qwen-VL: A Versatile Vision-Language Model for Understanding, Localization, Text Reading, and Beyond},
190
+ 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},
191
+ journal={arXiv preprint arXiv:2308.12966},
192
+ year={2023}
193
+ }
194
+ ```