vllm.model_executor.models.qwen_vl ¶
Inference-only Qwen-VL model compatible with HuggingFace weights.
QwenImageEmbeddingInputs ¶
Bases: TensorSchema
Dimensions
- bn: Batch size * number of images
- ifs: Image feature size (256)
- hs: Hidden size
hidden_size must match the hidden size of the language model backbone and is stored in the visual config of the model if we have one.
Source code in vllm/model_executor/models/qwen_vl.py
QwenImagePixelInputs ¶
Bases: TensorSchema
Dimensions
- bn: Batch size * number of images
- c: Number of channels (3)
- h: Height
- w: Width
Note that image_size is the value in the vision config to which we resize the image to in the normalization transform. Currently multi-image support can only be leveraged by passing image embeddings directly.
Source code in vllm/model_executor/models/qwen_vl.py
QwenVLForConditionalGeneration ¶
Bases: QWenBaseModel, SupportsPP, SupportsLoRA, SupportsMultiModal
Source code in vllm/model_executor/models/qwen_vl.py
719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 | |
get_mm_mapping ¶
Get the module prefix in multimodal models
Source code in vllm/model_executor/models/qwen_vl.py
QwenVLMLP ¶
Bases: Module
MLP for the visual component of the Qwen model.
Source code in vllm/model_executor/models/qwen_vl.py
QwenVLProcessor ¶
This model doesn't define its own HF processor, so we implement our own one here.
We call the wrapped tokenizer to automatically insert image pad tokens: https://huggingface.co/Qwen/Qwen-VL/blob/main/tokenization_qwen.py#L245
The image processor is defined here: https://huggingface.co/Qwen/Qwen-VL/blob/main/visual.py#L354
Source code in vllm/model_executor/models/qwen_vl.py
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 | |
VisualAttention ¶
Bases: Module
self-attention layer class. Self-attention layer takes input with size [s, b, h] and returns output of the same size.
Source code in vllm/model_executor/models/qwen_vl.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
_get_tokenizer_without_image_pad cached ¶
The logic of adding image pad tokens should only be applied in QwenVLProcessor, so they are patched out here.
The definition of the wrapped tokenizer can be found here: https://huggingface.co/Qwen/Qwen-VL/blob/main/tokenization_qwen.py