shubhrapandit commited on
Commit
4917a12
·
verified ·
1 Parent(s): 4410c58

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +336 -0
README.md ADDED
@@ -0,0 +1,336 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - vllm
4
+ - vision
5
+ - fp8
6
+ license: apache-2.0
7
+ license_link: >-
8
+ https://huggingface.co/datasets/choosealicense/licenses/blob/main/markdown/apache-2.0.md
9
+ language:
10
+ - en
11
+ base_model: Qwen/Qwen2.5-VL-72B-Instruct
12
+ library_name: transformers
13
+ ---
14
+
15
+ # Qwen2.5-VL-72B-Instruct-quantized-FP8-Dynamic
16
+
17
+ ## Model Overview
18
+ - **Model Architecture:** Qwen2.5-VL-72B-Instruct
19
+ - **Input:** Vision-Text
20
+ - **Output:** Text
21
+ - **Model Optimizations:**
22
+ - **Weight quantization:** FP8
23
+ - **Activation quantization:** FP8
24
+ - **Release Date:** 2/24/2025
25
+ - **Version:** 1.0
26
+ - **Model Developers:** Neural Magic
27
+
28
+ Quantized version of [Qwen/Qwen2.5-VL-72B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-72B-Instruct).
29
+
30
+ ### Model Optimizations
31
+
32
+ This model was obtained by quantizing the weights of [Qwen/Qwen2.5-VL-72B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-72B-Instruct) to FP8 data type, ready for inference with vLLM >= 0.5.2.
33
+
34
+ ## Deployment
35
+
36
+ ### Use with vLLM
37
+
38
+ This model can be deployed efficiently using the [vLLM](https://docs.vllm.ai/en/latest/) backend, as shown in the example below.
39
+
40
+ ```python
41
+ from vllm.assets.image import ImageAsset
42
+ from vllm import LLM, SamplingParams
43
+
44
+ # prepare model
45
+ llm = LLM(
46
+ model="neuralmagic/Qwen2.5-VL-72B-Instruct-FP8-Dynamic",
47
+ trust_remote_code=True,
48
+ max_model_len=4096,
49
+ max_num_seqs=2,
50
+ )
51
+
52
+ # prepare inputs
53
+ question = "What is the content of this image?"
54
+ inputs = {
55
+ "prompt": f"<|user|>\n<|image_1|>\n{question}<|end|>\n<|assistant|>\n",
56
+ "multi_modal_data": {
57
+ "image": ImageAsset("cherry_blossom").pil_image.convert("RGB")
58
+ },
59
+ }
60
+
61
+ # generate response
62
+ print("========== SAMPLE GENERATION ==============")
63
+ outputs = llm.generate(inputs, SamplingParams(temperature=0.2, max_tokens=64))
64
+ print(f"PROMPT : {outputs[0].prompt}")
65
+ print(f"RESPONSE: {outputs[0].outputs[0].text}")
66
+ print("==========================================")
67
+ ```
68
+
69
+ vLLM also supports OpenAI-compatible serving. See the [documentation](https://docs.vllm.ai/en/latest/) for more details.
70
+
71
+ ## Creation
72
+
73
+ This model was created with [llm-compressor](https://github.com/vllm-project/llm-compressor) by running the code snippet below as part a multimodal announcement blog.
74
+
75
+ <details>
76
+ <summary>Model Creation Code</summary>
77
+
78
+ ```python
79
+ import requests
80
+ import torch
81
+ from PIL import Image
82
+ from transformers import AutoProcessor
83
+ from llmcompressor.transformers import oneshot
84
+ from llmcompressor.transformers.tracing import (
85
+ TraceableQwen2_5_VLForConditionalGeneration,
86
+ )
87
+ from llmcompressor.modifiers.quantization import QuantizationModifier
88
+
89
+ # Load model.
90
+ model_id = Qwen/Qwen2.5-VL-72B-Instruct
91
+ model = TraceableQwen2_5_VLForConditionalGeneration.from_pretrained(
92
+ model_id, device_map="auto", torch_dtype="auto"
93
+ )
94
+ processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True)
95
+
96
+ # Recipe
97
+ recipe = [
98
+ QuantizationModifier(
99
+ targets="Linear",
100
+ scheme="FP8_DYNAMIC",
101
+ sequential_targets=["MistralDecoderLayer"],
102
+ ignore=["re:.*lm_head", "re:vision_tower.*", "re:multi_modal_projector.*"],
103
+ ),
104
+ ]
105
+
106
+ SAVE_DIR=f"{model_id.split('/')[1]}-FP8-Dynamic"
107
+
108
+ # Perform oneshot
109
+ oneshot(
110
+ model=model,
111
+ recipe=recipe,
112
+ trust_remote_code_model=True,
113
+ output_dir=SAVE_DIR
114
+ )
115
+
116
+
117
+ ```
118
+ </details>
119
+
120
+ ## Evaluation
121
+
122
+ The model was evaluated on OpenLLM Leaderboard [V1](https://huggingface.co/spaces/open-llm-leaderboard-old/open_llm_leaderboard), OpenLLM Leaderboard [V2](https://huggingface.co/spaces/open-llm-leaderboard/open_llm_leaderboard#/) and on [HumanEval](https://github.com/neuralmagic/evalplus), using the following commands:
123
+
124
+ <details>
125
+ <summary>Evaluation Commands</summary>
126
+
127
+ ```
128
+ ```
129
+
130
+ </details>
131
+
132
+ ### Accuracy
133
+
134
+ ## Inference Performance
135
+
136
+
137
+ This model achieves up to xxx speedup in single-stream deployment and up to xxx speedup in multi-stream asynchronous deployment, depending on hardware and use-case scenario.
138
+ The following performance benchmarks were conducted with [vLLM](https://docs.vllm.ai/en/latest/) version 0.7.2, and [GuideLLM](https://github.com/neuralmagic/guidellm).
139
+
140
+ <details>
141
+ <summary>Benchmarking Command</summary>
142
+ ```
143
+ guidellm --model neuralmagic/Qwen2.5-VL-72B-Instruct-FP8-Dynamic --target "http://localhost:8000/v1" --data-type emulated --data prompt_tokens=<prompt_tokens>,generated_tokens=<generated_tokens>,images=<num_images>,width=<image_width>,height=<image_height> --max seconds 120 --backend aiohttp_server
144
+ ```
145
+
146
+ </details>
147
+
148
+
149
+ ### Single-stream performance (measured with vLLM version 0.7.2)
150
+
151
+ <table border="1" class="dataframe">
152
+ <thead>
153
+ <tr>
154
+ <th></th>
155
+ <th></th>
156
+ <th></th>
157
+ <th style="text-align: center;" colspan="2" >Document Visual Question Answering<br>1680W x 2240H<br>64/128</th>
158
+ <th style="text-align: center;" colspan="2" >Visual Reasoning <br>640W x 480H<br>128/128</th>
159
+ <th style="text-align: center;" colspan="2" >Image Captioning<br>480W x 360H<br>0/128</th>
160
+ </tr>
161
+ <tr>
162
+ <th>Hardware</th>
163
+ <th>Model</th>
164
+ <th>Average Cost Reduction</th>
165
+ <th>Latency (s)</th>
166
+ <th>QPD</th>
167
+ <th>Latency (s)th>
168
+ <th>QPD</th>
169
+ <th>Latency (s)</th>
170
+ <th>QPD</th>
171
+ </tr>
172
+ </thead>
173
+ <tbody>
174
+ <tr>
175
+ <td>A100x4</td>
176
+ <td>Qwen/Qwen2.5-VL-72B-Instruct</td>
177
+ <td></td>
178
+ <td>6.4</td>
179
+ <td>78</td>
180
+ <td>4.5</td>
181
+ <td>111</td>
182
+ <td>4.4</td>
183
+ <td>113</td>
184
+ </tr>
185
+ <tr>
186
+ <td>A100x2</td>
187
+ <td>neuralmagic/Qwen2.5-VL-72B-Instruct-quantized.w8a8</td>
188
+ <td>1.85</td>
189
+ <td>7.0</td>
190
+ <td>143</td>
191
+ <td>4.9</td>
192
+ <td>205</td>
193
+ <td>4.8</td>
194
+ <td>211</td>
195
+ </tr>
196
+ <tr>
197
+ <td>A100x1</td>
198
+ <td>neuralmagic/Qwen2.5-VL-72B-Instruct-quantized.w4a16</td>
199
+ <td>3.33</td>
200
+ <td>9.4</td>
201
+ <td>213</td>
202
+ <td>5.1</td>
203
+ <td>396</td>
204
+ <td>4.8</td>
205
+ <td>420</td>
206
+ </tr>
207
+ <tr>
208
+ <td>H100x4</td>
209
+ <td>Qwen/Qwen2.5-VL-72B-Instruct</td>
210
+ <td></td>
211
+ <td>4.3</td>
212
+ <td>68</td>
213
+ <td>3.0</td>
214
+ <td>97</td>
215
+ <td>2.9</td>
216
+ <td>100</td>
217
+ </tr>
218
+ <tr>
219
+ <td>H100x2</td>
220
+ <td>neuralmagic/Qwen2.5-VL-72B-Instruct-FP8-Dynamic</td>
221
+ <td>1.79</td>
222
+ <td>4.6</td>
223
+ <td>122</td>
224
+ <td>3.3</td>
225
+ <td>173</td>
226
+ <td>3.2</td>
227
+ <td>177</td>
228
+ </tr>
229
+ <tr>
230
+ <td>H100x1</td>
231
+ <td>neuralmagic/Qwen2.5-VL-72B-Instruct-quantized.w4a16</td>
232
+ <td>5.66</td>
233
+ <td>4.3</td>
234
+ <td>252</td>
235
+ <td>4.3</td>
236
+ <td>252</td>
237
+ <td>1.0</td>
238
+ <td>1065</td>
239
+ </tr>
240
+ </tbody>
241
+ </table>
242
+
243
+
244
+ ### Multi-stream asynchronous performance (measured with vLLM version 0.7.2)
245
+
246
+ <table border="1" class="dataframe">
247
+ <thead>
248
+ <tr>
249
+ <th></th>
250
+ <th></th>
251
+ <th></th>
252
+ <th style="text-align: center;" colspan="2" >Document Visual Question Answering<br>1680W x 2240H<br>64/128</th>
253
+ <th style="text-align: center;" colspan="2" >Visual Reasoning <br>640W x 480H<br>128/128</th>
254
+ <th style="text-align: center;" colspan="2" >Image Captioning<br>480W x 360H<br>0/128</th>
255
+ </tr>
256
+ <tr>
257
+ <th>Hardware</th>
258
+ <th>Model</th>
259
+ <th>Average Cost Reduction</th>
260
+ <th>Maximum throughput (QPS)</th>
261
+ <th>QPD</th>
262
+ <th>Maximum throughput (QPS)</th>
263
+ <th>QPD</th>
264
+ <th>Maximum throughput (QPS)</th>
265
+ <th>QPD</th>
266
+ </tr>
267
+ </thead>
268
+ <tbody style="text-align: center">
269
+ <tr>
270
+ <td>A100x4</td>
271
+ <td>Qwen/Qwen2.5-VL-72B-Instruct</td>
272
+ <td></td>
273
+ <td>0.4</td>
274
+ <td>180</td>
275
+ <td>1.1</td>
276
+ <td>539</td>
277
+ <td>1.2</td>
278
+ <td>595</td>
279
+ </tr>
280
+ <tr>
281
+ <td>A100x2</td>
282
+ <td>neuralmagic/Qwen2.5-VL-72B-Instruct-quantized.w8a8</td>
283
+ <td>1.80</td>
284
+ <td>0.6</td>
285
+ <td>289</td>
286
+ <td>2.0</td>
287
+ <td>1020</td>
288
+ <td>2.3</td>
289
+ <td>1133</td>
290
+ </tr>
291
+ <tr>
292
+ <td>A100x1</td>
293
+ <td>neuralmagic/Qwen2.5-VL-72B-Instruct-quantized.w4a16</td>
294
+ <td>2.75</td>
295
+ <td>0.7</td>
296
+ <td>341</td>
297
+ <td>3.2</td>
298
+ <td>1588</td>
299
+ <td>4.1</td>
300
+ <td>2037</td>
301
+ </tr>
302
+ <tr>
303
+ <td>H100x4</td>
304
+ <td>Qwen/Qwen2.5-VL-72B-Instruct</td>
305
+ <td></td>
306
+ <td>0.5</td>
307
+ <td>134</td>
308
+ <td>1.2</td>
309
+ <td>357</td>
310
+ <td>1.3</td>
311
+ <td>379</td>
312
+ </tr>
313
+ <tr>
314
+ <td>H100x2</td>
315
+ <td>neuralmagic/Qwen2.5-VL-72B-Instruct-FP8-Dynamic</td>
316
+ <td>1.73</td>
317
+ <td>0.9</td>
318
+ <td>247</td>
319
+ <td>2.2</td>
320
+ <td>621</td>
321
+ <td>2.4</td>
322
+ <td>669</td>
323
+ </tr>
324
+ <tr>
325
+ <td>H100x1</td>
326
+ <td>neuralmagic/Qwen2.5-VL-72B-Instruct-quantized.w4a16</td>
327
+ <td>8.27</td>
328
+ <td>3.3</td>
329
+ <td>913</td>
330
+ <td>3.3</td>
331
+ <td>913</td>
332
+ <td>24.8</td>
333
+ <td>6777</td>
334
+ </tr>
335
+ </tbody>
336
+ </table>