From 41a83871954838271f55b08d1aeb9db0ed1ff06a 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: dc36fcc3de721bdd28edd4eed36677e59a7614be --- 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