From e6ae426c5d3d36853938cf0488e1a92d45824626 Mon Sep 17 00:00:00 2001 From: Michele Dolfi Date: Tue, 20 Jan 2026 09:35:51 +0100 Subject: [PATCH] fix torch compatibility for xpu Signed-off-by: Michele Dolfi --- docling/utils/accelerator_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docling/utils/accelerator_utils.py b/docling/utils/accelerator_utils.py index 3e50ea5811..f408cf1ac5 100644 --- a/docling/utils/accelerator_utils.py +++ b/docling/utils/accelerator_utils.py @@ -22,7 +22,7 @@ def decide_device( has_cuda = torch.backends.cuda.is_built() and torch.cuda.is_available() has_mps = torch.backends.mps.is_built() and torch.backends.mps.is_available() - has_xpu = torch.xpu.is_available() + has_xpu = hasattr(torch, "xpu") and torch.xpu.is_available() if supported_devices is not None: if has_cuda and AcceleratorDevice.CUDA not in supported_devices: