🐍 Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
[speed up CI tests suite] Skip slow tests as default (#2587)
João Gustavo A. Amorim84478d535d3b
diff --git a/.github/workflows/pr_test_cpu.yml b/.github/workflows/pr_test_cpu.ymlindex c140752f0..f71461ac6 100644--- a/.github/workflows/pr_test_cpu.yml+++ b/.github/workflows/pr_test_cpu.yml@@ -14,34 +14,34 @@ concurrency:jobs:tests-cpu:+ # This job run just tests not marked as slow, and desselect the dynamo testsstrategy:- fail-fast: false # TODO: enable it when CI be stable (when drop support to torch 1.9.1)+ fail-fast: truematrix:os: ['Ubuntu-latest', 'Windows-latest', 'MacOS-latest']- uses: ./.github/workflows/tests.yml- with:- os: ${{ matrix.os }}- python-version: '["3.8", "3.10"]'- pytorch-version: '["1.9.1", "2.0.1"]'- pytorch-dtype: 'float32'+ pytorch-dtype: ['float32', 'float64']+ exclude:+ - os: 'Windows-latest'+ pytorch-dtype: 'float64'+ - os: 'MacOS-latest'+ pytorch-dtype: 'float64'- tests-cpu-fp64:- strategy:- fail-fast: trueuses: ./.github/workflows/tests.ymlwith:+ os: ${{ matrix.os }}python-version: '["3.8", "3.10"]'pytorch-version: '["1.9.1", "2.0.1"]'- pytorch-dtype: 'float64'+ pytorch-dtype: ${{ matrix.pytorch-dtype }}tests-coverage:+ # This job run all test suiteuses: ./.github/workflows/tests.ymlwith:python-version: '["3.10"]'pytorch-version: '["2.0.1"]'pytorch-dtype: 'float32,float64'coverage: true- continue-on-error: true+ pytest-extra: '--runslow'test-typing:uses: ./.github/workflows/test_typing.yml@@ -50,7 +50,7 @@ jobs:uses: ./.github/workflows/test_tutorials.ymlcollector:- needs: [tests-cpu, tests-cpu-fp64, test-tutorials, test-typing, tests-coverage]+ needs: [tests-cpu, test-tutorials, test-typing, tests-coverage]if: always()runs-on: ubuntu-lateststeps:diff --git a/.github/workflows/scheduled_test_cpu.yml b/.github/workflows/scheduled_test_cpu.ymlindex 85015f818..3dc384aec 100644--- a/.github/workflows/scheduled_test_cpu.yml+++ b/.github/workflows/scheduled_test_cpu.yml@@ -24,6 +24,9 @@ jobs:python-version: '["3.8", "3.9", "3.10"]'pytorch-version: '["1.9.1", "1.10.2", "1.11.0", "1.12.1", "1.13.1", "2.0.1"]'pytorch-dtype: ${{ matrix.pytorch-dtype }}+ pytest-extra: '--runslow'++tests-cpu-windows:strategy:@@ -63,3 +66,4 @@ jobs:pytorch-dtype: 'float32,float64'coverage: truecontinue-on-error: true+ pytest-extra: '--runslow'diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.ymlindex ebbec227e..b5c13e4cf 100644--- a/.github/workflows/tests.yml+++ b/.github/workflows/tests.yml@@ -20,7 +20,7 @@ on:pytest-extra:required: falsetype: string- default: ''+ default: '--timeout=5 -k "not test_dynamo"'continue-on-error:required: falsetype: booleandiff --git a/conftest.py b/conftest.pyindex 79614de84..10c6f59bf 100644--- a/conftest.py+++ b/conftest.py@@ -67,7 +67,7 @@ def dtype(dtype_name) -> torch.dtype:@pytest.fixture(scope='session')def torch_optimizer():if hasattr(torch, 'compile') and sys.platform == "linux":- torch.set_float32_matmul_precision('high')+ # torch.set_float32_matmul_precision('high')return torch.compilepytest.skip(f"skipped because {torch.__version__} not have `compile` available! Failed to setup dynamo.")@@ -98,9 +98,49 @@ def pytest_generate_tests(metafunc):metafunc.parametrize('dtype_name', dtype_names)+def pytest_collection_modifyitems(config, items):+ if config.getoption("--runslow"):+ # --runslow given in cli: do not skip slow tests+ return++ skip_slow = pytest.mark.skip(reason="need --runslow option to run")+ for item in items:+ if "slow" in item.keywords:+ item.add_marker(skip_slow)++def pytest_addoption(parser):parser.addoption('--device', action="store", default="cpu")parser.addoption('--dtype', action="store", default="float32")+ parser.addoption("--runslow", action="store_true", default=False, help="run slow tests")+++def _setup_torch_compile():+ if hasattr(torch, 'compile') and sys.platform == "linux":+ print('Setting up torch compile...')+ torch.set_float32_matmul_precision('high')++ def _dummy_function(x, y):+ return (x + y).sum()++ class _dummy_module(torch.nn.Module):+ def __init__(self):+ super().__init__()++ def forward(self, x):+ return (x**2).sum()++ torch.compile(_dummy_function)+ torch.compile(_dummy_module())+++def pytest_sessionstart(session):+ try:+ _setup_torch_compile()+ except RuntimeError as ex:+ if 'not yet supported for torch.compile' not in str(ex):+ raise ex+ # TODO: cache all torch.load weights/states here to not impact on test suite@pytest.fixture(autouse=True)diff --git a/pyproject.toml b/pyproject.tomlindex f5be57606..cb5cd7df0 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -169,7 +169,8 @@ requires = [markers =["grad: mark a test as gradcheck test","jit: mark a test as torchscript test",- "nn: mark a test as module test"+ "nn: mark a test as module test",+ "slow: mark test as slow to run",][tool.coverage.run]diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txtindex 4b02eabcf..6feaac131 100644--- a/requirements/requirements-dev.txt+++ b/requirements/requirements-dev.txt@@ -7,4 +7,5 @@ opencv-pythonpre-commit>=2pydocstylepytest==7.4.2+pytest-timeoutscipydiff --git a/test/augmentation/test_augmentation.py b/test/augmentation/test_augmentation.pyindex 852b2364b..66294d44a 100644--- a/test/augmentation/test_augmentation.py+++ b/test/augmentation/test_augmentation.py@@ -135,6 +135,7 @@ class CommonTests(BaseTester):def test_module(self):self._test_module_implementation(params=self._default_param_set)+ @pytest.mark.slowdef test_gradcheck(self):self._test_gradcheck_implementation(params=self._default_param_set)@@ -279,6 +280,7 @@ class CommonTests(BaseTester):self.assert_close(output_values, input_values, low_tolerance=True)+ @pytest.mark.slowdef _test_gradcheck_implementation(self, params):input_tensor = torch.rand((3, 5, 5), device=self.device, dtype=self.dtype) # 3 x 3input_tensor = utils.tensor_to_gradcheck_var(input_tensor) # to var@@ -837,6 +839,7 @@ class TestRandomHorizontalFlip:input[..., input_coordinates[0, 1, :], input_coordinates[0, 0, :]],)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):input = torch.rand((3, 3), device=device, dtype=dtype) # 3 x 3input = utils.tensor_to_gradcheck_var(input) # to var@@ -1299,6 +1302,7 @@ class TestColorJiggle(BaseTester):self.assert_close(f(input), expected, low_tolerance=True)self.assert_close(f.transform_matrix, expected_transform, low_tolerance=True)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):input = torch.rand((3, 5, 5), device=device, dtype=dtype).unsqueeze(0) # 3 x 3input = utils.tensor_to_gradcheck_var(input) # to var@@ -1626,6 +1630,7 @@ class TestColorJitter(BaseTester):self.assert_close(f(input), expected)self.assert_close(f.transform_matrix, expected_transform)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):input = torch.rand((3, 5, 5), device=device, dtype=dtype).unsqueeze(0) # 3 x 3input = utils.tensor_to_gradcheck_var(input) # to var@@ -1729,6 +1734,7 @@ class TestRandomBrightness(BaseTester):self.assert_close(f(input), expected, low_tolerance=True)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):input = torch.rand((3, 5, 5), device=device, dtype=dtype).unsqueeze(0) # 3 x 3input = utils.tensor_to_gradcheck_var(input) # to var@@ -1830,6 +1836,7 @@ class TestRandomContrast(BaseTester):self.assert_close(f(input), expected, low_tolerance=True)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):input = torch.rand((3, 5, 5), device=device, dtype=dtype).unsqueeze(0) # 3 x 3input = utils.tensor_to_gradcheck_var(input) # to var@@ -1939,6 +1946,7 @@ class TestRandomHue(BaseTester):self.assert_close(f(input), expected, low_tolerance=True)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):input = torch.rand((3, 5, 5), device=device, dtype=dtype).unsqueeze(0) # 3 x 3input = utils.tensor_to_gradcheck_var(input) # to var@@ -2048,6 +2056,7 @@ class TestRandomSaturation(BaseTester):self.assert_close(f(input), expected, low_tolerance=True)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):input = torch.rand((3, 5, 5), device=device, dtype=dtype).unsqueeze(0) # 3 x 3input = utils.tensor_to_gradcheck_var(input) # to var@@ -2096,6 +2105,7 @@ class TestRectangleRandomErasing(BaseTester):res = f(input)assert_close(res[0], res[1])+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):# test parametersbatch_shape = (2, 3, 11, 7)@@ -2234,6 +2244,7 @@ class TestRandomGamma(BaseTester):self.assert_close(f(input), expected, low_tolerance=True)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):input = torch.rand((3, 5, 5), device=device, dtype=dtype).unsqueeze(0) # 3 x 3input = utils.tensor_to_gradcheck_var(input) # to var@@ -2491,6 +2502,7 @@ class TestRandomGrayscale(BaseTester):self.assert_close(f(input), expected)self.assert_close(f.transform_matrix, expected_transform)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):input = torch.rand((3, 5, 5), device=device, dtype=dtype) # 3 x 3input = utils.tensor_to_gradcheck_var(input) # to var@@ -2556,6 +2568,7 @@ class TestCenterCrop(BaseTester):self.assert_close(out, op2(img, op1._params))+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):input = torch.rand(1, 2, 3, 4, device=device, dtype=dtype)input = utils.tensor_to_gradcheck_var(input) # to var@@ -2724,6 +2737,7 @@ class TestRandomRotation(BaseTester):self.assert_close(out, expected, low_tolerance=True)self.assert_close(f.transform_matrix, expected_transform, low_tolerance=True)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):torch.manual_seed(0) # for random reproductibility@@ -2998,6 +3012,7 @@ class TestRandomCrop(BaseTester):self.assert_close(out, op2(img, op1._params))+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):torch.manual_seed(0) # for random reproductibilityinp = torch.rand((3, 3, 3), device=device, dtype=dtype) # 3 x 3@@ -3191,6 +3206,7 @@ class TestRandomResizedCrop(BaseTester):self.assert_close(out, op2(img, op1._params))+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):torch.manual_seed(0) # for random reproductibilityinp = torch.rand((1, 3, 3), device=device, dtype=dtype) # 3 x 3@@ -3316,6 +3332,7 @@ class TestRandomEqualize(BaseTester):res = f(input)assert_close(res[0], res[1])+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):torch.manual_seed(0) # for random reproductibility@@ -3379,6 +3396,7 @@ class TestRandomGaussianBlur(BaseTester):actual = aug(input)self.assert_close(actual, actual)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):torch.manual_seed(0)@@ -3570,6 +3588,7 @@ class TestNormalize(BaseTester):self.assert_close(f1(inputs), inputs)self.assert_close(f1.transform_matrix, identity)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):torch.manual_seed(0) # for random reproductibility@@ -3638,6 +3657,7 @@ class TestDenormalize(BaseTester):self.assert_close(f1(inputs), inputs)self.assert_close(f1.transform_matrix, identity)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):torch.manual_seed(0) # for random reproductibility@@ -4132,6 +4152,7 @@ class TestRandomTranslate:assert aug.inverse(out).shape == x_data.shapeassert aug.inverse(out, aug._params).shape == x_data.shape+ @pytest.mark.slowdef test_gradcheck(self, device):input = torch.rand(1, 2, 5, 7).to(device)input = utils.tensor_to_gradcheck_var(input) # to var@@ -4150,6 +4171,7 @@ class TestRandomAutoContrast:out = aug(x_data)assert out.shape == x_data.shape+ @pytest.mark.slowdef test_gradcheck(self, device):input = torch.rand(1, 2, 5, 7).to(device)input = utils.tensor_to_gradcheck_var(input) # to var@@ -4190,6 +4212,7 @@ class TestRandomSnow(BaseTester):output_data = aug(input_data)assert output_data.shape == input_data.shape+ @pytest.mark.slowdef test_gradcheck(self, device):input_data = torch.rand(1, 3, 6, 8, device=device)grad_input = utils.tensor_to_gradcheck_var(input_data)@@ -4337,6 +4360,7 @@ class DummyMPDataset(torch.utils.data.Dataset):class TestMultiprocessing:torch.manual_seed(0) # for random reproductibility+ @pytest.mark.slow@pytest.mark.parametrize('context', ['spawn', 'forkserver', 'fork'] if os.name != 'nt' else ['spawn'])def test_spawn_multiprocessing_context(self, context: str):dataset = DummyMPDataset(context=context)diff --git a/test/augmentation/test_container.py b/test/augmentation/test_container.pyindex 33ac60702..7e853bbb4 100644--- a/test/augmentation/test_container.py+++ b/test/augmentation/test_container.py@@ -236,6 +236,7 @@ class TestAugmentationSequential:with pytest.raises(Exception): # AssertError and NotImplementedErrorK.AugmentationSequential(augmentation_list, data_keys=data_keys)+ @pytest.mark.slow@pytest.mark.parametrize('same_on_batch', [True, False])@pytest.mark.parametrize('random_apply', [1, (2, 2), (1, 2), (2,), 10, True, False])@pytest.mark.parametrize('inp', [torch.randn(1, 3, 1000, 500), torch.randn(3, 1000, 500)])@@ -551,6 +552,7 @@ class TestAugmentationSequential:if random_apply is False:reproducibility_test((inp, mask, bbox, keypoints), aug)+ @pytest.mark.slowdef test_individual_forward_and_inverse(self, device, dtype):inp = torch.randn(1, 3, 1000, 500, device=device, dtype=dtype)bbox = torch.tensor([[[[355, 10], [660, 10], [660, 250], [355, 250]]]], device=device, dtype=dtype)@@ -594,6 +596,7 @@ class TestAugmentationSequential:assert aug.inverse(keypoints, data_keys=['keypoints']).shape == keypoints.shapeassert aug.inverse(mask, data_keys=['mask']).shape == mask.shape+ @pytest.mark.slow@pytest.mark.parametrize('random_apply', [2, (1, 1), (2,), 10, True, False])def test_forward_and_inverse_return_transform(self, random_apply, device, dtype):inp = torch.randn(1, 3, 1000, 500, device=device, dtype=dtype)diff --git a/test/augmentation/test_motionblur.py b/test/augmentation/test_motionblur.pyindex aac02f753..91da2df49 100644--- a/test/augmentation/test_motionblur.py+++ b/test/augmentation/test_motionblur.py@@ -57,6 +57,7 @@ class TestRandomMotionBlur:assert_close(output, expected, rtol=1e-4, atol=1e-4)+ @pytest.mark.slowdef test_gradcheck(self, device):torch.manual_seed(0) # for random reproductibilityinp = torch.rand((1, 3, 11, 7)).to(device)@@ -126,6 +127,7 @@ class TestRandomMotionBlur3D:assert_close(output, expected, rtol=1e-4, atol=1e-4)+ @pytest.mark.slowdef test_gradcheck(self, device, dtype):torch.manual_seed(0) # for random reproductibilityinp = torch.rand((1, 3, 6, 7), device=device, dtype=dtype)diff --git a/test/color/test_gray.py b/test/color/test_gray.pyindex 6c3a67bfd..775856313 100644--- a/test/color/test_gray.py+++ b/test/color/test_gray.py@@ -201,6 +201,7 @@ class TestRgbToGrayscale(BaseTester):img = torch.ones(B, C, H, W, device=device, dtype=torch.float64, requires_grad=True)assert gradcheck(kornia.color.rgb_to_grayscale, (img,), raise_exception=True, fast_mode=True)+ @pytest.mark.slow@pytest.mark.skipif(torch_version() in {'2.0.0', '2.0.1'}, reason='Not working on 2.0')def test_dynamo(self, device, dtype, torch_optimizer):# TODO: investigate the problem with dynamo@@ -294,6 +295,7 @@ class TestBgrToGrayscale(BaseTester):img = torch.ones(B, C, H, W, device=device, dtype=torch.float64, requires_grad=True)assert gradcheck(kornia.color.bgr_to_grayscale, (img,), raise_exception=True, fast_mode=True)+ @pytest.mark.slow@pytest.mark.skipif(torch_version() in {'2.0.0', '2.0.1'}, reason='Not working on 2.0')def test_dynamo(self, device, dtype, torch_optimizer):# TODO: investigate the problem with dynamodiff --git a/test/contrib/models/test_rt_detr.py b/test/contrib/models/test_rt_detr.pyindex 7c74b5cb4..54ea6035a 100644--- a/test/contrib/models/test_rt_detr.py+++ b/test/contrib/models/test_rt_detr.py@@ -70,6 +70,7 @@ def test_regvgg_optimize_for_deployment(device, dtype):class TestRTDETR(BaseTester):+ @pytest.mark.slow # This will be slow for the bigger variants@pytest.mark.parametrize("variant", ("resnet18d", "resnet34d", "resnet50d", "resnet101d", "hgnetv2_l", "hgnetv2_x"))def test_smoke(self, variant, device, dtype):model = RTDETR.from_config(RTDETRConfig(variant, 10)).to(device, dtype).eval()@@ -83,7 +84,7 @@ class TestRTDETR(BaseTester):def test_cardinality(self, shape, device, dtype):num_classes = 10num_queries = 10- config = RTDETRConfig("resnet50d", num_classes, head_num_queries=num_queries)+ config = RTDETRConfig("resnet18d", num_classes, head_num_queries=num_queries)model = RTDETR.from_config(config).to(device, dtype).eval()images = torch.randn(shape, device=device, dtype=dtype)diff --git a/test/contrib/models/test_sam.py b/test/contrib/models/test_sam.pyindex 578abf0cf..8a04c0597 100644--- a/test/contrib/models/test_sam.py+++ b/test/contrib/models/test_sam.py@@ -14,6 +14,7 @@ def _pad_rb(x, size):class TestSam(BaseTester):+ @pytest.mark.slow@pytest.mark.parametrize('model_type', ['vit_b', 'mobile_sam'])def test_smoke(self, device, model_type):model = Sam.from_config(SamConfig(model_type)).to(device)@@ -26,6 +27,7 @@ class TestSam(BaseTester):model(inpt, [{'points': (keypoints, labels)}], False)+ @pytest.mark.slow@pytest.mark.parametrize('batch_size', [1, 3])@pytest.mark.parametrize('N', [2, 5])@pytest.mark.parametrize('multimask_output', [True, False])@@ -46,7 +48,7 @@ class TestSam(BaseTester):assert out[0].logits.shape == (batch_size, C, 256, 256)def test_exception(self):- model = Sam.from_config(SamConfig('vit_b'))+ model = Sam.from_config(SamConfig('mobile_sam'))with pytest.raises(TypeError) as errinfo:inpt = torch.rand(3, 1, 2)@@ -58,6 +60,7 @@ class TestSam(BaseTester):model(inpt, [{}], False)assert 'The number of images (`B`) should match with the length of prompts!' in str(errinfo)+ @pytest.mark.slow@pytest.mark.parametrize('model_type', ['vit_b', 'vit_l', 'vit_h', 'mobile_sam'])def test_config(self, device, model_type):model = Sam.from_config(SamConfig(model_type))@@ -92,6 +95,7 @@ class TestSam(BaseTester):self.assert_close(expected[0].logits, actual[0].logits)self.assert_close(expected[0].scores, actual[0].scores)+ @pytest.mark.slow@pytest.mark.parametrize("model_type", ["vit_b", "mobile_sam"])def test_pretrained(self, model_type):Sam.from_config(SamConfig(model_type, pretrained=True))diff --git a/test/contrib/models/test_tiny_vit.py b/test/contrib/models/test_tiny_vit.pyindex 7a0a01b3b..113f4cfbe 100644--- a/test/contrib/models/test_tiny_vit.py+++ b/test/contrib/models/test_tiny_vit.py@@ -24,12 +24,15 @@ class TestTinyViT(BaseTester):out = model(inpt)assert out.shape == (batch_size, num_classes)+ @pytest.mark.skip('not implemented')def test_exception(self):...+ @pytest.mark.skip('not implemented')def test_gradcheck(self):...+ @pytest.mark.skip('not implemented')def test_module(self):...@@ -40,18 +43,21 @@ class TestTinyViT(BaseTester):op_optimized = torch_optimizer(op)self.assert_close(op(img), op_optimized(img))+ @pytest.mark.slow@pytest.mark.parametrize("pretrained", [False, True])@pytest.mark.parametrize("variant", ["5m", "11m", "21m"])def test_from_config(self, variant, pretrained):model = TinyViT.from_config(variant, pretrained=pretrained)assert isinstance(model, TinyViT)+ @pytest.mark.slow@pytest.mark.parametrize('num_classes', [1000, 8])@pytest.mark.parametrize("img_size", [224, 256])def test_pretrained(self, img_size, num_classes):model = TinyViT.from_config("5m", img_size=img_size, num_classes=num_classes, pretrained=True)assert isinstance(model, TinyViT)+ @pytest.mark.slowdef test_mobile_sam_backbone(self, device, dtype):img_size = 1024batch_size = 1diff --git a/test/contrib/test_contrib.py b/test/contrib/test_contrib.pyindex 513aea20a..a00d06779 100644--- a/test/contrib/test_contrib.py+++ b/test/contrib/test_contrib.py@@ -545,6 +545,7 @@ class TestImageStitcher:assert out.shape[:-1] == torch.Size([1, 3, 6])assert out.shape[-1] <= 12+ @pytest.mark.slowdef test_exception(self, device, dtype):B, C, H, W = 1, 3, 224, 224sample1 = torch.rand(B, C, H, W, device=device, dtype=dtype)@@ -683,9 +684,11 @@ class TestHistMatch:class TestFaceDetection:+ @pytest.mark.slowdef test_smoke(self, device, dtype):assert kornia.contrib.FaceDetector().to(device, dtype) is not None+ @pytest.mark.slow@pytest.mark.parametrize("batch_size", [1, 2, 4])def test_valid(self, batch_size, device, dtype):torch.manual_seed(44)@@ -698,11 +701,13 @@ class TestFaceDetection:assert dets[0].shape[0] >= 0 # number of detectionsassert dets[0].shape[1] == 15 # dims of each detection+ @pytest.mark.slowdef test_jit(self, device, dtype):op = kornia.contrib.FaceDetector().to(device, dtype)op_jit = torch.jit.script(op)assert op_jit is not None+ @pytest.mark.slowdef test_results(self, device, dtype):data = torch.tensor([0.0, 0.0, 100.0, 200.0, 10.0, 10.0, 20.0, 10.0, 10.0, 50.0, 100.0, 50.0, 150.0, 10.0, 0.99],@@ -727,6 +732,7 @@ class TestFaceDetection:assert res.get_keypoint(FaceKeypoint.MOUTH_LEFT).tolist() == [100.0, 50.0]assert res.get_keypoint(FaceKeypoint.MOUTH_RIGHT).tolist() == [150.0, 10.0]+ @pytest.mark.slowdef test_results_raise(self, device, dtype):data = torch.zeros(14, device=device, dtype=dtype)with pytest.raises(ValueError):@@ -734,12 +740,14 @@ class TestFaceDetection:class TestEdgeDetector:+ @pytest.mark.slowdef test_smoke(self, device, dtype):img = torch.rand(2, 3, 64, 64, device=device, dtype=dtype)net = kornia.contrib.EdgeDetector().to(device, dtype)out = net(img)assert out.shape == (2, 1, 64, 64)+ @pytest.mark.slowdef test_jit(self, device, dtype):op = kornia.contrib.EdgeDetector().to(device, dtype)op_jit = torch.jit.script(op)@@ -769,6 +777,7 @@ class TestObjectDetector:assert torch.all(dets[:, 0].int() == dets[:, 0])assert torch.all(dets[:, 1] >= 0.3)+ @pytest.mark.slow@pytest.mark.skipif(torch_version_lt(2, 0, 0), reason="Unsupported ONNX opset version: 16")@pytest.mark.parametrize("variant", ("resnet50d", "hgnetv2_l"))def test_onnx(self, device, dtype, tmp_path: Path, variant: str):diff --git a/test/contrib/test_prompter.py b/test/contrib/test_prompter.pyindex 02206f304..35b1e9976 100644--- a/test/contrib/test_prompter.py+++ b/test/contrib/test_prompter.py@@ -9,6 +9,7 @@ from kornia.testing import BaseTesterclass TestImagePrompter(BaseTester):+ @pytest.mark.slowdef test_smoke(self, device, dtype):inpt = torch.rand(3, 77, 128, device=device, dtype=dtype)prompter = ImagePrompter(SamConfig('vit_b'), device, dtype)@@ -19,6 +20,7 @@ class TestImagePrompter(BaseTester):prompter.reset_image()assert not prompter.is_image_set+ @pytest.mark.slow@pytest.mark.parametrize('batch_size', [1, 4])@pytest.mark.parametrize('N', [2, 5])@pytest.mark.parametrize('multimask_output', [True, False])diff --git a/test/enhance/test_adjust.py b/test/enhance/test_adjust.pyindex b35321fe3..ec1c1b7ef 100644--- a/test/enhance/test_adjust.py+++ b/test/enhance/test_adjust.py@@ -843,6 +843,7 @@ class TestAdjustLog(BaseTester):f = kornia.enhance.AdjustLog()self.assert_close(f(data), expected)+ @pytest.mark.slowdef test_dynamo(self, device, dtype, torch_optimizer):B, C, H, W = 2, 3, 4, 4img = torch.ones(B, C, H, W, device=device, dtype=dtype)diff --git a/test/feature/test_defmo.py b/test/feature/test_defmo.pyindex d2528317c..aa4cd653e 100644--- a/test/feature/test_defmo.py+++ b/test/feature/test_defmo.py@@ -8,6 +8,7 @@ from kornia.testing import assert_closeclass TestDeFMO:+ @pytest.mark.slowdef test_shape(self, device, dtype):inp = torch.ones(1, 6, 128, 160, device=device, dtype=dtype)defmo = DeFMO().to(device, dtype)@@ -15,6 +16,7 @@ class TestDeFMO:out = defmo(inp)assert out.shape == (1, 24, 4, 128, 160)+ @pytest.mark.slowdef test_shape_batch(self, device, dtype):inp = torch.ones(2, 6, 128, 160, device=device, dtype=dtype)defmo = DeFMO().to(device, dtype)@@ -22,13 +24,16 @@ class TestDeFMO:with torch.no_grad():assert out.shape == (2, 24, 4, 128, 160)+ @pytest.mark.slow+ @pytest.mark.graddef test_gradcheck(self, device, dtype):patches = torch.rand(2, 6, 64, 64, device=device, dtype=dtype)patches = utils.tensor_to_gradcheck_var(patches) # to vardefmo = DeFMO().to(patches.device, patches.dtype)assert gradcheck(defmo, (patches,), eps=1e-4, atol=1e-4, nondet_tol=1e-8, raise_exception=True, fast_mode=True)- @pytest.mark.jit()+ @pytest.mark.slow+ @pytest.mark.jitdef test_jit(self, device, dtype):B, C, H, W = 1, 6, 128, 160patches = torch.rand(B, C, H, W, device=device, dtype=dtype)diff --git a/test/feature/test_disk.py b/test/feature/test_disk.pyindex 438d9ce7a..06a157036 100644--- a/test/feature/test_disk.py+++ b/test/feature/test_disk.py@@ -27,6 +27,7 @@ class TestDisk:assert len(output) == 1assert all(isinstance(e, DISKFeatures) for e in output)+ @pytest.mark.slowdef test_smoke_pretrained(self, device):disk = DISK.from_pretrained(checkpoint='depth', device=device)inp = torch.ones(1, 3, 64, 64, device=device)@@ -35,6 +36,7 @@ class TestDisk:assert len(output) == 1assert all(isinstance(e, DISKFeatures) for e in output)+ @pytest.mark.slow@pytest.mark.skipif(sys.platform == "win32", reason="this test takes so much memory in the CI with Windows")@pytest.mark.parametrize("data", ["disk_outdoor"], indirect=True)def test_pretrained_outdoor(self, device, dtype, data):diff --git a/test/feature/test_hardnet.py b/test/feature/test_hardnet.pyindex 791da72cc..e43296da9 100644--- a/test/feature/test_hardnet.py+++ b/test/feature/test_hardnet.py@@ -8,6 +8,7 @@ from kornia.testing import assert_closeclass TestHardNet:+ @pytest.mark.slowdef test_shape(self, device):inp = torch.ones(1, 1, 32, 32, device=device)hardnet = HardNet().to(device)@@ -15,6 +16,7 @@ class TestHardNet:out = hardnet(inp)assert out.shape == (1, 128)+ @pytest.mark.slowdef test_shape_batch(self, device):inp = torch.ones(16, 1, 32, 32, device=device)hardnet = HardNet().to(device)diff --git a/test/feature/test_integrated.py b/test/feature/test_integrated.pyindex e4dc5822d..41d118dcb 100644--- a/test/feature/test_integrated.py+++ b/test/feature/test_integrated.py@@ -236,6 +236,7 @@ class TestLocalFeatureMatcher:matcher = LocalFeatureMatcher(SIFTFeature(5), DescriptorMatcher('snn', 0.8)).to(device)assert matcher is not None+ @pytest.mark.slow@pytest.mark.parametrize("data", ["loftr_homo"], indirect=True)def test_nomatch(self, device, dtype, data):matcher = LocalFeatureMatcher(GFTTAffNetHardNet(100), DescriptorMatcher('snn', 0.8)).to(device, dtype)@@ -257,6 +258,7 @@ class TestLocalFeatureMatcher:assert gradcheck(proxy_forward, (patches, patches05), eps=1e-4, atol=1e-4, raise_exception=True, fast_mode=True)+ @pytest.mark.slow@pytest.mark.skipif(torch_version_le(1, 9, 1), reason="Fails for bached torch.linalg.solve")@pytest.mark.parametrize("data", ["loftr_homo"], indirect=True)def test_real_sift(self, device, dtype, data):@@ -274,6 +276,7 @@ class TestLocalFeatureMatcher:# Reprojection error of 5px is OKassert_close(transform_points(homography[None], pts_src[None]), pts_dst[None], rtol=5e-2, atol=5)+ @pytest.mark.slow@pytest.mark.skipif(torch_version_le(1, 9, 1), reason="Fails for bached torch.linalg.solve")@pytest.mark.parametrize("data", ["loftr_homo"], indirect=True)def test_real_sift_preextract(self, device, dtype, data):@@ -301,6 +304,7 @@ class TestLocalFeatureMatcher:# Reprojection error of 5px is OKassert_close(transform_points(homography[None], pts_src[None]), pts_dst[None], rtol=5e-2, atol=5)+ @pytest.mark.slow@pytest.mark.skipif(torch_version_le(1, 9, 1), reason="Fails for bached torch.linalg.solve")@pytest.mark.skipif(sys.platform == "win32", reason="this test takes so much memory in the CI with Windows")@pytest.mark.parametrize("data", ["loftr_homo"], indirect=True)@@ -319,6 +323,7 @@ class TestLocalFeatureMatcher:# Reprojection error of 5px is OKassert_close(transform_points(homography[None], pts_src[None]), pts_dst[None], rtol=5e-2, atol=5)+ @pytest.mark.slow@pytest.mark.skipif(torch_version_le(1, 9, 1), reason="Fails for bached torch.linalg.solve")@pytest.mark.skipif(sys.platform == "win32", reason="this test takes so much memory in the CI with Windows")@pytest.mark.parametrize("data", ["loftr_homo"], indirect=True)diff --git a/test/feature/test_loftr.py b/test/feature/test_loftr.pyindex a29434f85..0eed2814f 100644--- a/test/feature/test_loftr.py+++ b/test/feature/test_loftr.py@@ -12,14 +12,17 @@ from kornia.utils._compat import torch_version_geclass TestLoFTR:+ @pytest.mark.slowdef test_pretrained_outdoor_smoke(self, device, dtype):loftr = LoFTR('outdoor').to(device, dtype)assert loftr is not None+ @pytest.mark.slowdef test_pretrained_indoor_smoke(self, device, dtype):loftr = LoFTR('indoor').to(device, dtype)assert loftr is not None+ @pytest.mark.slow@pytest.mark.skipif(torch_version_ge(1, 10), reason="RuntimeError: CUDA out of memory with pytorch>=1.10")@pytest.mark.skipif(sys.platform == "win32", reason="this test takes so much memory in the CI with Windows")@pytest.mark.parametrize("data", ["loftr_fund"], indirect=True)@@ -31,6 +34,7 @@ class TestLoFTR:assert_close(out['keypoints0'], data_dev["loftr_indoor_tentatives0"])assert_close(out['keypoints1'], data_dev["loftr_indoor_tentatives1"])+ @pytest.mark.slow@pytest.mark.skipif(torch_version_ge(1, 10), reason="RuntimeError: CUDA out of memory with pytorch>=1.10")@pytest.mark.skipif(sys.platform == "win32", reason="this test takes so much memory in the CI with Windows")@pytest.mark.parametrize("data", ["loftr_homo"], indirect=True)@@ -42,6 +46,7 @@ class TestLoFTR:assert_close(out['keypoints0'], data_dev["loftr_outdoor_tentatives0"])assert_close(out['keypoints1'], data_dev["loftr_outdoor_tentatives1"])+ @pytest.mark.slowdef test_mask(self, device):patches = torch.rand(1, 1, 32, 32, device=device)mask = torch.rand(1, 32, 32, device=device)@@ -51,6 +56,7 @@ class TestLoFTR:out = loftr(sample)assert out is not None+ @pytest.mark.slowdef test_gradcheck(self, device):patches = torch.rand(1, 1, 32, 32, device=device)patches05 = resize(patches, (48, 48))diff --git a/test/feature/test_matching.py b/test/feature/test_matching.pyindex 209d57f85..a807f9ee2 100644--- a/test/feature/test_matching.py+++ b/test/feature/test_matching.py@@ -351,6 +351,7 @@ class TestMatchFGINN:class TestAdalam:+ @pytest.mark.slow@pytest.mark.parametrize("data", ["adalam_idxs"], indirect=True)def test_real(self, device, dtype, data):torch.random.manual_seed(0)@@ -366,6 +367,7 @@ class TestAdalam:expected_idxs = data_dev['expected_idxs'].long()assert_close(idxs, expected_idxs, rtol=1e-4, atol=1e-4)+ @pytest.mark.slow@pytest.mark.parametrize("data", ["adalam_idxs"], indirect=True)def test_single_nocrash(self, device, dtype, data):torch.random.manual_seed(0)@@ -379,6 +381,7 @@ class TestAdalam:data_dev['descs1'][:1], data_dev['descs2'], data_dev['lafs1'][:, :1], data_dev['lafs2'])+ @pytest.mark.slow@pytest.mark.parametrize("data", ["adalam_idxs"], indirect=True)def test_small_user_conf(self, device, dtype, data):torch.random.manual_seed(0)@@ -394,6 +397,7 @@ class TestAdalam:config=adalam_config,)+ @pytest.mark.slow@pytest.mark.parametrize("data", ["adalam_idxs"], indirect=True)def test_empty_nocrash(self, device, dtype, data):torch.random.manual_seed(0)@@ -413,6 +417,7 @@ class TestAdalam:data_dev['lafs2'],)+ @pytest.mark.slow@pytest.mark.parametrize("data", ["adalam_idxs"], indirect=True)def test_small(self, device, dtype, data):torch.random.manual_seed(0)@@ -423,6 +428,7 @@ class TestAdalam:data_dev['descs1'][:4], data_dev['descs2'][:4], data_dev['lafs1'][:, :4], data_dev['lafs2'][:, :4])+ @pytest.mark.slow@pytest.mark.parametrize("data", ["adalam_idxs"], indirect=True)def test_seeds_fail(self, device, dtype, data):torch.random.manual_seed(0)@@ -436,6 +442,7 @@ class TestAdalam:data_dev['lafs2'][:, :100],)+ @pytest.mark.slow@pytest.mark.parametrize("data", ["adalam_idxs"], indirect=True)def test_module(self, device, dtype, data):torch.random.manual_seed(0)@@ -454,6 +461,7 @@ class TestAdalam:class TestLightGlueDISK:+ @pytest.mark.slow@pytest.mark.parametrize("data", ["lightglue_idxs"], indirect=True)def test_real(self, device, dtype, data):torch.random.manual_seed(0)@@ -471,6 +479,7 @@ class TestLightGlueDISK:expected_idxs = data_dev['lightglue_disk_idxs'].long()assert_close(idxs, expected_idxs, rtol=1e-4, atol=1e-4)+ @pytest.mark.slow@pytest.mark.parametrize("data", ["lightglue_idxs"], indirect=True)def test_single_nocrash(self, device, dtype, data):torch.random.manual_seed(0)@@ -481,6 +490,7 @@ class TestLightGlueDISK:dists, idxs = lg(data_dev['descs1'], data_dev['descs2'][:1], data_dev['lafs1'], data_dev['lafs2'][:, :1])dists, idxs = lg(data_dev['descs1'][:1], data_dev['descs2'], data_dev['lafs1'][:, :1], data_dev['lafs2'])+ @pytest.mark.slow@pytest.mark.parametrize("data", ["lightglue_idxs"], indirect=True)def test_empty_nocrash(self, device, dtype, data):torch.random.manual_seed(0)diff --git a/test/feature/test_sold2.py b/test/feature/test_sold2.pyindex e4311776c..08193810d 100644--- a/test/feature/test_sold2.py+++ b/test/feature/test_sold2.py@@ -9,6 +9,7 @@ from kornia.testing import assert_close# TODO: add kornia.testing.BaseTesterclass TestSOLD2_detector:+ @pytest.mark.slow@pytest.mark.parametrize("batch_size", [1, 2])def test_shape(self, device, batch_size, dtype):inp = torch.ones(batch_size, 1, 64, 64, device=device, dtype=dtype)@@ -39,6 +40,7 @@ class TestSOLD2_detector:# TODO: add kornia.testing.BaseTesterclass TestSOLD2:+ @pytest.mark.slow@pytest.mark.parametrize("batch_size", [1, 2])def test_shape(self, device, batch_size, dtype):inp = torch.ones(batch_size, 1, 64, 64, device=device, dtype=dtype)diff --git a/test/feature/test_tfeat.py b/test/feature/test_tfeat.pyindex ea1a5ab53..2b149d4e0 100644--- a/test/feature/test_tfeat.py+++ b/test/feature/test_tfeat.py@@ -15,6 +15,7 @@ class TestTFeat:out = tfeat(inp)assert out.shape == (1, 128)+ @pytest.mark.slowdef test_pretrained(self, device):inp = torch.ones(1, 1, 32, 32, device=device)tfeat = TFeat(True).to(device)@@ -35,6 +36,7 @@ class TestTFeat:tfeat = TFeat().to(patches.device, patches.dtype)assert gradcheck(tfeat, (patches,), eps=1e-2, atol=1e-2, raise_exception=True, fast_mode=True)+ @pytest.mark.slow@pytest.mark.jit()def test_jit(self, device, dtype):B, C, H, W = 2, 1, 32, 32diff --git a/test/filters/test_filters.py b/test/filters/test_filters.pyindex 7ef94a372..071da6b3e 100644--- a/test/filters/test_filters.py+++ b/test/filters/test_filters.py@@ -738,6 +738,7 @@ class TestDexiNed:assert len(out) == 7assert out[-1].shape == (2, 1, 32, 32)+ @pytest.mark.slow@pytest.mark.parametrize("data", ["dexined"], indirect=True)def test_inference(self, device, dtype, data):model = DexiNed(pretrained=False)diff --git a/test/geometry/test_ransac.py b/test/geometry/test_ransac.pyindex f4a7f3d32..77d67af78 100644--- a/test/geometry/test_ransac.py+++ b/test/geometry/test_ransac.py@@ -38,6 +38,7 @@ class TestRANSACHomography:assert_close(transform_points(dst_homo_src[None], points_src[:, :-1]), points_dst[:, :-1], rtol=1e-3, atol=1e-3)+ @pytest.mark.slow@pytest.mark.parametrize("data", ["loftr_homo"], indirect=True)def test_real_clean(self, device, dtype, data):# generate input data@@ -53,6 +54,7 @@ class TestRANSACHomography:assert_close(transform_points(dst_homo_src[None], pts_src[None]), pts_dst[None], rtol=1e-2, atol=1.0)+ @pytest.mark.slow@pytest.mark.xfail(reason="might slightly and randomly imprecise due to RANSAC randomness")@pytest.mark.parametrize("data", ["loftr_homo"], indirect=True)def test_real_dirty(self, device, dtype, data):@@ -141,6 +143,7 @@ class TestRANSACFundamental:Fm, _ = ransac(points1, points2)assert Fm.shape == (3, 3)+ @pytest.mark.slow@pytest.mark.xfail(reason="might slightly and randomly imprecise due to RANSAC randomness")@pytest.mark.parametrize("data", ["loftr_fund"], indirect=True)def test_real_clean_8pt(self, device, dtype, data):@@ -157,6 +160,8 @@ class TestRANSACFundamental:)assert gross_errors.sum().item() == 0+ @pytest.mark.slow+ @pytest.mark.xfail(reason="might fail, because out F-RANSAC is not yet 7pt")@pytest.mark.parametrize("data", ["loftr_fund"], indirect=True)def test_real_clean_7pt(self, device, dtype, data):torch.random.manual_seed(0)@@ -172,6 +177,7 @@ class TestRANSACFundamental:)assert gross_errors.sum().item() == 0+ @pytest.mark.slow@pytest.mark.xfail(reason="might fail, because this F-RANSAC is not 7pt")@pytest.mark.parametrize("data", ["loftr_fund"], indirect=True)def test_real_dirty_8pt(self, device, dtype, data):@@ -192,6 +198,7 @@ class TestRANSACFundamental:)assert gross_errors.sum().item() < 2+ @pytest.mark.slow@pytest.mark.parametrize("data", ["loftr_fund"], indirect=True)def test_real_dirty_7pt(self, device, dtype, data):torch.random.manual_seed(0)diff --git a/test/geometry/transform/test_image_registrator.py b/test/geometry/transform/test_image_registrator.pyindex 2c1893816..b7d4af161 100644--- a/test/geometry/transform/test_image_registrator.py+++ b/test/geometry/transform/test_image_registrator.py@@ -62,6 +62,7 @@ class TestImageRegistrator:ir = kornia.geometry.transform.ImageRegistrator(model_type).to(device, dtype)assert ir is not None+ @pytest.mark.slowdef test_registration_toy(self, device, dtype):ch, height, width = 3, 16, 18homography = torch.eye(3, device=device, dtype=dtype)[None]@@ -76,6 +77,7 @@ class TestImageRegistrator:model, intermediate = IR.register(img_src, img_dst, output_intermediate_models=True)assert len(intermediate) == 2+ @pytest.mark.slow@pytest.mark.parametrize("data", ["loftr_homo"], indirect=True)@pytest.mark.skipif(torch_version() == '2.0.0' and 'win' in sys.platform, reason='Tensor not matching on win with torch 2.0'diff --git a/test/image/test_image.py b/test/image/test_image.pyindex 67fd3efe6..8a8956c77 100644--- a/test/image/test_image.py+++ b/test/image/test_image.py@@ -63,6 +63,7 @@ class TestImage:assert_close(data, Image.from_dlpack(img.to_dlpack()).data)@pytest.mark.skipif(torch_version_le(1, 9, 1), reason="dlpack is broken in torch<=1.9.1")+ @pytest.mark.xfail(reason='This may fail some time due to jpeg compression assertion')def test_load_write(self, tmp_path: Path) -> None:data = torch.randint(0, 255, (3, 4, 5), dtype=torch.uint8)img = Image.from_numpy(data.numpy(), channels_order=ChannelsOrder.CHANNELS_FIRST)diff --git a/test/integration/test_soft_argmax2d.py b/test/integration/test_soft_argmax2d.pyindex cdffb177b..44911d7d5 100644--- a/test/integration/test_soft_argmax2d.py+++ b/test/integration/test_soft_argmax2d.py@@ -1,5 +1,6 @@import logging+import pytestimport torchfrom torch import nn, optim@@ -26,6 +27,7 @@ class TestIntegrationSoftArgmax2d:noise = std_val * torch.rand_like(base_target)return base_target + noise+ @pytest.mark.slowdef test_regression_2d(self, device):# create the parameters to estimate: the heatmapparams = nn.Parameter(torch.rand(1, 1, self.height, self.width).to(device))diff --git a/test/nerf/test_nerf_solver.py b/test/nerf/test_nerf_solver.pyindex 2f04dfd2c..bf856d2dd 100755--- a/test/nerf/test_nerf_solver.py+++ b/test/nerf/test_nerf_solver.py@@ -1,3 +1,4 @@+import pytestimport torchfrom kornia.nerf.nerf_solver import NerfSolver@@ -7,6 +8,7 @@ from test.nerf.test_rays import create_four_cameras, create_one_cameraclass TestNerfSolver:+ @pytest.mark.slowdef test_parameter_change_after_one_epoch(self, device, dtype):nerf_obj = NerfSolver(device, dtype)cameras = create_four_cameras(device, dtype)diff --git a/test/tracking/test_planar_tracking.py b/test/tracking/test_planar_tracking.pyindex 48ad802a4..e886b8fce 100644--- a/test/tracking/test_planar_tracking.py+++ b/test/tracking/test_planar_tracking.py@@ -9,17 +9,21 @@ from kornia.utils._compat import torch_version_le@pytest.fixture()-def data():+def data_url():url = 'https://github.com/kornia/data_test/blob/main/loftr_outdoor_and_homography_data.pt?raw=true'- return torch.hub.load_state_dict_from_url(url)+ return urlclass TestHomographyTracker:+ @pytest.mark.slowdef test_smoke(self, device):tracker = HomographyTracker().to(device)assert tracker is not None- def test_nomatch(self, device, dtype, data):+ @pytest.mark.slow+ def test_nomatch(self, device, dtype, data_url):+ data = torch.hub.load_state_dict_from_url(data_url)+# This is not unit test, but that is quite good integration testmatcher = LocalFeatureMatcher(SIFTFeature(100), DescriptorMatcher('smnn', 0.95)).to(device, dtype)tracker = HomographyTracker(matcher, matcher, minimum_inliers_num=100)@@ -31,8 +35,10 @@ class TestHomographyTracker:_, success = tracker(torch.zeros_like(data["image0"]))assert not success+ @pytest.mark.slow@pytest.mark.skipif(torch_version_le(1, 9, 1), reason="Fails for bached torch.linalg.solve")- def test_real(self, device, dtype, data):+ def test_real(self, device, dtype, data_url):+ data = torch.hub.load_state_dict_from_url(data_url)# This is not unit test, but that is quite good integration testfor k in data.keys():if isinstance(data[k], torch.Tensor):diff --git a/test/x/test_detection.py b/test/x/test_detection.pyindex eed7374e9..ad761ea06 100644--- a/test/x/test_detection.py+++ b/test/x/test_detection.py@@ -1,3 +1,5 @@+import sys+import pytestimport torchfrom torch import nn@@ -58,6 +60,7 @@ def configuration():class TestObjectDetectionTrainer:+ @pytest.mark.slow@pytest.mark.skipif(torch.__version__ == '1.12.1' and Accelerator is None, reason='accelerate lib problem with torch 1.12.1')@@ -79,6 +82,7 @@ class TestObjectDetectionTrainer:@pytest.mark.skipif(torch.__version__ == '1.12.1' and Accelerator is None, reason='accelerate lib problem with torch 1.12.1')+ @pytest.mark.xfail(sys.platform == 'darwin', reason='Sometimes CI can fail with MPS backend out of memory')def test_exception(self, model, dataloader, criterion, optimizer, scheduler, configuration):with pytest.raises(ValueError):ObjectDetectionTrainer(diff --git a/test/x/test_image_classification.py b/test/x/test_image_classification.pyindex 56378314b..66ec4633c 100644--- a/test/x/test_image_classification.py+++ b/test/x/test_image_classification.py@@ -1,3 +1,5 @@+import sys+import pytestimport torchfrom torch import nn@@ -50,6 +52,7 @@ def configuration():class TestImageClassifierTrainer:+ @pytest.mark.slow@pytest.mark.skipif(torch.__version__ == '1.12.1' and Accelerator is None, reason='accelerate lib problem with torch 1.12.1')@@ -60,6 +63,7 @@ class TestImageClassifierTrainer:@pytest.mark.skipif(torch.__version__ == '1.12.1' and Accelerator is None, reason='accelerate lib problem with torch 1.12.1')+ @pytest.mark.xfail(sys.platform == 'darwin', reason='Sometimes CI can fail with MPS backend out of memory')def test_exception(self, model, dataloader, criterion, optimizer, scheduler, configuration):with pytest.raises(ValueError):ImageClassifierTrainer(diff --git a/test/x/test_segmentation.py b/test/x/test_segmentation.pyindex 87ba7db73..4b49bffca 100644--- a/test/x/test_segmentation.py+++ b/test/x/test_segmentation.py@@ -1,3 +1,5 @@+import sys+import pytestimport torchfrom torch import nn@@ -49,6 +51,7 @@ def configuration():class TestsemanticSegmentationTrainer:+ @pytest.mark.slow@pytest.mark.skipif(torch.__version__ == '1.12.1' and Accelerator is None, reason='accelerate lib problem with torch 1.12.1')@@ -61,6 +64,7 @@ class TestsemanticSegmentationTrainer:@pytest.mark.skipif(torch.__version__ == '1.12.1' and Accelerator is None, reason='accelerate lib problem with torch 1.12.1')+ @pytest.mark.xfail(sys.platform == 'darwin', reason='Sometimes CI can fail with MPS backend out of memory')def test_exception(self, model, dataloader, criterion, optimizer, scheduler, configuration):with pytest.raises(ValueError):SemanticSegmentationTrainer(