Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
5c4f2dd6
Unverified
Commit
5c4f2dd6
authored
Feb 03, 2026
by
Shanshan Shen
Committed by
GitHub
Feb 03, 2026
Browse files
[MM] Pass `prefix` parameter to MMEncoderAttention (#33674)
Signed-off-by:
shen-shanshan
<
467638484@qq.com
>
parent
f3d8a346
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
58 additions
and
11 deletions
+58
-11
vllm/model_executor/models/aimv2.py
vllm/model_executor/models/aimv2.py
+4
-1
vllm/model_executor/models/blip.py
vllm/model_executor/models/blip.py
+4
-1
vllm/model_executor/models/glm4_1v.py
vllm/model_executor/models/glm4_1v.py
+1
-0
vllm/model_executor/models/glm4v.py
vllm/model_executor/models/glm4v.py
+4
-1
vllm/model_executor/models/idefics2_vision_model.py
vllm/model_executor/models/idefics2_vision_model.py
+4
-1
vllm/model_executor/models/intern_vit.py
vllm/model_executor/models/intern_vit.py
+4
-1
vllm/model_executor/models/interns1_vit.py
vllm/model_executor/models/interns1_vit.py
+12
-2
vllm/model_executor/models/mllama4.py
vllm/model_executor/models/mllama4.py
+4
-1
vllm/model_executor/models/molmo.py
vllm/model_executor/models/molmo.py
+5
-1
vllm/model_executor/models/molmo2.py
vllm/model_executor/models/molmo2.py
+1
-0
vllm/model_executor/models/qwen2_5_vl.py
vllm/model_executor/models/qwen2_5_vl.py
+1
-0
vllm/model_executor/models/qwen2_vl.py
vllm/model_executor/models/qwen2_vl.py
+1
-0
vllm/model_executor/models/qwen3_omni_moe_thinker.py
vllm/model_executor/models/qwen3_omni_moe_thinker.py
+1
-0
vllm/model_executor/models/step3_vl.py
vllm/model_executor/models/step3_vl.py
+6
-1
vllm/model_executor/models/step_vl.py
vllm/model_executor/models/step_vl.py
+6
-1
No files found.
vllm/model_executor/models/aimv2.py
View file @
5c4f2dd6
...
...
@@ -127,7 +127,10 @@ class AIMv2Attention(nn.Module):
self
.
num_heads_per_partition
=
divide
(
self
.
num_heads
,
self
.
tp_size
)
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads_per_partition
,
self
.
head_dim
,
self
.
scale
self
.
num_heads_per_partition
,
self
.
head_dim
,
self
.
scale
,
prefix
=
prefix
,
)
def
forward
(
self
,
x
:
torch
.
Tensor
)
->
torch
.
Tensor
:
...
...
vllm/model_executor/models/blip.py
View file @
5c4f2dd6
...
...
@@ -123,7 +123,10 @@ class BlipAttention(nn.Module):
self
.
num_heads_per_partition
=
divide
(
self
.
num_heads
,
self
.
tp_size
)
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads_per_partition
,
self
.
head_dim
,
self
.
scale
self
.
num_heads_per_partition
,
self
.
head_dim
,
self
.
scale
,
prefix
=
prefix
,
)
def
_shape
(
self
,
tensor
:
torch
.
Tensor
,
seq_len
:
int
,
bsz
:
int
):
...
...
vllm/model_executor/models/glm4_1v.py
View file @
5c4f2dd6
...
...
@@ -296,6 +296,7 @@ class Glm4vVisionAttention(nn.Module):
num_heads
=
self
.
num_attention_heads_per_partition
,
head_size
=
self
.
hidden_size_per_attention_head
,
scale
=
self
.
hidden_size_per_attention_head
**-
0.5
,
prefix
=
prefix
,
)
self
.
apply_rotary_emb
=
ApplyRotaryEmb
(
enforce_enable
=
True
)
...
...
vllm/model_executor/models/glm4v.py
View file @
5c4f2dd6
...
...
@@ -136,7 +136,10 @@ class EVA2CLIPAttention(nn.Module):
)
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads_per_rank
,
self
.
head_dim
,
self
.
scale
self
.
num_heads_per_rank
,
self
.
head_dim
,
self
.
scale
,
prefix
=
prefix
,
)
self
.
output_dropout
=
torch
.
nn
.
Dropout
(
config
.
dropout_prob
)
...
...
vllm/model_executor/models/idefics2_vision_model.py
View file @
5c4f2dd6
...
...
@@ -163,7 +163,10 @@ class Idefics2VisionAttention(nn.Module):
)
# Use unified MMEncoderAttention with Flash Attention support
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads_per_partition
,
self
.
head_dim
,
self
.
scale
self
.
num_heads_per_partition
,
self
.
head_dim
,
self
.
scale
,
prefix
=
prefix
,
)
def
forward
(
...
...
vllm/model_executor/models/intern_vit.py
View file @
5c4f2dd6
...
...
@@ -212,7 +212,10 @@ class InternParallelAttention(nn.Module):
)
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads_per_partition
,
self
.
head_dim
,
self
.
scale
self
.
num_heads_per_partition
,
self
.
head_dim
,
self
.
scale
,
prefix
=
prefix
,
)
def
_apply_qk_norm
(
self
,
q
:
torch
.
Tensor
,
k
:
torch
.
Tensor
):
...
...
vllm/model_executor/models/interns1_vit.py
View file @
5c4f2dd6
...
...
@@ -170,6 +170,7 @@ class InternSdpaAttention(nn.Module):
config
:
PretrainedConfig
,
*
,
num_dummy_heads
:
int
=
0
,
prefix
:
str
=
""
,
)
->
None
:
super
().
__init__
()
...
...
@@ -215,7 +216,12 @@ class InternSdpaAttention(nn.Module):
self
.
projection_layer
=
nn
.
Linear
(
self
.
dummy_dim
,
self
.
embed_dim
)
# Use unified MMEncoderAttention with automatic backend selection
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads
,
self
.
head_dim
,
self
.
scale
)
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads
,
self
.
head_dim
,
self
.
scale
,
prefix
=
prefix
,
)
def
forward
(
self
,
x
:
torch
.
Tensor
)
->
torch
.
Tensor
:
"""x shape: (B, N, C)"""
...
...
@@ -313,7 +319,11 @@ class InternS1VisionLayer(nn.Module):
num_dummy_heads
:
int
,
prefix
:
str
=
""
,
):
return
InternSdpaAttention
(
config
,
num_dummy_heads
=
num_dummy_heads
)
return
InternSdpaAttention
(
config
,
num_dummy_heads
=
num_dummy_heads
,
prefix
=
prefix
,
)
def
forward
(
self
,
...
...
vllm/model_executor/models/mllama4.py
View file @
5c4f2dd6
...
...
@@ -254,7 +254,10 @@ class Llama4VisionAttention(nn.Module):
self
.
scaling
=
self
.
head_dim
**-
0.5
self
.
attn
=
MMEncoderAttention
(
self
.
num_local_heads
,
self
.
head_dim
,
self
.
scaling
self
.
num_local_heads
,
self
.
head_dim
,
self
.
scaling
,
prefix
=
prefix
,
)
if
use_data_parallel
:
...
...
vllm/model_executor/models/molmo.py
View file @
5c4f2dd6
...
...
@@ -231,7 +231,11 @@ class MultiHeadDotProductAttention(nn.Module):
self
.
scale
=
self
.
head_dim
**-
0.5
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads
,
self
.
head_dim
,
self
.
scale
,
num_kv_heads
=
self
.
num_kv_heads
self
.
num_heads
,
self
.
head_dim
,
self
.
scale
,
num_kv_heads
=
self
.
num_kv_heads
,
prefix
=
prefix
,
)
def
forward
(
...
...
vllm/model_executor/models/molmo2.py
View file @
5c4f2dd6
...
...
@@ -611,6 +611,7 @@ class ImagePoolingAttention(nn.Module):
self
.
head_dim
,
self
.
scale
,
num_kv_heads
=
self
.
num_kv_heads
,
prefix
=
prefix
,
)
def
forward_sdpa
(
...
...
vllm/model_executor/models/qwen2_5_vl.py
View file @
5c4f2dd6
...
...
@@ -345,6 +345,7 @@ class Qwen2_5_VisionAttention(nn.Module):
num_heads
=
self
.
num_attention_heads_per_partition
,
head_size
=
self
.
hidden_size_per_attention_head
,
scale
=
self
.
hidden_size_per_attention_head
**-
0.5
,
prefix
=
prefix
,
)
self
.
apply_rotary_emb
=
ApplyRotaryEmb
(
enforce_enable
=
True
)
...
...
vllm/model_executor/models/qwen2_vl.py
View file @
5c4f2dd6
...
...
@@ -319,6 +319,7 @@ class Qwen2VisionAttention(nn.Module):
num_heads
=
self
.
num_attention_heads_per_partition
,
head_size
=
self
.
hidden_size_per_attention_head
,
scale
=
self
.
hidden_size_per_attention_head
**-
0.5
,
prefix
=
prefix
,
)
self
.
apply_rotary_emb
=
ApplyRotaryEmb
(
enforce_enable
=
True
)
...
...
vllm/model_executor/models/qwen3_omni_moe_thinker.py
View file @
5c4f2dd6
...
...
@@ -194,6 +194,7 @@ class Qwen3OmniMoeAudioAttention(nn.Module):
num_heads
=
self
.
num_local_heads
,
head_size
=
self
.
head_dim
,
scale
=
self
.
scaling
,
prefix
=
prefix
,
)
def
forward
(
...
...
vllm/model_executor/models/step3_vl.py
View file @
5c4f2dd6
...
...
@@ -759,7 +759,12 @@ class Step3VisionAttention(nn.Module):
)
# Use unified MMEncoderAttention with automatic backend selection
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads
,
self
.
head_dim
,
self
.
scale
)
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads
,
self
.
head_dim
,
self
.
scale
,
prefix
=
prefix
,
)
def
forward
(
self
,
...
...
vllm/model_executor/models/step_vl.py
View file @
5c4f2dd6
...
...
@@ -220,7 +220,12 @@ class PerceptionEncoderVisionAttention(nn.Module):
prefix
=
f
"
{
prefix
}
.out_proj"
,
disable_tp
=
use_data_parallel
,
)
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads
,
self
.
head_dim
,
self
.
scale
)
self
.
attn
=
MMEncoderAttention
(
self
.
num_heads
,
self
.
head_dim
,
self
.
scale
,
prefix
=
prefix
,
)
self
.
rope
=
PerceptionEncoderRope2D
(
dim
=
self
.
head_dim
,
max_grid_height
=
max_grid_height
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment