Skip to content

Add Llama4VisionModel for multimodal decoding #1809

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

hengtaoguo
Copy link
Collaborator

@hengtaoguo hengtaoguo commented Jun 5, 2025

Description

This PR implements a complete class Llama4VisionModel, by integrating all Llama4 basic vision components. It allows Llama4 multimodal decode by describing an input image. Joint by @hengtaoguo and @aireenmei .

  • Core change Llama4VisionModel, which converts image tiles (batch_size, num_tiles, C, H, W) to feature activations (batch_size, num_tiles, num_patches, vision_output_dim_for_vit). Then Llama4MultiModalProjector projects it to (batch_size, num_tiles, num_patches, base_emb_dim). Example: (8, 5, 3, 336, 336) -> (8, 5, 144, 4096) -> (8, 5, 144, 5120)
  • Refactor by adding a get_dummy_image_shape_for_init() to create desired dummy images for different models, for jit init purpose.

Tests

Tested full multimodal decode on v5p-16 cluster with this command, and workload with screenshot.
image

Checklist

Before submitting this PR, please make sure (put X in square brackets):

  • I have performed a self-review of my code.
  • I have necessary comments in my code, particularly in hard-to-understand areas.
  • I have run end-to-end tests tests and provided workload links above if applicable.
  • I have made or will make corresponding changes to the doc if needed.

@hengtaoguo hengtaoguo marked this pull request as ready for review June 20, 2025 05:35
@hengtaoguo hengtaoguo self-assigned this Jun 20, 2025
@hengtaoguo hengtaoguo changed the title [WIP] Full Llama4 VisionModel Implement Llama4VisionModel for multimodal decoding Jun 20, 2025
@hengtaoguo hengtaoguo changed the title Implement Llama4VisionModel for multimodal decoding Add Llama4VisionModel for multimodal decoding Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant