Skip to content
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
9254562
More sensible name for vllm_attention_forward
hmellor Jun 30, 2026
54dd407
Add fusers
hmellor Jun 30, 2026
5a67279
Use fusers as part of recursive_replace
hmellor Jun 30, 2026
d9ec10e
Check for fusions in general transformers backend tests
hmellor Jun 30, 2026
b7180c2
Fuser tests
hmellor Jun 30, 2026
4293df9
rework a bit
hmellor Jul 1, 2026
2772c10
Actually run the new fusion tests
hmellor Jul 1, 2026
6ef790d
Refactor so each fuser gets its own file and fx utils are separated
hmellor Jul 1, 2026
f12eb72
Use Fuser for RMSNorm too
hmellor Jul 1, 2026
16ff001
update tests
hmellor Jul 1, 2026
6c4debd
Log fusion info
hmellor Jul 1, 2026
7d3a751
Use fusion mechanism for MoE and RMSNorm
hmellor Jul 1, 2026
83da8be
Update perf expectations in doc
hmellor Jul 2, 2026
f9a601b
Support torch.nn.RMSNorm
hmellor Jul 2, 2026
0cc2803
Update tests
hmellor Jul 2, 2026
b6b12dd
Concise RMSNorm comments
hmellor Jul 2, 2026
9c408ba
renaming
hmellor Jul 2, 2026
126e5df
Consistency pass
hmellor Jul 2, 2026
6faa797
remove print
hmellor Jul 2, 2026
409db2d
Attempt replacement of down_proj and o_proj
hmellor Jul 2, 2026
df4bb49
Make pp_plan optional
hmellor Jul 2, 2026
d90bcd9
Small fix
hmellor Jul 2, 2026
a113e2d
Update tests
hmellor Jul 2, 2026
8eec984
Always register vllm_attention_forward
hmellor Jul 3, 2026
c6e811f
Remove bad typing pattern
hmellor Jul 3, 2026
e66f5b9
Restructure tests
hmellor Jul 3, 2026
0da7252
Ensure q_norm or k_norm don't interfere with o_proj detection
hmellor Jul 3, 2026
a53f28e
Make RMSNorm TP aware
hmellor Jul 3, 2026
814481e
Update doc
hmellor Jul 3, 2026
f2ac331
Harden RMSNormFuser
hmellor Jul 3, 2026
1eca4d7
Update RMSNorm tests
hmellor Jul 3, 2026
def713c
Harden o_proj detection
hmellor Jul 3, 2026
6069c68
Update tests
hmellor Jul 3, 2026
8ecd677
Merge branch 'main' into transformers-fusions
mergify[bot] Jul 4, 2026
23b265e
Fix tests
hmellor Jul 6, 2026
d70a5a7
Merge branch 'main' into transformers-fusions
hmellor Jul 6, 2026
702e5a2
can't pickle local function
hmellor Jul 6, 2026
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
8 changes: 4 additions & 4 deletions .buildkite/test-amd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ steps:
commands:
- TARGET_TEST_SUITE=MI300 pytest basic_correctness/ -v -s -m 'distributed(num_gpus=2)'
- CUDA_VISIBLE_DEVICES=0,1 pytest -v -s model_executor/model_loader/test_sharded_state_loader.py -m '(not slow_test)'
- pytest models/test_transformers.py -v -s -m 'distributed(num_gpus=2)'
- pytest models/transformers/test_backend.py -v -s -m 'distributed(num_gpus=2)'
- pytest models/language -v -s -m 'distributed(num_gpus=2)'
- pytest models/multimodal -v -s -m 'distributed(num_gpus=2)' --ignore models/multimodal/generation/test_whisper.py --ignore models/multimodal/generation/test_phi4siglip.py
- pytest models/multimodal/generation/test_phi4siglip.py -v -s -m 'distributed(num_gpus=2)'
Expand Down Expand Up @@ -1637,10 +1637,10 @@ steps:
source_file_dependencies:
- vllm/
- tests/models/test_terratorch.py
- tests/models/test_transformers.py
- tests/models/transformers/test_backend.py
- tests/models/test_registry.py
commands:
- pytest -v -s models/test_terratorch.py models/test_transformers.py models/test_registry.py
- pytest -v -s models/test_terratorch.py models/transformers/test_backend.py models/test_registry.py

#----------------------------------------------------- mi300 · models / language -----------------------------------------------------#

