Skip to content

vllm.model_executor.models.siglip2navit

Implementation of SiglipVisionModel intended to be only used within a vision language model.

Classes:

Siglip2Attention

Bases: Module

Multi-headed attention from 'Attention Is All You Need' paper.

Methods:

  • forward –

    Input shape: Batch x Time x Channel.

forward(hidden_states, cu_seqlens, position_embeddings=None)

Input shape: Batch x Time x Channel.

Siglip2Encoder

Bases: Module

Transformer encoder consisting of config.num_hidden_layers self attention layers. Each layer is a [Siglip2EncoderLayer].

Parameters:

  • config

    (Siglip2VisionConfig) –

    PreTrainedConfig

Methods:

forward(inputs_embeds, grid_thws)

inputs_embeds: Input tensor of shape (batch_size, sequence_length, hidden_size). Embedded representation of the input tokens. grid_thws: Grid tensor of shape (num_patches, 3) containing grid dimensions. Whether or not to return a [~utils.ModelOutput] instead of a plain tuple.

Siglip2EncoderLayer

Bases: Module

Methods:

forward(hidden_states, cu_seqlens, position_embeddings)

Args: hidden_states: Input tensor of shape (batch, seq_len, embed_dim). cu_seqlens: Cumulative sequence lengths tensor. position_embeddings: Position embeddings tensor.

Siglip2VisionEmbeddings

Bases: Module

Methods:

forward(pixel_values, grid_thws=None)

pixel_values (torch.FloatTensor): Pixel values of shape ( num_patches, num_channels * temporal_patch_size * patch_size * patch_size ) grid_thws: (torch.LongTensor): grid shape (num_patches, 3)

Siglip2VisionTransformer

Bases: Module

Methods:

  • forward –

    spatial_shapes (torch.LongTensor of shape (batch_size, 2)):

forward(pixel_values, grid_thws)

spatial_shapes (torch.LongTensor of shape (batch_size, 2)): Tensor containing the spatial dimensions (height, width) of the input images.