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
77e6dcbb
Unverified
Commit
77e6dcbb
authored
Mar 04, 2026
by
Shanshan Shen
Committed by
GitHub
Mar 03, 2026
Browse files
[PluggableLayer][MM] Add PluggableLayer for RelPosAttention (#33753)
Signed-off-by:
shen-shanshan
<
467638484@qq.com
>
parent
70c73df6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
docs/design/custom_op.md
docs/design/custom_op.md
+2
-0
vllm/model_executor/models/deepencoder.py
vllm/model_executor/models/deepencoder.py
+6
-1
No files found.
docs/design/custom_op.md
View file @
77e6dcbb
...
...
@@ -54,6 +54,8 @@ For example:
--
8
<--
"vllm/model_executor/layers/attention/mm_encoder_attention.py:mm_encoder_attn"
--
8
<--
"vllm/model_executor/layers/mla.py:multi_head_latent_attention"
--
8
<--
"vllm/model_executor/models/deepencoder.py:rel_pos_attention"
```
**2. Activation:**
...
...
vllm/model_executor/models/deepencoder.py
View file @
77e6dcbb
...
...
@@ -18,6 +18,7 @@ import torch.nn as nn
import
torch.nn.functional
as
F
from
transformers
import
CLIPVisionConfig
from
vllm.model_executor.custom_op
import
PluggableLayer
from
vllm.model_executor.layers.attention
import
MMEncoderAttention
from
vllm.model_executor.layers.conv
import
Conv2dLayer
from
vllm.model_executor.layers.quantization
import
QuantizationConfig
...
...
@@ -263,9 +264,13 @@ class Block(nn.Module):
return
x
class
RelPosAttention
(
nn
.
Module
):
# --8<-- [start:rel_pos_attention]
@
PluggableLayer
.
register
(
"rel_pos_attention"
)
class
RelPosAttention
(
PluggableLayer
):
"""Multi-head Attention block with relative position embeddings."""
# --8<-- [end:rel_pos_attention]
def
__init__
(
self
,
dim
:
int
,
...
...
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