Expand Down Expand Up @@ -1860,7 +1860,7 @@ steps:
- examples/
commands:
- pip install --upgrade git+https://github.com/huggingface/transformers
- pytest -v -s tests/models/test_transformers.py
- pytest -v -s tests/models/transformers/test_backend.py
- pytest -v -s tests/models/multimodal/test_mapping.py
- python3 examples/basic/offline_inference/chat.py
- python3 examples/generate/multimodal/vision_language_offline.py --model-type qwen2_5_vl
Expand Down
7 changes: 4 additions & 3 deletions .buildkite/test_areas/models_basic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ steps:
source_file_dependencies:
- vllm/
- tests/models/test_terratorch.py
- tests/models/test_transformers.py
- tests/models/transformers/test_backend.py
- tests/models/test_registry.py
commands:
- pytest -v -s models/test_terratorch.py models/test_transformers.py models/test_registry.py
- pytest -v -s models/test_terratorch.py models/transformers/test_backend.py models/test_registry.py
mirror:
amd:
device: mi325_1
Expand All @@ -55,6 +55,7 @@ steps:
- vllm/
- tests/models/test_utils.py
- tests/models/test_vision.py
- tests/models/transformers/fusers/
device: cpu-small
commands:
- pytest -v -s models/test_utils.py models/test_vision.py
- pytest -v -s models/test_utils.py models/test_vision.py models/transformers/fusers/
2 changes: 1 addition & 1 deletion .buildkite/test_areas/models_distributed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ steps:
- TARGET_TEST_SUITE=L4 pytest basic_correctness/ -v -s -m 'distributed(num_gpus=2)'
- CUDA_VISIBLE_DEVICES=0,1 pytest -v -s model_executor/model_loader/test_sharded_state_loader.py -m '(not slow_test)'
# Avoid importing model tests that cause CUDA reinitialization error
- pytest models/test_transformers.py -v -s -m 'distributed(num_gpus=2)'
- pytest models/transformers/test_backend.py -v -s -m 'distributed(num_gpus=2)'
- pytest models/language -v -s -m 'distributed(num_gpus=2)'
- pytest models/multimodal/generation/test_phi4siglip.py -v -s -m 'distributed(num_gpus=2)'
- pytest models/multimodal -v -s -m 'distributed(num_gpus=2)' --ignore models/multimodal/generation/test_whisper.py --ignore models/multimodal/generation/test_phi4siglip.py
Expand Down
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@

# Transformers modeling backend
/vllm/model_executor/models/transformers @hmellor
/tests/models/test_transformers.py @hmellor
/tests/models/transformers @hmellor

# Docs
/docs/mkdocs @hmellor
Expand Down
6 changes: 4 additions & 2 deletions docs/models/supported_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ These models are what we list in [supported text models](#list-of-text-only-lang

### Transformers

vLLM also supports model implementations that are available in Transformers. You should expect the performance of a Transformers model implementation used in vLLM to be within <5% of the performance of a dedicated vLLM model implementation. We call this feature the "Transformers modeling backend".
vLLM also supports model implementations that are available in Transformers. We call this feature the "Transformers modeling backend". The performance of models loaded with the Transformers modeling backend should be identical to a dedicated vLLM model implementation.

Currently, the Transformers modeling backend works for the following:

Expand Down Expand Up @@ -140,7 +140,7 @@ Here is what happens in the background when this model is loaded:

That's it!

For your model to be compatible with vLLM's tensor parallel and/or pipeline parallel features, you must add `base_model_tp_plan` and/or `base_model_pp_plan` to your model's config class:
For your model to be compatible with vLLM's tensor parallel and/or pipeline parallel features, you may need to add `base_model_tp_plan` and/or `base_model_pp_plan` to your model's config class:

<details class="code">
<summary>configuration_my_model.py</summary>
Expand Down Expand Up @@ -168,9 +168,11 @@ class MyConfig(PretrainedConfig):
</details>

- `base_model_tp_plan` is a `dict` that maps fully qualified layer name patterns to tensor parallel styles (currently only `"colwise"` and `"rowwise"` are supported).
- vLLM infers the tensor parallel style of standard attention (`q`/`k`/`v`/`o_proj`) and gated-MLP/experts (`gate`/`up`/`down_proj`) projections if it can fuse them, so these may not need to be listed. `base_model_tp_plan` is only _required_ for layers that do not follow these patterns; any linear that is neither fused nor named in the plan is replicated.
- `base_model_pp_plan` is a `dict` that maps direct child layer names to `tuple`s of `list`s of `str`s:
- You only need to do this for layers which are not present on all pipeline stages
- vLLM assumes that there will be only one `nn.ModuleList`, which is distributed across the pipeline stages
- When no `base_model_pp_plan` is provided, the Transformers modelling backend infers the split from the text model's sole `nn.ModuleList`, keeping the parameter-bearing modules around it (input embeddings, final norm) on the first/last stage (depending on declaration order) and parameter-free modules (e.g. rotary embeddings) on every stage
- The `list` in the first element of the `tuple` contains the names of the input arguments
- The `list` in the last element of the `tuple` contains the names of the variables the layer outputs to in your modeling code

Expand Down
Empty file.
Empty file.
Loading
Loading