Skip to content

vllm.model_executor.models.cohere2_vision

Command-A-Vision (Cohere2Vision) multimodal model implementation for vLLM.

Classes:

Cohere2VisionForConditionalGeneration

Bases: Module, SupportsMultiModal, SupportsPP, SupportsQuant

_process_image_input(image_input, **kwargs)

Process image pixels through vision tower and projector.

Parameters:

  • image_input

    (Cohere2VisionImagePixelInputs) –

    Validated image input containing pixel values and patch counts

  • **kwargs

    (object, default: {} ) –

    Unused; accepted for interface compatibility.

Returns:

  • list[Tensor] –

    List of flattened image embeddings, one per image

Cohere2VisionImagePixelInputs

Bases: TensorSchema

Dimensions: - np: The total number of patches over each image over each prompt in the batch - c: Number of channels - h: Height of each image patch - w: Width of each image patch - bn: Batch size * number of images

Cohere2VisionMultiModalProjector

Bases: Module

Multimodal projector that maps vision features to text embedding space.

Uses pixel shuffle downsampling followed by SwiGLU activation.

Methods:

  • pixel_shuffle –

    Apply pixel shuffle downsampling to reduce spatial dimensions.

pixel_shuffle(image_features)

Apply pixel shuffle downsampling to reduce spatial dimensions.

Parameters:

  • image_features

    (Tensor) –

    Input tensor of shape [B, S, D] where S = H*W

Returns:

  • Tensor –

    Downsampled tensor with increased channel dimension

Cohere2VisionProcessingInfo

Bases: BaseProcessingInfo

Methods:

  • get_num_patches –

    Calculate the number of image patches for a given image.

get_num_patches(*, image_width, image_height, processor, mm_kwargs)

Calculate the number of image patches for a given image. Uses the HF processor to determine the actual number of patches.