Skip to content

vllm.model_executor.models.phi3v

Classes:

Phi3HDImageEmbedding

Bases: Module

Phi3 Image embedding with HD transform.

Methods:

add_image_newline(image_features_hd)

image_features_hd: (num_images, h_crop12, w_crop12, 4096) output: (num_images, (h_crop12) * (w_crop12+1), 4096)

forward(pixel_values, image_sizes)

Process image and return vision embeddings.

pixel_values: (num_images, num_crops, c, h, w) output: (num_images, num_img_tokens, hidden_size)

hd_feature_transform(image_features, image_sizes)

image_features: (num_images, num_crops+1, 24*24, 1024).

reshape_hd_patches_2x2merge(image_features, h_crop, w_crop)

image_features: (num_imagesnum_crops, 2424, 1024) output: (num_images, h_crop12, w_crop12, 4096) where h_crop*w_crop == num_crops

Phi3VImageEmbeddingInputs

Bases: TensorSchema

Dimensions: - b: Batch size - n: Number of images - f: Image feature size (e.g., number of tokens per image) - h: Hidden size (must match language model backbone)

Phi3VImagePixelInputs

Bases: TensorSchema

Dimensions: - b: Batch size - n: Number of images - p: Number of patches - h: Height of each patch - w: Width of each patch