Skip to content

vllm.model_executor.models.encoder_cudagraph_utils

Reusable implementations of the SupportsEncoderCudaGraph protocol.

Classes:

Qwen2VLEncoderCudaGraphMixin

Bases: SupportsEncoderCudaGraph

Encoder CUDA graph support for Qwen2-VL-style vision towers.

Inputs are concatenated patches (pixel_values or pixel_values_videos) with one (t, h, w) row per item in image_grid_thw or video_grid_thw. self.visual must provide spatial_merge_size, prepare_encoder_metadata() and accept encoder_metadata in its forward; the capture inputs also read patch_embed and input_norm. Hosts still implement get_encoder_cudagraph_config().

This class holds only the glue to the encoder CUDA graph manager; model-specific metadata belongs in the vision tower. Do not add per-model branches here: a model that differs overrides the protocol method itself.