From 9f26d27bb9e0920472a4f7dfedd5d33d14011853 Mon Sep 17 00:00:00 2001 From: Ivan Nikolic Date: Mon, 9 Feb 2026 21:43:50 +0800 Subject: [PATCH] Skip metric3d inference tests when xformers is unsupported On GPUs with compute capability > 9.0 (e.g. Blackwell), xformers memory_efficient_attention raises NotImplementedError. Skip these tests gracefully instead of failing. --- dimos/models/depth/test_metric3d.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/dimos/models/depth/test_metric3d.py b/dimos/models/depth/test_metric3d.py index 835f09adcc..33e39f6a29 100644 --- a/dimos/models/depth/test_metric3d.py +++ b/dimos/models/depth/test_metric3d.py @@ -1,3 +1,5 @@ +from contextlib import contextmanager + import numpy as np import pytest @@ -6,6 +8,16 @@ from dimos.utils.data import get_data +@contextmanager +def skip_xformers_unsupported(): + try: + yield + except NotImplementedError as e: + if "memory_efficient_attention" in str(e): + pytest.skip(f"xformers not supported on this GPU: {e}") + raise + + @pytest.fixture def sample_intrinsics() -> list[float]: """Sample camera intrinsics [fx, fy, cx, cy].""" @@ -51,7 +63,8 @@ def test_metric3d_infer_depth(sample_intrinsics: list[float]) -> None: rgb_array = image.data # Run inference - depth_map = model.infer_depth(rgb_array) + with skip_xformers_unsupported(): + depth_map = model.infer_depth(rgb_array) # Verify output assert isinstance(depth_map, np.ndarray) @@ -78,7 +91,8 @@ def test_metric3d_multiple_inferences(sample_intrinsics: list[float]) -> None: # Run multiple inferences depths = [] for _ in range(3): - depth = model.infer_depth(rgb_array) + with skip_xformers_unsupported(): + depth = model.infer_depth(rgb_array) depths.append(depth) # Results should be consistent