vllm.transformers_utils.processors.hunyuan_vl ¶
HunYuanVLProcessor ¶
Bases: ProcessorMixin
Source code in vllm/transformers_utils/processors/hunyuan_vl.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 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 | |
image_processor_class class-attribute instance-attribute ¶
__call__ ¶
__call__(
images: ImageInput = None,
text: TextInput
| PreTokenizedInput
| list[TextInput]
| list[PreTokenizedInput] = None,
videos: VideoInput = None,
**kwargs,
) -> BatchFeature
Source code in vllm/transformers_utils/processors/hunyuan_vl.py
__init__ ¶
__init__(
image_processor=None,
tokenizer=None,
video_processor=None,
chat_template=None,
**kwargs,
)
Source code in vllm/transformers_utils/processors/hunyuan_vl.py
apply_chat_template ¶
batch_decode ¶
decode ¶
get_imgs_pos ¶
Source code in vllm/transformers_utils/processors/hunyuan_vl.py
post_process_image_text_to_text ¶
split_image_into_patch_blocks ¶
split_image_into_patch_blocks(
pixel_values: Tensor,
patch_size: int = 16,
adaptor_patch_div: int = 4,
) -> Tensor
Split the input image tensor (supporting batch) into large patches of size patch_size, and then further divide each large patch into smaller regions of size (patch_size // adaptor_patch_div) x (patch_size // adaptor_patch_div). Each small region is extracted as a tensor of shape [3, patch_size, patch_size]. The final output contains all such small region tensors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pixel_values | Tensor | Input image tensor of shape [batch_size, 3, H, W]. | required |
patch_size | int | Size of the large patch, e.g., 16. | 16 |
adaptor_patch_div | int | Each large patch is divided into (patch_size // adaptor_patch_div) x (patch_size // adaptor_patch_div) smaller regions. | 4 |
Returns:
| Name | Type | Description |
|---|---|---|
patches | Tensor | A tensor of shape [N, 3, patch_size, patch_size], where N = batch_size * (H // patch_size) * (W // patch_size) * (patch_size // adaptor_patch_div)^2. Each element in the batch corresponds to one small image region. |