vllm.model_executor.models.idefics2_vision_model
¶
PyTorch Idefics2 model.
Classes:
-
Idefics2Encoder–Transformer encoder consisting of
config.num_hidden_layersself attention -
Idefics2EncoderLayer– -
Idefics2VarlenMetadata– -
Idefics2VisionAttention–Multi-headed attention from 'Attention Is All You Need' paper.
-
Idefics2VisionEmbeddings–This is a modified version of
siglip.modelign_siglip.SiglipVisionEmbeddings -
Idefics2VisionTransformer–
Idefics2Encoder
¶
Bases: Module
Transformer encoder consisting of config.num_hidden_layers self attention
layers. Each layer is a
[Idefics2EncoderLayer].
Parameters:
-
(config¶Idefics2Config) –Idefics2Config
Methods:
-
forward–Args:
forward(inputs_embeds, attention_mask=None, varlen=None)
¶
inputs_embeds (torch.Tensor):
Optionally, instead of passing input_ids you can choose to
directly pass an embedded representation.
This is useful if you want more control over how to convert
input_ids indices into associated vectorsthan the model's
internal embedding lookup matrix.
Idefics2EncoderLayer
¶
Idefics2VarlenMetadata
dataclass
¶
Methods:
Idefics2VisionAttention
¶
Idefics2VisionEmbeddings
¶
Bases: Module
This is a modified version of siglip.modelign_siglip.SiglipVisionEmbeddings
to enable images of variable resolution.
The modifications are adapted from Patch n' Pack: NaViT, a Vision Transformer for any Aspect Ratio and Resolution which allows treating images in their native aspect ratio and without the need to resize them to the same fixed size. In particular, we start from the original pre-trained SigLIP model(which uses images of fixed-size square images) and adapt it by training on images of variable resolutions.
Idefics2VisionTransformer
¶
Bases: Module
Methods:
-
get_varlen_metadata–Returns None if no token is padded.
Attributes:
-
prefer_varlen_attention(bool) –Whether to prefer varlen attention over masked SDPA.