[Feat][BugFix]Support the Qwen3-Next-80B-A3B-Instruct quantization model&Fix the NZ issue (#4245)

### What this PR does / why we need it?
Support the Qwen3-Next-80B-A3B-Instruct quantization model and Fix the
NZ issue. Triton kernel doesn't support data format nz, thus we skip
converting weight to nz on layer `conv1d`

- vLLM version: v0.11.0
- vLLM main:
2918c1b49c

---------

Signed-off-by: IncSec <1790766300@qq.com>
This commit is contained in:
InSec
2025-11-21 10:42:56 +08:00
committed by GitHub
parent cbb27feaf2
commit 5a4e8cdeba
10 changed files with 39 additions and 30 deletions

View File

@@ -797,7 +797,6 @@ class TestAscendMLAImpl(TestBase):
self.assertEqual(q_pe.shape[1], self.impl.num_heads)
self.assertEqual(q_pe.shape[2], self.impl.qk_rope_head_dim)
@patch('vllm_ascend.utils._ENABLE_NZ', True)
@patch('torch_npu.npu_format_cast')
def test_process_weights_after_loading(self, mock_format_cast):
layer = MagicMock(spec=LinearBase)

View File

@@ -1,5 +1,3 @@
from unittest.mock import patch
import pytest
import torch
import torch.nn.functional as F
@@ -367,7 +365,6 @@ 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__")
@@ -380,7 +377,6 @@ 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__")

View File

@@ -260,7 +260,6 @@ class TestAscendW4A8DynamicFusedMoEMethod(TestBase):
requires_grad=False)
return layer
@patch('vllm_ascend.utils._ENABLE_NZ', False)
@patch('torch_npu.npu_format_cast')
@patch('torch_npu.npu_quantize')
@patch('torch.Tensor.npu')

View File

@@ -46,18 +46,12 @@ class TestUtils(TestBase):
self.assertFalse(utils.is_310p())
def test_is_enable_nz(self):
# Case when _ENABLE_NZ is already set
utils._ENABLE_NZ = True
self.assertTrue(utils.is_enable_nz())
utils._ENABLE_NZ = False
self.assertFalse(utils.is_enable_nz())
# Case when _ENABLE_NZ is None and vllm_config is not provided
utils._ENABLE_NZ = None
with self.assertRaises(ValueError) as context:
utils.is_enable_nz()
self.assertIn("vllm_config must be provided", str(context.exception))
with mock.patch("vllm_ascend.utils.envs_ascend.VLLM_ASCEND_ENABLE_NZ",
1):
self.assertTrue(utils.is_enable_nz())
with mock.patch("vllm_ascend.utils.envs_ascend.VLLM_ASCEND_ENABLE_NZ",
0):
self.assertFalse(utils.is_enable_nz())
def test_sleep_mode_enabled(self):
utils._SLEEP_MODE_ENABLED = None

View File

@@ -281,9 +281,9 @@ class TestNPUWorker(TestBase):
self.assertIn("Sleep mode is not enabled", str(cm.exception))
@patch('vllm_ascend.utils._ENABLE_NZ', False)
@patch("vllm_ascend.worker.worker_v1.sleep_mode_enabled")
@patch("vllm_ascend.worker.worker_v1.CaMemAllocator")
@patch.dict("os.environ", {"VLLM_ASCEND_ENABLE_NZ": "0"})
def test_wake_up_mode_enabled(self, mock_allocator_class,
mock_sleep_mode_enabled):
"""Test wake_up method when sleep mode is enabled"""