Skip to content

Commit

Permalink
skip accelerate tests (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylesayrs authored Nov 21, 2024
1 parent ff121cc commit 9010372
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/test_quantization/lifecycle/test_apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
apply_quantization_status,
)
from compressed_tensors.quantization.utils import iter_named_leaf_modules
from tests.testing_utils import requires_accelerate
from transformers import AutoModelForCausalLM


Expand Down Expand Up @@ -224,6 +225,7 @@ def get_sample_tinyllama_quant_config(status: str = "frozen"):
return QuantizationConfig.parse_obj(config_dict)


@requires_accelerate()
@pytest.mark.parametrize(
"ignore,should_raise_warning",
[
Expand Down
23 changes: 22 additions & 1 deletion tests/testing_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,29 @@ def compressed_tensors_config_available():
return False


def accelerate_availabe():
try:
import accelerate # noqa: F401

return True

except ImportError:
return False


_is_compressed_tensors_config_available = compressed_tensors_config_available()
_is_accelerate_available = accelerate_availabe()


def requires_hf_quantizer():
return pytest.mark.skipif(
not compressed_tensors_config_available(),
not _is_compressed_tensors_config_available,
reason="requires transformers>=4.45 to support CompressedTensorsHfQuantizer",
)


def requires_accelerate():
return pytest.mark.skipif(
not _is_accelerate_available,
reason="requires accelerate",
)

0 comments on commit 9010372

Please sign in to comment.