Unverified Commit 1f4ffdb8 authored by Lei Wang's avatar Lei Wang Committed by GitHub
Browse files

[Bugfix] Improves compatibility when checking for MPS availability in...

[Bugfix] Improves compatibility when checking for MPS availability in different PyTorch builds. (#1051)
parent e3742d33
import torch import torch
IS_CUDA = torch.cuda.is_available() IS_CUDA = torch.cuda.is_available()
IS_MPS = torch.mps.is_available()
IS_MPS = False
try:
IS_MPS = torch.backends.mps.is_available()
except AttributeError:
print("MPS backend is not available in this PyTorch build.")
except Exception as e:
print(f"An unexpected error occurred while checking MPS availability: {e}")
def get_current_device(): def get_current_device():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment