Skip to content

Commit b3fdd78

Browse files
zhanghw0354zhanghaiwen
andauthored
[Main][Refactor]Change ASCEND_QUATIZATION_METHOD to ASCEND_QUANTIZATION_METHOD (#2517)
### What this PR does / why we need it? The constant ASCEND_QUATIZATION_METHOD in vllm_ascend/utils.py is misspelled and should be corrected to ASCEND_QUANTIZATION_METHOD. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? CI passed with new added/existing test. - vLLM version: v0.10.1.1 - vLLM main: vllm-project/vllm@c9abb10 Signed-off-by: zhanghaiwen <[email protected]> Co-authored-by: zhanghaiwen <[email protected]>
1 parent 21b5727 commit b3fdd78

File tree

5 files changed

+16
-17
lines changed

5 files changed

+16
-17
lines changed

tests/ut/quantization/test_quant_config.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
from tests.ut.base import TestBase
1111
from vllm_ascend.quantization.quant_config import (AscendKVCacheMethod,
1212
AscendQuantConfig)
13-
14-
ASCEND_QUATIZATION_METHOD = "ascend"
13+
from vllm_ascend.utils import ASCEND_QUANTIZATION_METHOD
1514

1615

1716
class TestAscendQuantConfig(TestBase):
@@ -42,7 +41,7 @@ def test_repr(self):
4241

4342
def test_get_name(self):
4443
self.assertEqual(AscendQuantConfig.get_name(),
45-
ASCEND_QUATIZATION_METHOD)
44+
ASCEND_QUANTIZATION_METHOD)
4645

4746
def test_get_supported_act_dtypes(self):
4847
supported_dtypes = AscendQuantConfig.get_supported_act_dtypes()
@@ -66,7 +65,7 @@ def test_override_quantization_method(self, mock_is_available):
6665
# Test when NPU is available
6766
mock_is_available.return_value = True
6867
result = AscendQuantConfig.override_quantization_method(None, None)
69-
self.assertEqual(result, ASCEND_QUATIZATION_METHOD)
68+
self.assertEqual(result, ASCEND_QUANTIZATION_METHOD)
7069

7170
# Test when NPU is not available
7271
mock_is_available.return_value = False

tests/ut/test_platform.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from tests.ut.base import TestBase
1414
from vllm_ascend.platform import NPUPlatform
15-
from vllm_ascend.utils import ASCEND_QUATIZATION_METHOD
15+
from vllm_ascend.utils import ASCEND_QUANTIZATION_METHOD
1616

1717

1818
class TestNPUPlatform(TestBase):
@@ -43,7 +43,7 @@ def test_class_variables(self):
4343
"ASCEND_RT_VISIBLE_DEVICES")
4444
self.assertEqual(NPUPlatform.dispatch_key, "PrivateUse1")
4545
self.assertEqual(NPUPlatform.supported_quantization,
46-
[ASCEND_QUATIZATION_METHOD])
46+
[ASCEND_QUANTIZATION_METHOD])
4747

