[PluggableLayer][MM] Add PluggableLayer for CustomQwen2Decoder (#37293)

Signed-off-by: Wangbei25 <wangbei41@huawie.com>
Signed-off-by: Wangbei25 <wangbei41@huawei.com>
Co-authored-by: Wangbei25 <wangbei41@huawie.com>
This commit is contained in:
Wangbei25
2026-03-20 06:24:07 +00:00
committed by GitHub
co-authored by Wangbei25
parent 30108fc8b0
commit 0674d1fee7
2 changed files with 17 additions and 4 deletions
+7 -1
View File
@@ -14,14 +14,20 @@ import torch
import torch.nn as nn
import transformers
from vllm.model_executor.custom_op import PluggableLayer
class CustomQwen2Decoder(nn.Module):
# --8<-- [start:qwen2_decoder]
@PluggableLayer.register("qwen2_decoder")
class CustomQwen2Decoder(PluggableLayer):
"""
Qwen2 visual encoder
non-causal attention + causal attention
token_type_ids :0=non-causal, 1=causal
"""
# --8<-- [end:qwen2_decoder]
def __init__(
self,
decoder_layer: int = 24,