From 291a4a45728e3563f00273ba455b25cb26e4130f Mon Sep 17 00:00:00 2001 From: John Pollock Date: Thu, 14 Aug 2025 12:58:34 -0500 Subject: [PATCH] feat: Add support for Apple MPS devices Update the `get_device_list` function to detect and include the 'mps' (Metal Performance Shaders) backend if it's available through PyTorch. This allows users on Apple Silicon hardware to see and select their GPU for accelerated computations. --- __init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/__init__.py b/__init__.py index bbccd67..d1e710a 100644 --- a/__init__.py +++ b/__init__.py @@ -47,6 +47,11 @@ def get_device_list(): devs += [f"xpu:{i}" for i in range(torch.xpu.device_count())] except Exception: pass + try: + if torch.backends.mps.is_available(): + devs += ["mps"] + except Exception: + pass return devs def set_current_device(device):