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.
This commit is contained in:
John Pollock
2025-08-14 12:58:34 -05:00
parent 545da7f741
commit 291a4a4572
+5
View File
@@ -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):