Skip to content

Commit

Permalink
fix cpu error
Browse files Browse the repository at this point in the history
  • Loading branch information
lldacing committed Nov 9, 2024
1 parent 47fd1f8 commit 172e873
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion birefnetNode.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def INPUT_TYPES(cls):

def rem_bg(self, model, images):
model, version = model
model_device_type = next(model.parameters()).device.type
_images = []
_masks = []

Expand All @@ -191,7 +192,7 @@ def rem_bg(self, model, images):
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")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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"]

Expand Down

0 comments on commit 172e873

Please sign in to comment.