vllm.model_executor.models.isaac
¶
Classes:
-
IsaacForConditionalGeneration– -
IsaacImagePixelInputs–Schema for validating Isaac image inputs.
-
Siglip2VisionTransformer–
Functions:
-
create_cumulative_seq_lengths–Create cumulative sequence lengths for variable-length attention.
-
create_pixel_shuffle_index_map–Build a gather-index map that tells us, for every output token after
-
pixel_shuffle_varlen–Apply pixel shuffle to a packed vision sequence without unpacking per image.
IsaacForConditionalGeneration
¶
Bases: Module, SupportsMultiModal, SupportsLoRA, SupportsPP, SupportsMRoPE
Methods:
-
get_mm_mapping–Get the module prefix in multimodal models.
get_mm_mapping()
¶
Get the module prefix in multimodal models.
IsaacImagePixelInputs
¶
Bases: TensorSchema
Schema for validating Isaac image inputs.
Dimensions
- np: Number of patches
- d: Patch dimension
- ni: Number of images
The schema enforces
- pixel_values must be 2D: (num_patches, patch_dim)
- image_grid_thw must be 2D: (num_images, 3) where 3 represents [T, H, W]
Siglip2VisionTransformer
¶
create_cumulative_seq_lengths(seq_sizes, device)
¶
Create cumulative sequence lengths for variable-length attention.
create_pixel_shuffle_index_map(seq_sizes, token_grids, scale_factor=1, device=None)
¶
Build a gather-index map that tells us, for every output token after
pixel-shuffle, which scale_factor**2 input tokens are being merged.
Args:¶
seq_sizes : (num_images,) - #patches in each image (row-major order)
token_grids : (num_images,2) - (height, width) for every image
scale_factor : spatial down-scale factor (≥2)
device : (optional) overrides seq_sizes.device
Returns:¶
gather_idx : (new_total_seq_len, scale_factor2) int64 tensor. gather_idx[i, j] is the flat index into the original packed sequence for the j-th sub-patch that forms the i-th output token.
pixel_shuffle_varlen(x, token_grids, scale_factor=1)
¶
Apply pixel shuffle to a packed vision sequence without unpacking per image.
Parameters:
-
(x¶`torch.Tensor`) –Concatenated vision embeddings. Accepts
(seq_len, hidden_size)or(1, seq_len, hidden_size)shapes produced by stacking image patches. -
(token_grids¶`torch.Tensor`) –Integer tensor of shape
(num_images, 2)whose rows give the(height, width)patch grid sizes corresponding to each image segment insidex. -
(scale_factor¶`int`, *optional*, defaults to 1, default:1) –Spatial down-sampling factor specific to pixel shuffle. Values greater than one merge
scale_factor**2neighboring patches into a single embedding channel-group.
Returns:
-
Tensor–torch.Tensor: Pixel-shuffled embeddings with shape matching the input -
convention(Tensor) –(seq_len, hidden_size * scale_factor**2)when the input -
Tensor–was 2D, or
(1, seq_len, hidden_size * scale_factor**2)if the -
Tensor–singleton batch dimension was present.
Raises:
-
ValueError–If more than one batch item is provided.