4848
def test_is_sleep_mode_available(self):
4949
self.assertTrue(self.platform.is_sleep_mode_available())
@@ -61,7 +61,7 @@ def test_pre_register_and_update_with_parser(self, mock_quant_config,
6161

6262
mock_adapt_patch.assert_called_once_with(is_global_patch=True)
6363

64-
self.assertTrue(ASCEND_QUATIZATION_METHOD in mock_action.choices)
64+
self.assertTrue(ASCEND_QUANTIZATION_METHOD in mock_action.choices)
6565
self.assertEqual(len(mock_action.choices), 3) # original 2 + ascend
6666

6767
@patch("vllm_ascend.utils.adapt_patch")
@@ -89,7 +89,7 @@ def test_pre_register_and_update_with_existing_ascend_quant(
8989
self, mock_quant_config, mock_adapt_patch):
9090
mock_parser = MagicMock()
9191
mock_action = MagicMock()
92-
mock_action.choices = ["awq", ASCEND_QUATIZATION_METHOD]
92+
mock_action.choices = ["awq", ASCEND_QUANTIZATION_METHOD]
9393
mock_parser._option_string_actions = {"--quantization": mock_action}
9494

9595
self.platform.pre_register_and_update(mock_parser)

vllm_ascend/platform.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
from vllm_ascend.ascend_config import (check_ascend_config, get_ascend_config,
3030
init_ascend_config)
31-
from vllm_ascend.utils import (ASCEND_QUATIZATION_METHOD, is_310p,
31+
from vllm_ascend.utils import (ASCEND_QUANTIZATION_METHOD, is_310p,
3232
update_aclgraph_sizes)
3333

3434
if TYPE_CHECKING:
@@ -50,7 +50,7 @@ class NPUPlatform(Platform):
5050
device_control_env_var: str = "ASCEND_RT_VISIBLE_DEVICES"
5151
dispatch_key: str = "PrivateUse1"
5252

53-
supported_quantization: list[str] = [ASCEND_QUATIZATION_METHOD]
53+
supported_quantization: list[str] = [ASCEND_QUANTIZATION_METHOD]
5454

5555
def is_sleep_mode_available(self) -> bool:
5656
return True
@@ -70,8 +70,8 @@ def pre_register_and_update(cls,
7070
quant_action = parser._option_string_actions.get('--quantization')
7171
if quant_action and hasattr(quant_action,
7272
'choices') and quant_action.choices:
73-
if ASCEND_QUATIZATION_METHOD not in quant_action.choices:
74-
quant_action.choices.append(ASCEND_QUATIZATION_METHOD)
73+
if ASCEND_QUANTIZATION_METHOD not in quant_action.choices:
74+
quant_action.choices.append(ASCEND_QUANTIZATION_METHOD)
7575

7676
from vllm_ascend.quantization.quant_config import \
7777
AscendQuantConfig # noqa: F401

vllm_ascend/quantization/quant_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
from vllm.model_executor.utils import set_weight_attrs
3737

3838
from vllm_ascend.ops.fused_moe import AscendUnquantizedFusedMoEMethod
39-
from vllm_ascend.utils import ASCEND_QUATIZATION_METHOD
39+
from vllm_ascend.utils import ASCEND_QUANTIZATION_METHOD
4040

4141
from .quantizer import AscendQuantizer
4242

4343

44-
@register_quantization_config(ASCEND_QUATIZATION_METHOD)
44+
@register_quantization_config(ASCEND_QUANTIZATION_METHOD)
4545
class AscendQuantConfig(QuantizationConfig):
4646
"""Config class for Ascend
4747
@@ -57,7 +57,7 @@ def __repr__(self) -> str:
5757

5858
@classmethod
5959
def get_name(cls) -> str:
60-
return ASCEND_QUATIZATION_METHOD
60+
return ASCEND_QUANTIZATION_METHOD
6161

6262
@classmethod
6363
def get_supported_act_dtypes(cls) -> List[torch.dtype]:
@@ -80,7 +80,7 @@ def from_config(cls, config: Dict[str, Any]) -> "AscendQuantConfig":
8080
def override_quantization_method(cls, hf_quant_cfg,
8181
user_quant) -> Optional[str]:
8282
if torch.npu.is_available():
83-
return ASCEND_QUATIZATION_METHOD
83+
return ASCEND_QUANTIZATION_METHOD
8484
return None
8585

8686
def get_quant_method(self, layer: torch.nn.Module,

vllm_ascend/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
# Maximum number of graphs that can be captured by ACL Graph
4646
MAX_CAPTURE_SIZE = 1920
4747

48-
ASCEND_QUATIZATION_METHOD = "ascend"
48+
ASCEND_QUANTIZATION_METHOD = "ascend"
4949
SOC_VERSION_INFERENCE_SERIES = ["Ascend310P3"]
5050

5151
ACL_FORMAT_FRACTAL_ND = 2

0 commit comments

Comments
 (0)