[Models] Replace all nn.Conv2d with vLLM's Conv2dLayer (#28842)

Signed-off-by: Isotr0py <mozf@mail2.sysu.edu.cn>
This commit is contained in:
Isotr0py
2025-11-19 02:56:04 +08:00
committed by GitHub
parent c64c0b78de
commit e4bb2684bc
20 changed files with 83 additions and 45 deletions

View File

@@ -24,6 +24,7 @@ from vllm.config import VllmConfig
from vllm.config.multimodal import BaseDummyOptions
from vllm.distributed import get_tensor_model_parallel_world_size
from vllm.model_executor.layers.activation import SiluAndMul, get_act_fn
from vllm.model_executor.layers.conv import Conv2dLayer
from vllm.model_executor.layers.linear import (
ColumnParallelLinear,
MergedColumnParallelLinear,
@@ -78,7 +79,7 @@ class GLMVImagePixelInputs(TensorSchema):
class EVA2CLIPPatchEmbedding(nn.Module):
def __init__(self, config):
super().__init__()
self.proj = nn.Conv2d(
self.proj = Conv2dLayer(
config.in_channels,
config.hidden_size,
kernel_size=config.patch_size,
@@ -333,7 +334,7 @@ class EVA2CLIPModel(nn.Module):
quant_config=quant_config,
prefix=f"{prefix}.linear_proj",
)
self.conv = nn.Conv2d(
self.conv = Conv2dLayer(
in_channels=vision_config.hidden_size,
out_channels=config.hidden_size,
kernel_size=2,