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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-7B-Instruct
|
| 12 |
+
library_name: transformers
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# pixtral-12b-FP8-Dynamic
|
| 16 |
+
|
| 17 |
+
## Model Overview
|
| 18 |
+
- **Model Architecture:** Qwen2.5-VL-7B-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-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct).
|
| 29 |
+
|
| 30 |
+
### Model Optimizations
|
| 31 |
+
|
| 32 |
+
This model was obtained by quantizing the weights of [Qwen/Qwen2.5-VL-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-VL-7B-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-7B-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-7B-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-7B-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 style="text-align: center">
|
| 174 |
+
<tr>
|
| 175 |
+
<th rowspan="3" valign="top">A100x1</th>
|
| 176 |
+
<th>Qwen/Qwen2.5-VL-7B-Instruct</th>
|
| 177 |
+
<td></td>
|
| 178 |
+
<td>2.8</td>
|
| 179 |
+
<td>707</td>
|
| 180 |
+
<td>1.7</td>
|
| 181 |
+
<td>1162</td>
|
| 182 |
+
<td>1.7</td>
|
| 183 |
+
<td>1198</td>
|
| 184 |
+
</tr>
|
| 185 |
+
<tr>
|
| 186 |
+
<th>neuralmagic/Qwen2.5-VL-7B-Instruct-quantized.w8a8</th>
|
| 187 |
+
<td>1.24</td>
|
| 188 |
+
<td>2.4</td>
|
| 189 |
+
<td>851</td>
|
| 190 |
+
<td>1.4</td>
|
| 191 |
+
<td>1454</td>
|
| 192 |
+
<td>1.3</td>
|
| 193 |
+
<td>1512</td>
|
| 194 |
+
</tr>
|
| 195 |
+
<tr>
|
| 196 |
+
<th>neuralmagic/Qwen2.5-VL-7B-Instruct-quantized.w4a16</th>
|
| 197 |
+
<td>1.49</td>
|
| 198 |
+
<td>2.2</td>
|
| 199 |
+
<td>912</td>
|
| 200 |
+
<td>1.1</td>
|
| 201 |
+
<td>1791</td>
|
| 202 |
+
<td>1.0</td>
|
| 203 |
+
<td>1950</td>
|
| 204 |
+
</tr>
|
| 205 |
+
<tr>
|
| 206 |
+
<th rowspan="3" valign="top">H100x1</th>
|
| 207 |
+
<th>Qwen/Qwen2.5-VL-7B-Instruct</th>
|
| 208 |
+
<td></td>
|
| 209 |
+
<td>2.0</td>
|
| 210 |
+
<td>557</td>
|
| 211 |
+
<td>1.2</td>
|
| 212 |
+
<td>919</td>
|
| 213 |
+
<td>1.2</td>
|
| 214 |
+
<td>941</td>
|
| 215 |
+
</tr>
|
| 216 |
+
<tr>
|
| 217 |
+
<th>neuralmagic/Qwen2.5-VL-7B-Instruct-FP8-Dynamic</th>
|
| 218 |
+
<td>1.28</td>
|
| 219 |
+
<td>1.6</td>
|
| 220 |
+
<td>698</td>
|
| 221 |
+
<td>0.9</td>
|
| 222 |
+
<td>1181</td>
|
| 223 |
+
<td>0.9</td>
|
| 224 |
+
<td>1219</td>
|
| 225 |
+
</tr>
|
| 226 |
+
<tr>
|
| 227 |
+
<th>neuralmagic/Qwen2.5-VL-7B-Instruct-quantized.w4a16</th>
|
| 228 |
+
<td>1.28</td>
|
| 229 |
+
<td>1.6</td>
|
| 230 |
+
<td>686</td>
|
| 231 |
+
<td>0.9</td>
|
| 232 |
+
<td>1191</td>
|
| 233 |
+
<td>0.9</td>
|
| 234 |
+
<td>1228</td>
|
| 235 |
+
</tr>
|
| 236 |
+
</tbody>
|
| 237 |
+
</table>
|
| 238 |
+
|
| 239 |
+
|
| 240 |
+
|
| 241 |
+
### Multi-stream asynchronous performance (measured with vLLM version 0.7.2)
|
| 242 |
+
|
| 243 |
+
<table border="1" class="dataframe">
|
| 244 |
+
<thead>
|
| 245 |
+
<tr>
|
| 246 |
+
<th></th>
|
| 247 |
+
<th></th>
|
| 248 |
+
<th></th>
|
| 249 |
+
<th style="text-align: center;" colspan="2" >Document Visual Question Answering<br>1680W x 2240H<br>64/128</th>
|
| 250 |
+
<th style="text-align: center;" colspan="2" >Visual Reasoning <br>640W x 480H<br>128/128</th>
|
| 251 |
+
<th style="text-align: center;" colspan="2" >Image Captioning<br>480W x 360H<br>0/128</th>
|
| 252 |
+
</tr>
|
| 253 |
+
<tr>
|
| 254 |
+
<th>Hardware</th>
|
| 255 |
+
<th>Model</th>
|
| 256 |
+
<th>Average Cost Reduction</th>
|
| 257 |
+
<th>Maximum throughput (QPS)</th>
|
| 258 |
+
<th>QPD</th>
|
| 259 |
+
<th>Maximum throughput (QPS)</th>
|
| 260 |
+
<th>QPD</th>
|
| 261 |
+
<th>Maximum throughput (QPS)</th>
|
| 262 |
+
<th>QPD</th>
|
| 263 |
+
</tr>
|
| 264 |
+
</thead>
|
| 265 |
+
<tbody style="text-align: center">
|
| 266 |
+
<tr>
|
| 267 |
+
<th rowspan="3" valign="top">A100x1</th>
|
| 268 |
+
<th>Qwen/Qwen2.5-VL-7B-Instruct-quantized.</th>
|
| 269 |
+
<td></td>
|
| 270 |
+
<td>0.7</td>
|
| 271 |
+
<td>1347</td>
|
| 272 |
+
<td>2.6</td>
|
| 273 |
+
<td>5221</td>
|
| 274 |
+
<td>3.0</td>
|
| 275 |
+
<td>6122</td>
|
| 276 |
+
</tr>
|
| 277 |
+
<tr>
|
| 278 |
+
<th>neuralmagic/Qwen2.5-VL-7B-Instruct-quantized.w8a8</th>
|
| 279 |
+
<td>1.27</td>
|
| 280 |
+
<td>0.8</td>
|
| 281 |
+
<td>1639</td>
|
| 282 |
+
<td>3.4</td>
|
| 283 |
+
<td>6851</td>
|
| 284 |
+
<td>3.9</td>
|
| 285 |
+
<td>7918</td>
|
| 286 |
+
</tr>
|
| 287 |
+
<tr>
|
| 288 |
+
<th>neuralmagic/Qwen2.5-VL-7B-Instruct-quantized.w4a16</th>
|
| 289 |
+
<td>1.21</td>
|
| 290 |
+
<td>0.7</td>
|
| 291 |
+
<td>1314</td>
|
| 292 |
+
<td>3.0</td>
|
| 293 |
+
<td>5983</td>
|
| 294 |
+
<td>4.6</td>
|
| 295 |
+
<td>9206</td>
|
| 296 |
+
</tr>
|
| 297 |
+
<tr>
|
| 298 |
+
<th rowspan="3" valign="top">H100x1</th>
|
| 299 |
+
<th>Qwen/Qwen2.5-VL-7B-Instruct</th>
|
| 300 |
+
<td></td>
|
| 301 |
+
<td>0.9</td>
|
| 302 |
+
<td>969</td>
|
| 303 |
+
<td>3.1</td>
|
| 304 |
+
<td>3358</td>
|
| 305 |
+
<td>3.3</td>
|
| 306 |
+
<td>3615</td>
|
| 307 |
+
</tr>
|
| 308 |
+
<tr>
|
| 309 |
+
<th>neuralmagic/Qwen2.5-VL-7B-Instruct-FP8-Dynamic</th>
|
| 310 |
+
<td>1.29</td>
|
| 311 |
+
<td>1.2</td>
|
| 312 |
+
<td>1331</td>
|
| 313 |
+
<td>3.8</td>
|
| 314 |
+
<td>4109</td>
|
| 315 |
+
<td>4.2</td>
|
| 316 |
+
<td>4598</td>
|
| 317 |
+
</tr>
|
| 318 |
+
<tr>
|
| 319 |
+
<th>neuralmagic/Qwen2.5-VL-7B-Instruct-quantized.w4a16</th>
|
| 320 |
+
<td>1.28</td>
|
| 321 |
+
<td>1.2</td>
|
| 322 |
+
<td>1298</td>
|
| 323 |
+
<td>3.8</td>
|
| 324 |
+
<td>4190</td>
|
| 325 |
+
<td>4.2</td>
|
| 326 |
+
<td>4573</td>
|
| 327 |
+
</tr>
|
| 328 |
+
</tbody>
|
| 329 |
+
</table>
|