Former-commit-id: 662d9a3a4ec5ee408f5c9574c502e0af662fd821
This commit is contained in:
hiyouga 2023-12-01 22:55:41 +08:00
parent c60e79c12e
commit a388af4adc

View File

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