Skip to content

vllm.model_executor.models.llava_onevision

Classes:

LlavaOnevisionForConditionalGeneration

Bases: Module, SupportsMultiModal, SupportsPP

Methods:

  • forward –

    Run forward pass for LlaVA-Onevision.

_parse_and_validate_video_input(**kwargs)

A legal video input should have the following dimensions: { "pixel_values_videos" : list[b, Tensor(nb_frames, nb_channels, height, width)] }

forward(input_ids, positions, intermediate_tensors=None, inputs_embeds=None, **kwargs)

Run forward pass for LlaVA-Onevision.

Parameters:

  • input_ids

    (Tensor | None) –

    Flattened (concatenated) input_ids corresponding to a batch.

  • positions

    (Tensor) –

    Flattened (concatenated) position ids corresponding to a batch.

  • intermediate_tensors

    (IntermediateTensors | None, default: None ) –

    Intermediate tensors from prior forward pass.

  • inputs_embeds

    (Tensor | None, default: None ) –

    Optional tensor of input embeddings.

  • **kwargs

    (object, default: {} ) –

    Multimodal inputs for this batch, forwarded to the multimodal embedding path.

LlavaOnevisionImageEmbeddingInputs

Bases: TensorSchema

Dimensions: - bn: Batch size * number of images - ifs: Image feature size - hs: Hidden size (must match language model backbone)

LlavaOnevisionImagePixelInputs

Bases: TensorSchema

Dimensions: - bn: Batch size * number of images - np: Number of patches (1 + num_patches) - c: Number of channels (3) - h: Height - w: Width

Note that num_patches may be different per batch and image, in which case the data is passed as a list instead of a batched tensor.

LlavaOnevisionVideoPixelInputs

Bases: TensorSchema

Dimensions: - bn: Batch size * number of videos - f: Number of frames - c: Number of channels (3) - h: Height - w: Width

Note that f may be different for each batch, and 'num_frames' may be different for each video, in which case the data is passed as a list instead of a batched tensor.