From 31914c9beb5d1b2d0e4062d1fa6a6304458ec9d9 Mon Sep 17 00:00:00 2001 From: hben35096 <139383150+hben35096@users.noreply.github.com> Date: Sat, 10 May 2025 13:47:35 +0800 Subject: [PATCH] Use the CPU for interpolation. --- comfy/clip_vision.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/comfy/clip_vision.py b/comfy/clip_vision.py index 8f592652e..92cd6b179 100644 --- a/comfy/clip_vision.py +++ b/comfy/clip_vision.py @@ -29,7 +29,12 @@ def clip_preprocess(image, size=224, mean=[0.48145466, 0.4578275, 0.40821073], s else: scale_size = (size, size) - image = torch.nn.functional.interpolate(image, size=scale_size, mode="bilinear") + if image.device.type == 'musa': + image = image.cpu() + image = torch.nn.functional.interpolate(image, size=scale_size, mode="bicubic", antialias=True) + image = image.to('musa') + else: + image = torch.nn.functional.interpolate(image, size=scale_size, mode="bicubic", antialias=True) h = (image.shape[2] - size)//2 w = (image.shape[3] - size)//2 image = image[:,:,h:h+size,w:w+size]