Skip to content

Allow serving Llama4ForCausalLM directly #20868

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 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions vllm/model_executor/models/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"JAISLMHeadModel": ("jais", "JAISLMHeadModel"),
"JambaForCausalLM": ("jamba", "JambaForCausalLM"),
"LlamaForCausalLM": ("llama", "LlamaForCausalLM"),
"Llama4ForCausalLM": ("llama4", "Llama4ForCausalLM"),
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

While adding the model to the registry is correct, this PR appears to be missing automated tests for the new Llama4ForCausalLM model. To ensure the model implementation is and remains correct, please add an entry for it in _TEXT_GENERATION_EXAMPLE_MODELS in tests/models/registry.py.

This will enable CI to run tests against this new architecture. Based on your PR description, you could use trl-internal-testing/tiny-Llama4ForCausalLM. If this model is not publicly accessible, consider creating a small, public dummy model with the same architecture for testing purposes.

Copy link
Contributor

@huachenheli huachenheli Jul 13, 2025

Choose a reason for hiding this comment

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

Since there's no official text-only HF checkpoint, can you add a comment on what's required to enable the text-only version? e.g. Need to change architecture in config.json. Also, does one need to strip the mm part from the HF version? etc.

# For decapoda-research/llama-*
"LLaMAForCausalLM": ("llama", "LlamaForCausalLM"),
"MambaForCausalLM": ("mamba", "MambaForCausalLM"),
Expand Down