This commit is contained in:
Kakaru 2025-10-13 22:04:09 +08:00 committed by GitHub
parent 47bb5a2cba
commit aada52050e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,28 +7,7 @@ _musa_err_msg = "torch_musa not found or not configured correctly."
try:
if hasattr(torch, 'musa') and torch.musa.is_available():
try:
major, minor = torch.musa.get_device_capability()
version_val = major + minor / 10.0
if version_val < 2.1:
raise RuntimeError(
f"MUSA version check failed! "
f"Found capability {major}.{minor} (version value {version_val:.2f}), "
f"but this project requires a version >= 2.1. "
f"Please upgrade your torch_musa and MUSA SDK."
f"See: https://github.com/MooreThreads/torch_musa"
)
_musa_available = True
except Exception as e:
_musa_err_msg = f"MUSA availability check failed: {e}"
if isinstance(e, RuntimeError):
raise e
_musa_available = False
_musa_available = True
except Exception:
_musa_available = False
@ -96,4 +75,4 @@ def should_ddp(device_idx: int = 0) -> bool:
else:
return False
DEVICE: Optional[torch.device] = get_device()
DEVICE: Optional[torch.device] = get_device()