fix cpu error

This commit is contained in:
刘雪峰
2024-11-10 00:38:43 +08:00
parent 47fd1f8189
commit 172e873e92
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -178,6 +178,7 @@ class RembgByBiRefNet:
def rem_bg(self, model, images):
model, version = model
model_device_type = next(model.parameters()).device.type
_images = []
_masks = []
@@ -191,7 +192,7 @@ class RembgByBiRefNet:
im_tensor = proc_img(pil_image).unsqueeze(0)
with torch.no_grad():
mask = model(im_tensor.to(deviceType))[-1].sigmoid().cpu()
mask = model(im_tensor.to(model_device_type))[-1].sigmoid().cpu()
# 遮罩大小需还原为与原图一致
mask = comfy.utils.common_upscale(mask, w, h, 'bilinear', "disabled")
+1 -1
View File
@@ -1,7 +1,7 @@
[project]
name = "comfyui_birefnet_ll"
description = "Sync with version of BiRefNet. NODES:AutoDownloadBiRefNetModel, LoadRembgByBiRefNetModel, RembgByBiRefNet."
version = "1.0.4"
version = "1.0.5"
license = {file = "LICENSE"}
dependencies = ["numpy<2", "opencv-python", "scipy", "timm"]