5
5
from neural_compressor .torch .algorithms .weight_only .autoround import AutoRoundQuantizer , get_autoround_default_run_fn
6
6
from neural_compressor .torch .quantization import (
7
7
AutoRoundConfig ,
8
- quantize ,
9
- prepare ,
10
8
convert ,
11
- get_default_AutoRound_config
9
+ get_default_AutoRound_config ,
10
+ prepare ,
11
+ quantize ,
12
12
)
13
13
from neural_compressor .torch .utils import logger
14
14
@@ -116,7 +116,7 @@ def test_quantizer(self, gpt_j_model):
116
116
assert "transformer.h.0.attn.k_proj" in q_model .autoround_config .keys ()
117
117
assert "scale" in q_model .autoround_config ["transformer.h.0.attn.k_proj" ].keys ()
118
118
assert torch .float32 == q_model .autoround_config ["transformer.h.0.attn.k_proj" ]["scale_dtype" ]
119
-
119
+
120
120
def test_new_api (self , gpt_j_model ):
121
121
inp = torch .ones ([1 , 10 ], dtype = torch .long )
122
122
@@ -127,7 +127,7 @@ def test_new_api(self, gpt_j_model):
127
127
out1 = gpt_j_model (inp )
128
128
quant_config = get_default_AutoRound_config ()
129
129
logger .info (f"Test AutoRound with config { quant_config } " )
130
-
130
+
131
131
run_fn = get_autoround_default_run_fn
132
132
run_args = (
133
133
tokenizer ,
@@ -147,4 +147,4 @@ def test_new_api(self, gpt_j_model):
147
147
assert torch .allclose (out1 [0 ], out2 [0 ], atol = 1e-1 )
148
148
assert "transformer.h.0.attn.k_proj" in q_model .autoround_config .keys ()
149
149
assert "scale" in q_model .autoround_config ["transformer.h.0.attn.k_proj" ].keys ()
150
- assert torch .float32 == q_model .autoround_config ["transformer.h.0.attn.k_proj" ]["scale_dtype" ]
150
+ assert torch .float32 == q_model .autoround_config ["transformer.h.0.attn.k_proj" ]["scale_dtype" ]
0 commit comments