Skip to content

Conversation

@paulpak58
Copy link
Contributor

@paulpak58 paulpak58 commented Nov 21, 2025

Purpose

LFM2-VL Implementation

Test Plan

Test Result


Essential Elements of an Effective PR Description Checklist
  • The purpose of the PR, such as "Fix some issue (link existing issues this PR will resolve)".
  • The test plan, such as providing test command.
  • The test results, such as pasting the results comparison before and after, or e2e results
  • (Optional) The necessary documentation update, such as updating supported_models.md and examples for a new model.
  • (Optional) Release notes update. If your change is user facing, please update the release notes draft in the Google Doc.

@mergify
Copy link

mergify bot commented Nov 21, 2025

Documentation preview: https://vllm--29191.org.readthedocs.build/en/29191/

@mergify mergify bot added documentation Improvements or additions to documentation new-model Requests to new models labels Nov 21, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for the Lfm2-VL model, including its architecture implementation, an example script for offline inference, and necessary registrations. A new Siglip2Model implementation is also added as it's a dependency for Lfm2-VL. The overall implementation is solid, but I've found a type hint mismatch in the new lfm2_vl.py file that should be corrected for code correctness and clarity.

spatial_shapes: torch.Tensor,
pixel_attention_mask: torch.Tensor,
num_patches: torch.Tensor,
) -> torch.Tensor:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The return type hint for image_pixels_to_features is torch.Tensor, but the function actually returns a list[torch.Tensor]. The caller of this function, _process_image_input, expects a list of tensors. Please update the type hint to list[torch.Tensor] to match the implementation and avoid potential type errors.

Suggested change
) -> torch.Tensor:
) -> list[torch.Tensor]:

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +390 to +394
return self.vision_model(
pixel_values=pixel_values,
# attention_mask=pixel_attention_mask,
spatial_shapes=spatial_shapes,
)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Mask padded vision tokens in Siglip2 forward

In Siglip2Model.forward the processor-supplied pixel_attention_mask is accepted but never forwarded to the vision transformer (attention_mask is commented out). This means padded patch tokens introduced to equalize sequence length are never masked, yet they still carry bias and positional embeddings, so the encoder will mix these fake tokens into attention for any image smaller than the maximum patch budget—a common case—yielding incorrect visual embeddings. The mask needs to be propagated to the encoder or applied inside the attention layers to exclude padding.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation new-model Requests to new models

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant