diff --git a/depth_anything_v2/dpt.py b/depth_anything_v2/dpt.py index 18d3e6f8..c0af08b2 100644 --- a/depth_anything_v2/dpt.py +++ b/depth_anything_v2/dpt.py @@ -215,7 +215,7 @@ def image2tensor(self, raw_image, input_size=518): image = transform({'image': image})['image'] image = torch.from_numpy(image).unsqueeze(0) - DEVICE = 'cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu' + DEVICE = 'npu' if hasattr(torch, 'npu') and torch.npu.is_available() else 'cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu' image = image.to(DEVICE) return image, (h, w)