fix gptq training

This commit is contained in:
hiyouga
2023-12-02 00:27:15 +08:00
parent a973ce6e89
commit f57445c7a0
3 changed files with 12 additions and 10 deletions

View File

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