From 3595d26846e0b3b467ae4addd52b7f3172ce4dba Mon Sep 17 00:00:00 2001 From: Zxilly <31370133+Zxilly@users.noreply.github.com> Date: Thu, 15 Aug 2024 08:30:43 +0000 Subject: [PATCH] fix: report correct device count for intel xpu Former-commit-id: 0618f660b6511599365bd9be64499dbab41a79ba --- src/llamafactory/extras/misc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/llamafactory/extras/misc.py b/src/llamafactory/extras/misc.py index c1395552..ac7b2b80 100644 --- a/src/llamafactory/extras/misc.py +++ b/src/llamafactory/extras/misc.py @@ -141,6 +141,8 @@ def get_device_count() -> int: return torch.npu.device_count() elif is_torch_cuda_available(): return torch.cuda.device_count() + elif is_torch_xpu_available(): + return torch.xpu.device_count() else: return 0