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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user