Skip to content

Commit c3c2b2f

Browse files
committed
fix lint
Signed-off-by: yyt <yangyit139@gmail.com>
1 parent 07f99cb commit c3c2b2f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

tests/ut/quantization/test_w8a16.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import unittest
21
from unittest.mock import MagicMock, patch
32

43
import torch
@@ -38,7 +37,8 @@ def test_apply_with_x_is_int8(self, mock_npu_weight_quant_batchmatmul):
3837
@patch('vllm_ascend.utils.get_ascend_device_type',
3938
return_value=AscendDeviceType._310P)
4039
@patch("torch_npu.npu_weight_quant_batchmatmul")
41-
def test_apply_with_x_is_310p(self, mock_npu_weight_quant_batchmatmul, mock_soc_version):
40+
def test_apply_with_x_is_310p(self, mock_npu_weight_quant_batchmatmul,
41+
mock_soc_version):
4242
layer = MagicMock()
4343
layer.weight.data = torch.randn(128, 256)
4444
layer.weight_scale.data = torch.randn(128, 1)
@@ -87,4 +87,4 @@ def test_process_weights_after_loading_nz(self, mock_npu_format_cast,
8787

8888
self.assertEqual(layer.weight_scale.data.shape, (128, ))
8989
self.assertEqual(layer.weight_offset.data.shape, (128, ))
90-
mock_npu_format_cast.assert_called_once()
90+
mock_npu_format_cast.assert_called_once()

vllm_ascend/quantization/w8a16.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919

2020
import torch
2121
import torch_npu
22-
from vllm_ascend.utils import ACL_FORMAT_FRACTAL_NZ, AscendDeviceType, get_ascend_device_type, is_enable_nz
22+
from vllm_ascend.utils import (ACL_FORMAT_FRACTAL_NZ, AscendDeviceType,
23+
get_ascend_device_type, is_enable_nz)
2324

2425

2526
class AscendW8A16LinearMethod:
@@ -29,7 +30,8 @@ class AscendW8A16LinearMethod:
2930

3031
def __init__(self) -> None:
3132
# aclnn quant matmul requires to transpose matrix B, set to true by default.
32-
self.transpose_weight = get_ascend_device_type() != AscendDeviceType._310P
33+
self.transpose_weight = get_ascend_device_type(
34+
) != AscendDeviceType._310P
3335

3436
@staticmethod
3537
def get_weight(
@@ -82,16 +84,14 @@ def apply(
8284
weight=layer.weight.data.transpose(0, 1),
8385
antiquant_scale=layer.weight_scale,
8486
antiquant_offset=layer.weight_offset,
85-
bias=bias
86-
)
87+
bias=bias)
8788
else:
8889
output = torch_npu.npu_weight_quant_batchmatmul(
8990
x=x,
9091
weight=layer.weight,
9192
antiquant_scale=layer.weight_scale,
9293
antiquant_offset=layer.weight_offset,
93-
bias=bias
94-
)
94+
bias=bias)
9595
return output
9696

9797
def process_weights_after_loading(self, layer):

0 commit comments

Comments
 (0)