Former-commit-id: eee2e9abf6df345c5471e8ca7639293543ba720c
This commit is contained in:
hiyouga 2023-12-01 22:55:41 +08:00
parent 72bbd5bdef
commit f1d7228a74

View File

@ -73,7 +73,7 @@ def get_current_device() -> str:
if accelerate.utils.is_xpu_available():
return "xpu:{}".format(os.environ.get("LOCAL_RANK", "0"))
elif accelerate.utils.is_npu_available() or torch.cuda.is_available():
return os.environ.get("LOCAL_RANK", "0")
return "cuda:{}".format(os.environ.get("LOCAL_RANK", "0"))
else:
return "cpu"