danielhanchen commited on
Commit
1188878
·
verified ·
1 Parent(s): 52d12e7

Add files using upload-large-folder tool

Browse files
.gitattributes CHANGED
@@ -33,3 +33,12 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ mmproj-F16.gguf filter=lfs diff=lfs merge=lfs -text
37
+ mmproj-F32.gguf filter=lfs diff=lfs merge=lfs -text
38
+ Qwen2.5-VL-32B-Instruct-UD-IQ1_S.gguf filter=lfs diff=lfs merge=lfs -text
39
+ Qwen2.5-VL-32B-Instruct-UD-IQ1_M.gguf filter=lfs diff=lfs merge=lfs -text
40
+ Qwen2.5-VL-32B-Instruct-UD-IQ2_M.gguf filter=lfs diff=lfs merge=lfs -text
41
+ Qwen2.5-VL-32B-Instruct-UD-Q2_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
42
+ Qwen2.5-VL-32B-Instruct-UD-IQ3_XXS.gguf filter=lfs diff=lfs merge=lfs -text
43
+ Qwen2.5-VL-32B-Instruct-UD-Q3_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
44
+ Qwen2.5-VL-32B-Instruct-UD-Q4_K_XL.gguf filter=lfs diff=lfs merge=lfs -text
Qwen2.5-VL-32B-Instruct-UD-IQ1_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6208fa6ff6726dacf400f6a81db3fda2b0032489a74bbef1882420e9eef6bc26
3
+ size 8293365280
Qwen2.5-VL-32B-Instruct-UD-IQ1_S.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e3eea25a8d1de70bb279aad14da34e53db5b44ba68ef0bd13575b17928d61c2
3
+ size 7685109280
Qwen2.5-VL-32B-Instruct-UD-IQ2_M.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:326043481b3daa473e55aa6f6ffbc9c9229f4d3902c73a028c904cb98e5a2b5b
3
+ size 11461744160
Qwen2.5-VL-32B-Instruct-UD-IQ3_XXS.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a8be27b084b7195d986bce7e730cf0a3f42f5f7b442c067a1cd19bfe9e8b4254
3
+ size 12993238560
Qwen2.5-VL-32B-Instruct-UD-Q2_K_XL.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e7d3a1e0d6a7cc33a02032cc5d9faf977b551bfd5f3412ea7485108075fe5e7
3
+ size 12785448480
Qwen2.5-VL-32B-Instruct-UD-Q3_K_XL.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9e9871577e7c0d37de62b93f431c6963870c97c3783bb49f0f2a33cf7cd37260
3
+ size 16399676960
Qwen2.5-VL-32B-Instruct-UD-Q4_K_XL.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:20d898dd22b712a96bde798bfa8306434d1d4928402a2effc4968b924f8e035c
3
+ size 20224890400
README.md ADDED
@@ -0,0 +1,512 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ base_model:
3
+ - Qwen/Qwen2.5-VL-32B-Instruct
4
+ license: apache-2.0
5
+ language:
6
+ - en
7
+ pipeline_tag: image-text-to-text
8
+ tags:
9
+ - multimodal
10
+ - unsloth
11
+ library_name: transformers
12
+ ---
13
+
14
+ # Qwen2.5-VL-32B-Instruct
15
+ <a href="https://chat.qwenlm.ai/" target="_blank" style="margin: 2px;">
16
+ <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;"/>
17
+ </a>
18
+
19
+
20
+ ## Latest Updates:
21
+ In addition to the original formula, we have further enhanced Qwen2.5-VL-32B's mathematical and problem-solving abilities through reinforcement learning. This has also significantly improved the model's subjective user experience, with response styles adjusted to better align with human preferences. Particularly for objective queries such as mathematics, logical reasoning, and knowledge-based Q&A, the level of detail in responses and the clarity of formatting have been noticeably enhanced.
22
+
23
+ ## Introduction
24
+
25
+ In the past five months since Qwen2-VL’s release, numerous developers have built new models on the Qwen2-VL vision-language models, providing us with valuable feedback. During this period, we focused on building more useful vision-language models. Today, we are excited to introduce the latest addition to the Qwen family: Qwen2.5-VL.
26
+
27
+ #### Key Enhancements:
28
+ * **Understand things visually**: Qwen2.5-VL is not only proficient in recognizing common objects such as flowers, birds, fish, and insects, but it is highly capable of analyzing texts, charts, icons, graphics, and layouts within images.
29
+
30
+ * **Being agentic**: Qwen2.5-VL directly plays as a visual agent that can reason and dynamically direct tools, which is capable of computer use and phone use.
31
+
32
+ * **Understanding long videos and capturing events**: Qwen2.5-VL can comprehend videos of over 1 hour, and this time it has a new ability of cpaturing event by pinpointing the relevant video segments.
33
+
34
+ * **Capable of visual localization in different formats**: Qwen2.5-VL can accurately localize objects in an image by generating bounding boxes or points, and it can provide stable JSON outputs for coordinates and attributes.
35
+
36
+ * **Generating structured outputs**: for data like scans of invoices, forms, tables, etc. Qwen2.5-VL supports structured outputs of their contents, benefiting usages in finance, commerce, etc.
37
+
38
+
39
+ #### Model Architecture Updates:
40
+
41
+ * **Dynamic Resolution and Frame Rate Training for Video Understanding**:
42
+
43
+ We extend dynamic resolution to the temporal dimension by adopting dynamic FPS sampling, enabling the model to comprehend videos at various sampling rates. Accordingly, we update mRoPE in the time dimension with IDs and absolute time alignment, enabling the model to learn temporal sequence and speed, and ultimately acquire the ability to pinpoint specific moments.
44
+
45
+ <p align="center">
46
+ <img src="https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2.5-VL/qwen2.5vl_arc.jpeg" width="80%"/>
47
+ <p>
48
+
49
+
50
+ * **Streamlined and Efficient Vision Encoder**
51
+
52
+ We enhance both training and inference speeds by strategically implementing window attention into the ViT. The ViT architecture is further optimized with SwiGLU and RMSNorm, aligning it with the structure of the Qwen2.5 LLM.
53
+
54
+
55
+ We have four models with 3, 7, 32 and 72 billion parameters. This repo contains the instruction-tuned 32B Qwen2.5-VL model. For more information, visit our [Blog](https://qwenlm.github.io/blog/qwen2.5-vl/) and [GitHub](https://github.com/QwenLM/Qwen2.5-VL).
56
+
57
+
58
+
59
+ ## Evaluation
60
+
61
+ ### Vision
62
+
63
+ | Dataset | Qwen2.5-VL-72B<br><sup>([🤗](https://huggingface.co/Qwen/Qwen2.5-VL-72B-Instruct)[🤖](https://modelscope.cn/models/qwen/Qwen2.5-VL-72B-Instruct)) | Qwen2-VL-72B<br><sup>([🤗](https://huggingface.co/Qwen/Qwen2-VL-72B-Instruct)[🤖](https://modelscope.cn/models/qwen/Qwen2-VL-72B-Instruct)) | Qwen2.5-VL-32B<br><sup>([🤗](https://huggingface.co/Qwen/Qwen2.5-VL-32B-Instruct)[🤖](https://modelscope.cn/models/qwen/Qwen2.5-VL-32B-Instruct)) |
64
+ |--------------------|--------|--------------|------------------|
65
+ | MMMU |**70.2** | 64.5 | 70 |
66
+ | MMMU Pro |**51.1** | 46.2 | 49.5 |
67
+ | MMStar | **70.8** | 68.3 | 69.5 |
68
+ | MathVista | **74.8** | 70.5 | 74.7 |
69
+ | MathVision |38.1 | 25.9 | **40.0**|
70
+ | OCRBenchV2 | **61.5/63.7** | 47.8/46.1 | 57.2/59.1 |
71
+ | CC-OCR | **79.8** | 68.7 | 77.1 |
72
+ | DocVQA | **96.4** | **96.5** | 94.8 |
73
+ | InfoVQA | **87.3** | 84.5 | 83.4 |
74
+ | LVBench |47.3 | - | **49.00** |
75
+ | CharadesSTA |50.9 | - | **54.2** |
76
+ | VideoMME |**73.3/79.1** | 71.2/77.8 | 70.5/77.9 |
77
+ | MMBench-Video |**2.02** | 1.7 | 1.93 |
78
+ | AITZ |**83.2** | - | 83.1 |
79
+ | Android Control |**67.4/93.7** | 66.4/84.4 | 69.6/93.3 |
80
+ | ScreenSpot |**87.1** | - | 88.5 |
81
+ | ScreenSpot Pro |**43.6** | - | 39.4 |
82
+ | AndroidWorld |**35** | - | 22.0 |
83
+ | OSWorld |**8.83** | - | 5.92 |
84
+
85
+ ### Text
86
+
87
+ | MODEL | MMLU | MMLU-PRO | MATH | GPQA-diamond | MBPP | Human Eval |
88
+ |-----------------|--------|----------|---------|--------------|--------|------------|
89
+ | Qwen2.5-VL-32B | 78.4 | 68.8 | 82.2 | 46.0 | 84.0 | 91.5 |
90
+ | Mistral-Small-3.1-24B | 80.6 | 66.8 | 69.3 | 46.0 | 74.7 | 88.4 |
91
+ | Gemma3-27B-IT | 76.9 | 67.5 | 89 | 42.4 | 74.4 | 87.8 |
92
+ | GPT-4o-Mini | 82.0 | 61.7 | 70.2 | 39.4 | 84.8 | 87.2 |
93
+ | Claude-3.5-Haiku | 77.6 | 65.0 | 69.2 | 41.6 | 85.6 | 88.1 |
94
+
95
+ ## Requirements
96
+ The code of Qwen2.5-VL has been in the latest Hugging face transformers and we advise you to build from source with command:
97
+ ```
98
+
99
+ pip install git+https://github.com/huggingface/transformers accelerate
100
+
101
+ ```
102
+ or you might encounter the following error:
103
+ ```
104
+
105
+ KeyError: 'qwen2_5_vl'
106
+
107
+ ```
108
+ ## Quickstart
109
+
110
+ Below, we provide simple examples to show how to use Qwen2.5-VL with 🤖 ModelScope and 🤗 Transformers.
111
+
112
+ The code of Qwen2.5-VL has been in the latest Hugging face transformers and we advise you to build from source with command:
113
+ ```
114
+
115
+ pip install git+https://github.com/huggingface/transformers accelerate
116
+
117
+ ```
118
+ or you might encounter the following error:
119
+ ```
120
+
121
+ KeyError: 'qwen2_5_vl'
122
+
123
+ ```
124
+ We offer a toolkit to help you handle various types of visual input more conveniently, as if you were using an API. This includes base64, URLs, and interleaved images and videos. You can install it using the following command:
125
+
126
+ ```bash
127
+ # It's highly recommanded to use `[decord]` feature for faster video loading.
128
+ pip install qwen-vl-utils[decord]==0.0.8
129
+ ```
130
+
131
+ 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://github.com/dmlc/decord?tab=readme-ov-file#install-from-source) to get decord used when loading video.
132
+
133
+ ### Using 🤗 Transformers to Chat
134
+
135
+ Here we show a code snippet to show you how to use the chat model with `transformers` and `qwen_vl_utils`:
136
+
137
+ ```python
138
+ from transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
139
+ from qwen_vl_utils import process_vision_info
140
+
141
+ # default: Load the model on the available device(s)
142
+ model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
143
+ "Qwen/Qwen2.5-VL-32B-Instruct", torch_dtype="auto", device_map="auto"
144
+ )
145
+
146
+ # We recommend enabling flash_attention_2 for better acceleration and memory saving, especially in multi-image and video scenarios.
147
+ # model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
148
+ # "Qwen/Qwen2.5-VL-32B-Instruct",
149
+ # torch_dtype=torch.bfloat16,
150
+ # attn_implementation="flash_attention_2",
151
+ # device_map="auto",
152
+ # )
153
+
154
+ # default processer
155
+ processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-32B-Instruct")
156
+
157
+ # The default range for the number of visual tokens per image in the model is 4-16384.
158
+ # You can set min_pixels and max_pixels according to your needs, such as a token range of 256-1280, to balance performance and cost.
159
+ # min_pixels = 256*28*28
160
+ # max_pixels = 1280*28*28
161
+ # processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-32B-Instruct", min_pixels=min_pixels, max_pixels=max_pixels)
162
+
163
+ messages = [
164
+ {
165
+ "role": "user",
166
+ "content": [
167
+ {
168
+ "type": "image",
169
+ "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
170
+ },
171
+ {"type": "text", "text": "Describe this image."},
172
+ ],
173
+ }
174
+ ]
175
+
176
+ # Preparation for inference
177
+ text = processor.apply_chat_template(
178
+ messages, tokenize=False, add_generation_prompt=True
179
+ )
180
+ image_inputs, video_inputs = process_vision_info(messages)
181
+ inputs = processor(
182
+ text=[text],
183
+ images=image_inputs,
184
+ videos=video_inputs,
185
+ padding=True,
186
+ return_tensors="pt",
187
+ )
188
+ inputs = inputs.to("cuda")
189
+
190
+ # Inference: Generation of the output
191
+ generated_ids = model.generate(**inputs, max_new_tokens=128)
192
+ generated_ids_trimmed = [
193
+ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
194
+ ]
195
+ output_text = processor.batch_decode(
196
+ generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
197
+ )
198
+ print(output_text)
199
+ ```
200
+
201
+ <details>
202
+ <summary>Multi image inference</summary>
203
+
204
+ ```python
205
+ # Messages containing multiple images and a text query
206
+ messages = [
207
+ {
208
+ "role": "user",
209
+ "content": [
210
+ {"type": "image", "image": "file:///path/to/image1.jpg"},
211
+ {"type": "image", "image": "file:///path/to/image2.jpg"},
212
+ {"type": "text", "text": "Identify the similarities between these images."},
213
+ ],
214
+ }
215
+ ]
216
+
217
+ # Preparation for inference
218
+ text = processor.apply_chat_template(
219
+ messages, tokenize=False, add_generation_prompt=True
220
+ )
221
+ image_inputs, video_inputs = process_vision_info(messages)
222
+ inputs = processor(
223
+ text=[text],
224
+ images=image_inputs,
225
+ videos=video_inputs,
226
+ padding=True,
227
+ return_tensors="pt",
228
+ )
229
+ inputs = inputs.to("cuda")
230
+
231
+ # Inference
232
+ generated_ids = model.generate(**inputs, max_new_tokens=128)
233
+ generated_ids_trimmed = [
234
+ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
235
+ ]
236
+ output_text = processor.batch_decode(
237
+ generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
238
+ )
239
+ print(output_text)
240
+ ```
241
+
242
+ </details>
243
+
244
+ <details>
245
+ <summary>Video inference</summary>
246
+
247
+ ```python
248
+ # Messages containing a images list as a video and a text query
249
+ messages = [
250
+ {
251
+ "role": "user",
252
+ "content": [
253
+ {
254
+ "type": "video",
255
+ "video": [
256
+ "file:///path/to/frame1.jpg",
257
+ "file:///path/to/frame2.jpg",
258
+ "file:///path/to/frame3.jpg",
259
+ "file:///path/to/frame4.jpg",
260
+ ],
261
+ },
262
+ {"type": "text", "text": "Describe this video."},
263
+ ],
264
+ }
265
+ ]
266
+
267
+ # Messages containing a local video path and a text query
268
+ messages = [
269
+ {
270
+ "role": "user",
271
+ "content": [
272
+ {
273
+ "type": "video",
274
+ "video": "file:///path/to/video1.mp4",
275
+ "max_pixels": 360 * 420,
276
+ "fps": 1.0,
277
+ },
278
+ {"type": "text", "text": "Describe this video."},
279
+ ],
280
+ }
281
+ ]
282
+
283
+ # Messages containing a video url and a text query
284
+ messages = [
285
+ {
286
+ "role": "user",
287
+ "content": [
288
+ {
289
+ "type": "video",
290
+ "video": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen2-VL/space_woaudio.mp4",
291
+ },
292
+ {"type": "text", "text": "Describe this video."},
293
+ ],
294
+ }
295
+ ]
296
+
297
+ #In Qwen 2.5 VL, frame rate information is also input into the model to align with absolute time.
298
+ # Preparation for inference
299
+ text = processor.apply_chat_template(
300
+ messages, tokenize=False, add_generation_prompt=True
301
+ )
302
+ image_inputs, video_inputs, video_kwargs = process_vision_info(messages, return_video_kwargs=True)
303
+ inputs = processor(
304
+ text=[text],
305
+ images=image_inputs,
306
+ videos=video_inputs,
307
+ fps=fps,
308
+ padding=True,
309
+ return_tensors="pt",
310
+ **video_kwargs,
311
+ )
312
+ inputs = inputs.to("cuda")
313
+
314
+ # Inference
315
+ generated_ids = model.generate(**inputs, max_new_tokens=128)
316
+ generated_ids_trimmed = [
317
+ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
318
+ ]
319
+ output_text = processor.batch_decode(
320
+ generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
321
+ )
322
+ print(output_text)
323
+ ```
324
+
325
+ Video URL compatibility largely depends on the third-party library version. The details are in the table below. change the backend by `FORCE_QWENVL_VIDEO_READER=torchvision` or `FORCE_QWENVL_VIDEO_READER=decord` if you prefer not to use the default one.
326
+
327
+ | Backend | HTTP | HTTPS |
328
+ |-------------|------|-------|
329
+ | torchvision >= 0.19.0 | ✅ | ✅ |
330
+ | torchvision < 0.19.0 | ❌ | ❌ |
331
+ | decord | ✅ | ❌ |
332
+
333
+ </details>
334
+
335
+ <details>
336
+ <summary>Batch inference</summary>
337
+
338
+ ```python
339
+ # Sample messages for batch inference
340
+ messages1 = [
341
+ {
342
+ "role": "user",
343
+ "content": [
344
+ {"type": "image", "image": "file:///path/to/image1.jpg"},
345
+ {"type": "image", "image": "file:///path/to/image2.jpg"},
346
+ {"type": "text", "text": "What are the common elements in these pictures?"},
347
+ ],
348
+ }
349
+ ]
350
+ messages2 = [
351
+ {"role": "system", "content": "You are a helpful assistant."},
352
+ {"role": "user", "content": "Who are you?"},
353
+ ]
354
+ # Combine messages for batch processing
355
+ messages = [messages1, messages2]
356
+
357
+ # Preparation for batch inference
358
+ texts = [
359
+ processor.apply_chat_template(msg, tokenize=False, add_generation_prompt=True)
360
+ for msg in messages
361
+ ]
362
+ image_inputs, video_inputs = process_vision_info(messages)
363
+ inputs = processor(
364
+ text=texts,
365
+ images=image_inputs,
366
+ videos=video_inputs,
367
+ padding=True,
368
+ return_tensors="pt",
369
+ )
370
+ inputs = inputs.to("cuda")
371
+
372
+ # Batch Inference
373
+ generated_ids = model.generate(**inputs, max_new_tokens=128)
374
+ generated_ids_trimmed = [
375
+ out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
376
+ ]
377
+ output_texts = processor.batch_decode(
378
+ generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
379
+ )
380
+ print(output_texts)
381
+ ```
382
+
383
+ </details>
384
+
385
+ ### 🤖 ModelScope
386
+
387
+ We strongly advise users especially those in mainland China to use ModelScope. `snapshot_download` can help you solve issues concerning downloading checkpoints.
388
+
389
+ ### More Usage Tips
390
+
391
+ For input images, we support local files, base64, and URLs. For videos, we currently only support local files.
392
+
393
+ ```python
394
+ # You can directly insert a local file path, a URL, or a base64-encoded image into the position where you want in the text.
395
+ ## Local file path
396
+ messages = [
397
+ {
398
+ "role": "user",
399
+ "content": [
400
+ {"type": "image", "image": "file:///path/to/your/image.jpg"},
401
+ {"type": "text", "text": "Describe this image."},
402
+ ],
403
+ }
404
+ ]
405
+ ## Image URL
406
+ messages = [
407
+ {
408
+ "role": "user",
409
+ "content": [
410
+ {"type": "image", "image": "http://path/to/your/image.jpg"},
411
+ {"type": "text", "text": "Describe this image."},
412
+ ],
413
+ }
414
+ ]
415
+ ## Base64 encoded image
416
+ messages = [
417
+ {
418
+ "role": "user",
419
+ "content": [
420
+ {"type": "image", "image": "data:image;base64,/9j/..."},
421
+ {"type": "text", "text": "Describe this image."},
422
+ ],
423
+ }
424
+ ]
425
+ ```
426
+
427
+ #### Image Resolution for performance boost
428
+
429
+ The model supports a wide range of resolution inputs. By default, it uses the native resolution for input, but higher resolutions can enhance performance at the cost of more computation. Users can set the minimum and maximum number of pixels to achieve an optimal configuration for their needs, such as a token count range of 256-1280, to balance speed and memory usage.
430
+
431
+ ```python
432
+ min_pixels = 256 * 28 * 28
433
+ max_pixels = 1280 * 28 * 28
434
+ processor = AutoProcessor.from_pretrained(
435
+ "Qwen/Qwen2.5-VL-32B-Instruct", min_pixels=min_pixels, max_pixels=max_pixels
436
+ )
437
+ ```
438
+
439
+ Besides, We provide two methods for fine-grained control over the image size input to the model:
440
+
441
+ 1. Define min_pixels and max_pixels: Images will be resized to maintain their aspect ratio within the range of min_pixels and max_pixels.
442
+ 2. Specify exact dimensions: Directly set `resized_height` and `resized_width`. These values will be rounded to the nearest multiple of 28.
443
+
444
+ ```python
445
+ # min_pixels and max_pixels
446
+ messages = [
447
+ {
448
+ "role": "user",
449
+ "content": [
450
+ {
451
+ "type": "image",
452
+ "image": "file:///path/to/your/image.jpg",
453
+ "resized_height": 280,
454
+ "resized_width": 420,
455
+ },
456
+ {"type": "text", "text": "Describe this image."},
457
+ ],
458
+ }
459
+ ]
460
+ # resized_height and resized_width
461
+ messages = [
462
+ {
463
+ "role": "user",
464
+ "content": [
465
+ {
466
+ "type": "image",
467
+ "image": "file:///path/to/your/image.jpg",
468
+ "min_pixels": 50176,
469
+ "max_pixels": 50176,
470
+ },
471
+ {"type": "text", "text": "Describe this image."},
472
+ ],
473
+ }
474
+ ]
475
+ ```
476
+
477
+ ### Processing Long Texts
478
+
479
+ The current `config.json` is set for context length up to 32,768 tokens.
480
+ To handle extensive inputs exceeding 32,768 tokens, we utilize [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
481
+
482
+ For supported frameworks, you could add the following to `config.json` to enable YaRN:
483
+
484
+ {
485
+ ...,
486
+ "type": "yarn",
487
+ "mrope_section": [
488
+ 16,
489
+ 24,
490
+ 24
491
+ ],
492
+ "factor": 4,
493
+ "original_max_position_embeddings": 32768
494
+ }
495
+
496
+ However, it should be noted that this method has a significant impact on the performance of temporal and spatial localization tasks, and is therefore not recommended for use.
497
+
498
+ At the same time, for long video inputs, since MRoPE itself is more economical with ids, the max_position_embeddings can be directly modified to a larger value, such as 64k.
499
+
500
+ ## Citation
501
+
502
+ If you find our work helpful, feel free to give us a cite.
503
+
504
+ ```
505
+ @article{Qwen2.5-VL,
506
+ title={Qwen2.5-VL Technical Report},
507
+ 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},
508
+ journal={arXiv preprint arXiv:2502.13923},
509
+ year={2025}
510
+ }
511
+ ```
512
+
config.json ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "Qwen2_5_VLForConditionalGeneration"
4
+ ],
5
+ "attention_dropout": 0.0,
6
+ "eos_token_id": 151645,
7
+ "hidden_act": "silu",
8
+ "hidden_size": 5120,
9
+ "image_token_id": 151655,
10
+ "initializer_range": 0.02,
11
+ "intermediate_size": 27648,
12
+ "max_position_embeddings": 128000,
13
+ "max_window_layers": 64,
14
+ "model_type": "qwen2_5_vl",
15
+ "num_attention_heads": 40,
16
+ "num_hidden_layers": 64,
17
+ "num_key_value_heads": 8,
18
+ "pad_token_id": 151654,
19
+ "rms_norm_eps": 1e-06,
20
+ "rope_scaling": {
21
+ "mrope_section": [
22
+ 16,
23
+ 24,
24
+ 24
25
+ ],
26
+ "rope_type": "default",
27
+ "type": "default"
28
+ },
29
+ "rope_theta": 1000000.0,
30
+ "sliding_window": 32768,
31
+ "text_config": {
32
+ "architectures": [
33
+ "Qwen2_5_VLForConditionalGeneration"
34
+ ],
35
+ "attention_dropout": 0.0,
36
+ "eos_token_id": 151645,
37
+ "hidden_act": "silu",
38
+ "hidden_size": 5120,
39
+ "image_token_id": null,
40
+ "initializer_range": 0.02,
41
+ "intermediate_size": 27648,
42
+ "max_position_embeddings": 128000,
43
+ "max_window_layers": 64,
44
+ "model_type": "qwen2_5_vl_text",
45
+ "num_attention_heads": 40,
46
+ "num_hidden_layers": 64,
47
+ "num_key_value_heads": 8,
48
+ "pad_token_id": 151643,
49
+ "rms_norm_eps": 1e-06,
50
+ "rope_scaling": {
51
+ "mrope_section": [
52
+ 16,
53
+ 24,
54
+ 24
55
+ ],
56
+ "rope_type": "default",
57
+ "type": "default"
58
+ },
59
+ "rope_theta": 1000000.0,
60
+ "sliding_window": 32768,
61
+ "torch_dtype": "bfloat16",
62
+ "use_cache": true,
63
+ "use_sliding_window": false,
64
+ "video_token_id": null,
65
+ "vision_end_token_id": 151653,
66
+ "vision_start_token_id": 151652,
67
+ "vision_token_id": 151654,
68
+ "vocab_size": 152064
69
+ },
70
+ "tie_word_embeddings": false,
71
+ "torch_dtype": "bfloat16",
72
+ "transformers_version": "4.52.0.dev0",
73
+ "unsloth_fixed": true,
74
+ "use_cache": true,
75
+ "use_sliding_window": false,
76
+ "video_token_id": 151656,
77
+ "vision_config": {
78
+ "depth": 32,
79
+ "fullatt_block_indexes": [
80
+ 7,
81
+ 15,
82
+ 23,
83
+ 31
84
+ ],
85
+ "hidden_act": "silu",
86
+ "hidden_size": 1280,
87
+ "in_channels": 3,
88
+ "in_chans": 3,
89
+ "initializer_range": 0.02,
90
+ "intermediate_size": 3456,
91
+ "model_type": "qwen2_5_vl",
92
+ "num_heads": 16,
93
+ "out_hidden_size": 5120,
94
+ "patch_size": 14,
95
+ "spatial_merge_size": 2,
96
+ "spatial_patch_size": 14,
97
+ "temporal_patch_size": 2,
98
+ "tokens_per_second": 2,
99
+ "torch_dtype": "bfloat16",
100
+ "window_size": 112
101
+ },
102
+ "vision_end_token_id": 151653,
103
+ "vision_start_token_id": 151652,
104
+ "vision_token_id": 151654,
105
+ "vocab_size": 152064
106
+ }
mmproj-F16.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:10ced68bb400658377ae2625991762fbe936da22483995e33bd9cea827e20c31
3
+ size 1378753824
mmproj-F32.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:58cf4d0df343abdb0c1683f76c0eb46519abff3d27d8b8bcba4ea355a62d20ef
3
+ size 2752388384