From c0cd77b004055f3c63ff87b92e72933cce050520 Mon Sep 17 00:00:00 2001 From: Nikita Savelyev Date: Wed, 27 Mar 2024 10:23:24 +0100 Subject: [PATCH] Added cuda test skipping in case it is run on a CPU-only machine --- tests/torch/ptq/test_weights_compression.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/torch/ptq/test_weights_compression.py b/tests/torch/ptq/test_weights_compression.py index a0056d09e5f..ba64f1341b8 100644 --- a/tests/torch/ptq/test_weights_compression.py +++ b/tests/torch/ptq/test_weights_compression.py @@ -246,6 +246,8 @@ def test_get_dtype_attribute_of_parameter(): @pytest.mark.parametrize("device", ("cpu", "cuda")) @pytest.mark.parametrize("dtype", ("float16", "float32")) def test_model_devices_and_precisions(device, dtype): + if device == "cuda" and not torch.cuda.is_available(): + pytest.skip("Skipping for CPU-only setups") device = torch.device(device) dtype = torch.float16 if dtype == "float16" else torch.float32