Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip accelerate tests #208

Merged
merged 1 commit into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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",
)
Loading