Skip to content

Commit cfabd6d

Browse files
authored
Lint fixes test/quantization (#1359)
1 parent 22bec74 commit cfabd6d

File tree

6 files changed

+793
-384
lines changed

6 files changed

+793
-384
lines changed

ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ include = [
99
"torchao/sparsity/**/*.py",
1010
"torchao/prototype/low_bit_optim/**.py",
1111
"test/float8/**/*.py",
12-
"test/quantization/test_observer.py",
12+
"test/quantization/**/*.py",
1313
"test/dtypes/**/*.py",
1414
"test/prototype/low_bit_optim/**.py",
1515
"torchao/utils.py",

test/quantization/test_galore_quant.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
import pytest
44

55
# Skip entire test if triton is not available, otherwise CI failure
6-
try:
7-
import triton
8-
except ImportError:
9-
pytest.skip("triton is not installed", allow_module_level=True)
10-
11-
from bitsandbytes.functional import create_dynamic_map, quantize_blockwise, dequantize_blockwise
6+
try: # noqa: F401
7+
import triton # noqa: F401
8+
except ImportError: # noqa: F401
9+
pytest.skip("triton is not installed", allow_module_level=True) # noqa: F401
1210
import torch
11+
from bitsandbytes.functional import (
12+
create_dynamic_map,
13+
dequantize_blockwise,
14+
quantize_blockwise,
15+
)
1316

1417
from torchao.prototype.galore.kernels import (
1518
triton_dequant_blockwise,

test/quantization/test_marlin_qqq.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import copy
2+
import unittest
23

34
import pytest
45
import torch
@@ -19,9 +20,12 @@
1920
choose_qparams_and_quantize_affine_qqq,
2021
)
2122
from torchao.utils import TORCH_VERSION_AT_LEAST_2_5, is_fbcode
22-
import unittest
2323

24-
@unittest.skipIf(is_fbcode(), "Skipping the test in fbcode since we don't have TARGET file for kernels")
24+
25+
@unittest.skipIf(
26+
is_fbcode(),
27+
"Skipping the test in fbcode since we don't have TARGET file for kernels",
28+
)
2529
class TestMarlinQQQ(TestCase):
2630
def setUp(self):
2731
super().setUp()

0 commit comments

Comments
 (0)