[0.11.0] [Cherry-pick #4058] Fixes Qwen3-Next enable nz accuracy problem (#4056)

### What this PR does / why we need it?
- Fixes Qwen3-Next enable nz accuracy problem

---------

Signed-off-by: wxsIcey <1790571317@qq.com>
Signed-off-by: Icey <1790571317@qq.com>
This commit is contained in:
Icey
2025-11-10 20:56:39 +08:00
committed by GitHub
parent ebd45b6596
commit c5fe179cef
7 changed files with 37 additions and 9 deletions

View File

@@ -1,3 +1,5 @@
from unittest.mock import patch
import pytest
import torch
import torch.nn.functional as F
@@ -365,6 +367,7 @@ class TestAscendQwen2_5_VisionTransformer(PytestBase):
res = attention.pad_qkv_bias(torch.rand((300)))
assert res.shape[0] == 384
@patch('vllm_ascend.utils._ENABLE_NZ', True)
def test_pad_qkv_weight(self, mocker: MockerFixture):
attention = self.init_vision_transformer(mocker)
mocker.patch("torch.nn.Module.__setattr__")
@@ -377,6 +380,7 @@ class TestAscendQwen2_5_VisionTransformer(PytestBase):
res = attention.pad_qkv_weight(torch.rand((300, 300)))
assert res.shape == (384, 300)
@patch('vllm_ascend.utils._ENABLE_NZ', True)
def test_pad_proj_weight(self, mocker: MockerFixture):
attention = self.init_vision_transformer(mocker)
mocker.patch("torch.nn.Module.__setattr__")