fix cpu error
This commit is contained in:
+2
-1
@@ -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
@@ -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"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user