vllm.model_executor.models.lfm3_vl
¶
Inference-only LFM3-VL model: images and videos in, text out.
Classes:
-
Lfm3VlMultiModalProjector–Merges each block of
spatial_merge_size**2vision tokens, normalized -
Lfm3VlVisionAttention–Bidirectional grouped-query attention over the patches of one frame, with
-
Lfm3VlVisionConv2d–Gated depthwise 2D convolution over the patch grid of each frame.
-
Lfm3VlVisionModel–The LFM3-VL vision encoder: gated convolution and bidirectional attention
Lfm3VlMultiModalProjector
¶
Bases: Module
Merges each block of spatial_merge_size**2 vision tokens, normalized
before the merge, into one language token.
Lfm3VlVisionAttention
¶
Bases: Module
Bidirectional grouped-query attention over the patches of one frame, with RMSNorm on the query and key heads and axial 2D RoPE.
Lfm3VlVisionConv2d
¶
Lfm3VlVisionModel
¶
Bases: Module
The LFM3-VL vision encoder: gated convolution and bidirectional attention layers over the patches of each image or video frame, embedded by a linear patchifier.
Methods:
-
position_embeddings–Cos and sin of every patch's (row, column), in merge-block order.
-
prepare_capture_metadata–Build dummy capture-time buffers without indexing
rotary_pos_emb. -
prepare_encoder_metadata–Precompute RoPE,
conv_indices, and attention metadata ondevice.
_build_conv_indices(grid_thw_list, *, device, use_cache=True)
¶
Build global 1-based conv_indices [N, k*k] isolated across frames.
_build_frame_conv_indices(height, width, *, use_cache=True)
¶
Build 1-based merge-block neighbor indices [H*W, k*k] for one frame.
position_embeddings(grid_thw)
¶
Cos and sin of every patch's (row, column), in merge-block order.
prepare_capture_metadata(*, num_patches, pad_to_num_frames, device)
¶
Build dummy capture-time buffers without indexing rotary_pos_emb.
prepare_encoder_metadata(grid_thw_list, *, pad_to_num_frames=None, max_seqlen_override=None, device=None)
¶
Precompute RoPE, conv_indices, and attention metadata on device.
_conv2d_gather_kernel(gated_ptr, weight_ptr, conv_indices_ptr, output_ptr, num_patches, hidden_dim, stride_gn, stride_gd, stride_wd, stride_wk, stride_in, stride_ik, stride_on, stride_od, KERNEL_AREA, BLOCK_N, BLOCK_D)
¶
Fused 1-based depthwise 2D gather-convolution in FP32 accumulation.
_native_conv2d_gather(gated, weight, conv_indices)
¶
Native PyTorch fallback for conv_indices depthwise 2D conv.
_triton_conv2d_gather(gated, weight, conv_indices)
¶
Compute depthwise 2D conv over 1-based conv_indices via Triton.