1414# limitations under the License.
1515
1616import gc
17- import importlib .metadata
1817import tempfile
1918import unittest
2019from typing import List
2120
2221import numpy as np
23- from packaging import version
2422from parameterized import parameterized
2523from transformers import AutoTokenizer , CLIPTextModel , CLIPTokenizer , T5EncoderModel
2624
@@ -82,18 +80,17 @@ def _is_xpu_or_cuda_capability_atleast_8_9() -> bool:
8280 Float8WeightOnlyConfig ,
8381 Int4WeightOnlyConfig ,
8482 Int8DynamicActivationInt8WeightConfig ,
83+ Int8DynamicActivationIntxWeightConfig ,
8584 Int8WeightOnlyConfig ,
85+ IntxWeightOnlyConfig ,
8686 )
8787 from torchao .quantization .linear_activation_quantized_tensor import LinearActivationQuantizedTensor
8888 from torchao .utils import get_model_size_in_bytes
8989
90- if version .parse (importlib .metadata .version ("torchao" )) >= version .Version ("0.10.0" ):
91- from torchao .quantization import Int8DynamicActivationIntxWeightConfig , IntxWeightOnlyConfig
92-
9390
9491@require_torch
9592@require_torch_accelerator
96- @require_torchao_version_greater_or_equal ("0.14 .0" )
93+ @require_torchao_version_greater_or_equal ("0.15 .0" )
9794class TorchAoConfigTest (unittest .TestCase ):
9895 def test_to_dict (self ):
9996 """
@@ -128,7 +125,7 @@ def test_repr(self):
128125# Slices for these tests have been obtained on our aws-g6e-xlarge-plus runners
129126@require_torch
130127@require_torch_accelerator
131- @require_torchao_version_greater_or_equal ("0.14 .0" )
128+ @require_torchao_version_greater_or_equal ("0.15 .0" )
132129class TorchAoTest (unittest .TestCase ):
133130 def tearDown (self ):
134131 gc .collect ()
@@ -527,7 +524,7 @@ def test_sequential_cpu_offload(self):
527524 inputs = self .get_dummy_inputs (torch_device )
528525 _ = pipe (** inputs )
529526
530- @require_torchao_version_greater_or_equal ("0.9 .0" )
527+ @require_torchao_version_greater_or_equal ("0.15 .0" )
531528 def test_aobase_config (self ):
532529 quantization_config = TorchAoConfig (Int8WeightOnlyConfig ())
533530 components = self .get_dummy_components (quantization_config )
@@ -540,7 +537,7 @@ def test_aobase_config(self):
540537# Slices for these tests have been obtained on our aws-g6e-xlarge-plus runners
541538@require_torch
542539@require_torch_accelerator
543- @require_torchao_version_greater_or_equal ("0.14 .0" )
540+ @require_torchao_version_greater_or_equal ("0.15 .0" )
544541class TorchAoSerializationTest (unittest .TestCase ):
545542 model_name = "hf-internal-testing/tiny-flux-pipe"
546543
@@ -650,7 +647,7 @@ def test_aobase_config(self):
650647 self ._check_serialization_expected_slice (quant_type , expected_slice , device )
651648
652649
653- @require_torchao_version_greater_or_equal ("0.14 .0" )
650+ @require_torchao_version_greater_or_equal ("0.15 .0" )
654651class TorchAoCompileTest (QuantCompileTests , unittest .TestCase ):
655652 @property
656653 def quantization_config (self ):
@@ -696,7 +693,7 @@ def test_torch_compile_with_group_offload_leaf(self, use_stream):
696693# Slices for these tests have been obtained on our aws-g6e-xlarge-plus runners
697694@require_torch
698695@require_torch_accelerator
699- @require_torchao_version_greater_or_equal ("0.14 .0" )
696+ @require_torchao_version_greater_or_equal ("0.15 .0" )
700697@slow
701698@nightly
702699class SlowTorchAoTests (unittest .TestCase ):
@@ -854,7 +851,7 @@ def test_memory_footprint_int8wo(self):
854851
855852@require_torch
856853@require_torch_accelerator
857- @require_torchao_version_greater_or_equal ("0.14 .0" )
854+ @require_torchao_version_greater_or_equal ("0.15 .0" )
858855@slow
859856@nightly
860857class SlowTorchAoPreserializedModelTests (unittest .TestCase ):
0 commit comments