diff --git a/tests/ut/models/test_qwen2_5_vl.py b/tests/ut/models/test_qwen2_5_vl.py index b4f06803706..4a8bcba580a 100644 --- a/tests/ut/models/test_qwen2_5_vl.py +++ b/tests/ut/models/test_qwen2_5_vl.py @@ -8,8 +8,8 @@ from tests.ut.base import PytestBase from vllm_ascend.models.qwen2_5_vl import ( AscendQwen2_5_VisionAttention, AscendQwen2_5_VisionBlock, - AscendQwen2_5_VisionPatchEmbed, AscendQwen2_5_VisionRotaryEmbedding, - AscendQwen2_5_VisionTransformer, AscendQwen2_5_VLForConditionalGeneration) + AscendQwen2_5_VisionRotaryEmbedding, AscendQwen2_5_VisionTransformer, + AscendQwen2_5_VLForConditionalGeneration) class TestAscendQwen2_5_VisionAttention(PytestBase): @@ -215,15 +215,6 @@ def test_vision_block_forward(self, mocker: MockerFixture): assert torch.all(x * 3 == output) -class TestAscendQwen2_5_VisionPatchEmbed(PytestBase): - - def test_forward(self): - patch_embed = AscendQwen2_5_VisionPatchEmbed() - - ret = patch_embed(torch.rand((120, 1176))) - assert ret.shape == (120, 1152) - - class TestAscendQwen2_5_VisionRotaryEmbedding(PytestBase): def init_rotary_embedding( diff --git a/vllm_ascend/models/qwen2_5_vl.py b/vllm_ascend/models/qwen2_5_vl.py index 6f07afdc61d..321a12a56fd 100644 --- a/vllm_ascend/models/qwen2_5_vl.py +++ b/vllm_ascend/models/qwen2_5_vl.py @@ -46,9 +46,6 @@ from vllm_ascend.utils import (ACL_FORMAT_FRACTAL_ND, is_enable_nz, vllm_version_is) -if not vllm_version_is("0.11.0"): - from vllm.model_executor.models.vision import conv3d_to_linear_weight - MIN_PAD_SIZE = 64 # min_size to pad weight MAX_PAD_SIZE = 128 # max_size to pad weight @@ -164,14 +161,6 @@ def forward(self, x: torch.Tensor, cu_seqlens: torch.Tensor, return x -class AscendQwen2_5_VisionPatchEmbed(Qwen2_5_VisionPatchEmbed): - - def forward(self, x: torch.Tensor) -> torch.Tensor: - x = x.matmul( - self.proj.weight.data.view(self.hidden_size, -1).transpose(0, 1)) - return x - - class AscendQwen2_5_VisionRotaryEmbedding(Qwen2_5_VisionRotaryEmbedding): def __init__(self, dim: int, theta: float = 10000.0) -> None: @@ -198,7 +187,7 @@ def __init__( head_dim = self.hidden_size // self.num_heads self.rotary_pos_emb = AscendQwen2_5_VisionRotaryEmbedding(head_dim // 2) - self.patch_embed = AscendQwen2_5_VisionPatchEmbed( + self.patch_embed = Qwen2_5_VisionPatchEmbed( patch_size=vision_config.patch_size, temporal_patch_size=vision_config.temporal_patch_size, in_channels=vision_config.in_channels, @@ -360,9 +349,6 @@ def load_weights(self, weights: Iterable[Tuple[str, params_dict = dict(self.named_parameters(remove_duplicate=False)) loaded_params: Set[str] = set() for name, loaded_weight in weights: - if not vllm_version_is("0.11.0"): - if name.endswith("patch_embed.proj.weight"): - loaded_weight = conv3d_to_linear_weight(loaded_weight) for (param_name, weight_name, shard_id) in stacked_params_mapping: if weight_name not in name: continue