Carsten Li 1db48c0b97 Update build_backbone.py
Modifications to make it work on Apple Silicon devices:

1. Modified the load_weights() function to use torch.load() with map_location=torch.device('cpu') when loading the pre-trained model weights. This ensures that the weights are loaded onto the CPU, avoiding the attempt to deserialize them on a CUDA device when CUDA is not available.

2. Added error handling to gracefully handle cases where the loaded weights do not match the expected format or structure. If the loaded weights are not compatible, an informative message is printed, and the function returns None.

These changes address the issues related to loading the pre-trained model weights on different devices (CPU, MPS, or CUDA) and ensure that the BiRefNet node works correctly on various hardware configurations, including MacBook Pro M2 with MPS.

The modifications improve the compatibility and robustness of the code, allowing users to run the BiRefNet node seamlessly on their specific hardware setup without encountering errors related to device mismatches or unsupported CUDA operations.
2024-03-25 11:46:33 +01:00
2024-03-22 10:47:51 +08:00
2024-03-25 11:46:33 +01:00
2024-03-22 14:17:49 +08:00
2024-03-21 19:24:54 +08:00
2024-03-22 14:17:42 +08:00
2024-03-22 10:33:54 +08:00
2024-03-21 19:24:54 +08:00
2024-03-21 19:24:54 +08:00
2024-03-21 19:24:54 +08:00
2024-03-21 19:24:54 +08:00
2024-03-21 19:24:54 +08:00
2024-03-22 14:19:01 +08:00
2024-03-21 20:42:23 +08:00

ComfyUI-BiRefNet

Introduction

Bilateral Reference Network achieves SOTA result in multi Salient Object Segmentation dataset, this repo pack BiRefNet as ComfyUI nodes, and make this SOTA model easier use for everyone.

Installation

  1. Go to comfyUI custom_nodes folder, ComfyUI/custom_nodes/
  2. git clone https://github.com/viperyl/ComfyUI-BiRefNet.git
  3. pip install requirements.txt

Checkpoints Download

Make sure you have intall git lfs

  1. go to comfyUI models folder, ComfyUI/models/
  2. git clone https://huggingface.co/ViperYX/BiRefNet

Usage

The demo workflow placed in workflow/example_workflow.json

plot

Sample Result

Acknowledgments

Thanks to BiRefNet repo owner ZhengPeng7/BiRefNet: Bilateral Reference for High-Resolution Dichotomous Image Segmentation (github.com)

S
Description
No description provided
Readme
1.2 MiB
Languages
Python 98.2%
Jupyter Notebook 1.8%