Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 2 additions & 11 deletions tests/ut/models/test_qwen2_5_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand Down
16 changes: 1 addition & 15 deletions vllm_ascend/models/qwen2_5_vl.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand Down
Loading