39
39
quantize_ ,
40
40
)
41
41
from torchao .quantization .quant_primitives import MappingType
42
- from torchao .utils import (
43
- TORCH_VERSION_AT_LEAST_2_4 ,
44
- TORCH_VERSION_AT_LEAST_2_6 ,
45
- check_cpu_version ,
46
- )
42
+ from torchao .utils import check_cpu_version
47
43
48
44
_DEVICE = torch .device ("cuda" if torch .cuda .is_available () else "cpu" )
49
45
@@ -208,7 +204,6 @@ class TestUnifTorchaoQuantizer(common_utils.TestCase):
208
204
def setUp (self ):
209
205
torch .manual_seed (123 )
210
206
211
- @unittest .skipIf (not TORCH_VERSION_AT_LEAST_2_4 , "Test only enabled for 2.4+" )
212
207
@common_utils .parametrize ("group_size" , [32 , 256 ])
213
208
def test_int4_weight_only (self , group_size : int = 32 ):
214
209
model = M (m = 512 , n = 512 ).to (_DEVICE , dtype = torch .bfloat16 )
@@ -225,7 +220,6 @@ def test_int4_weight_only(self, group_size: int = 32):
225
220
model , m_ref , Int4UnifTorchaoQuantizer (), b , group_size
226
221
)
227
222
228
- @unittest .skipIf (not TORCH_VERSION_AT_LEAST_2_6 , "Test only enabled for 2.6+" )
229
223
@common_utils .parametrize ("b" , [2 , 3 , 4 , 8 ])
230
224
@common_utils .parametrize ("group_size" , [32 , 512 ])
231
225
def test_intx_weight_only (self , b : int = 2 , group_size : int = 32 ):
@@ -243,7 +237,6 @@ def test_intx_weight_only(self, b: int = 2, group_size: int = 32):
243
237
quantizer = UnifTorchaoQuantizer ()
244
238
compare_quantized_models (model , m_ref , quantizer , b , group_size )
245
239
246
- @unittest .skipIf (not TORCH_VERSION_AT_LEAST_2_4 , "Test only enabled for 2.4+" )
247
240
@unittest .skipIf (_DEVICE == "cpu" , "Need GPU available" )
248
241
def test_int4_weight_only_e2e (self , group_size : int = 32 ):
249
242
model = M (m = 512 , n = 512 ).to (torch .bfloat16 ).to (_DEVICE )
@@ -265,7 +258,6 @@ def test_int4_weight_only_e2e(self, group_size: int = 32):
265
258
)
266
259
compare_parq_convert (model , m_ref , optimizer , config )
267
260
268
- @unittest .skipIf (not TORCH_VERSION_AT_LEAST_2_6 , "Test only enabled for 2.6+" )
269
261
@unittest .skipIf (_DEVICE == "cpu" , "Need GPU available" )
270
262
@common_utils .parametrize ("b" , [2 , 3 , 4 , 8 ])
271
263
def test_intx_weight_only_e2e (self , b : int = 2 , group_size : int = 32 ):
@@ -315,7 +307,6 @@ def test_intx_weight_only_parq_equivalent(self, b: int = 2, group_size: int = 32
315
307
torch .testing .assert_close (q , q_ref , atol = 0 , rtol = 0 )
316
308
torch .testing .assert_close (Q , Q_ref , atol = 0 , rtol = 0 )
317
309
318
- @unittest .skipIf (not TORCH_VERSION_AT_LEAST_2_6 , "Test only enabled for 2.6+" )
319
310
@common_utils .parametrize ("b" , [2 , 3 ])
320
311
@common_utils .parametrize ("group_size" , [32 , 512 ])
321
312
def test_intx_weight_only (self , b : int = 2 , group_size : int = 32 ):
@@ -337,7 +328,6 @@ def test_intx_weight_only(self, b: int = 2, group_size: int = 32):
337
328
338
329
compare_quantized_models (model , m_ref , quantizer , b , group_size )
339
330
340
- @unittest .skipIf (not TORCH_VERSION_AT_LEAST_2_6 , "Test only enabled for 2.6+" )
341
331
@unittest .skipIf (_DEVICE == "cpu" , "Need GPU available" )
342
332
@common_utils .parametrize ("b" , [2 , 3 ])
343
333
def test_intx_weight_only_e2e (self , b : int = 2 , group_size : int = 32 ):
@@ -369,7 +359,6 @@ class TestInt8DynamicActivationTorchaoQuantizer(common_utils.TestCase):
369
359
def setUp (self ):
370
360
torch .manual_seed (123 )
371
361
372
- @unittest .skipIf (not TORCH_VERSION_AT_LEAST_2_6 , "Test only enabled for 2.6+" )
373
362
@common_utils .parametrize ("b" , [2 , 3 , 4 , 8 ])
374
363
@common_utils .parametrize ("model_dtype" , [torch .float16 , torch .float32 ])
375
364
@common_utils .parametrize ("group_size" , [32 , 128 ])
0 commit comments