vllm.model_executor.models.kanana_v
¶
Classes:
-
CustomQwen2VLVE–Thin wrapper around the Qwen2-VL used as a vision encoder.
-
DynamicCAbstractor–Dynamic C-Abstractor based on RegNet blocks.
-
KananaVImagePixelInputs–Dimensions:
-
KananaVMultiModalProcessor–vLLM multimodal processor for Kanana-V (text + image).
-
PatchMerge–Merge neighboring patches spatially to reduce resolution.
Functions:
-
build_mlp–Simple SiLU-activated MLP used as a projector readout.
-
build_pos_embeds–Build positional embeddings for the visual encoder output.
CustomQwen2VLVE
¶
Bases: Qwen2VisionTransformer
Thin wrapper around the Qwen2-VL used as a vision encoder.
This mirrors the original HF-based vision encoder used in Kanana-V, but
reuses vLLM's optimized Qwen2VisionTransformer building blocks.
Methods:
-
forward–Run the vision transformer and optionally return intermediate states.
_from_config(config)
classmethod
¶
Drop-in replacement for the HF _from_config constructor.
forward(pixel_values, grid_thw, output_hidden_states=None, return_dict=None)
¶
Run the vision transformer and optionally return intermediate states.
Unlike the base Qwen2VisionTransformer, this wrapper exposes the
pre-merger patch-level representations and a HF-style BaseModelOutput
so that the existing projector / abstractor code can be reused.
DynamicCAbstractor
¶
KananaVImagePixelInputs
¶
Bases: TensorSchema
Dimensions: - np: The total number of patches over all images in the batch - cps: Number of channels * patch_size * patch_size - ni: Number of images
KananaVMultiModalProcessor
¶
Bases: BaseMultiModalProcessor[KananaVProcessingInfo]
vLLM multimodal processor for Kanana-V (text + image).
_apply_hf_processor_main(mm_items, hf_kwargs)
¶
Run the underlying HF processor on text and image data.
PatchMerge
¶
build_mlp(depth, hidden_size, output_hidden_size)
¶
Simple SiLU-activated MLP used as a projector readout.
build_pos_embeds(config, num_input_tokens, vision_hidden_size)
¶
Build positional embeddings for the visual encoder output.