LoadRembgByBiRefNetModel
Load BiRefNet from disk — including the old .pth checkpoints
- model
AutoDownloadBiRefNetModel is the hand-holding loader. LoadRembgByBiRefNetModel is the one for people who already have the weights - or who want the old .pth checkpoints that the auto-download path doesn't touch.
It does the same job: turn a model file into a BIREFNET handle for the rembg nodes. The difference is where the file comes from. Instead of a fixed dropdown of model names, this node's model dropdown is populated live from whatever .safetensors (or legacy .pth) files sit in the pack's model folder. Drop a file in, refresh, and it appears.
How it works
The pack registers a model folder under ComfyUI's birefnet key, defaulting to models/BiRefNet - the same folder AutoDownloadBiRefNetModel writes into, so the two loaders share one pool of files. If you've configured a birefnet path in your extra_model_paths.yaml, this node reads from there instead.
The genuinely interesting bit is that this loader supports two model generations:
- New
.safetensorsweights (General, General-HR, Matting, etc.) load into the current BiRefNet architecture. As with the auto-download node, Lite models automatically get the Swin-Tiny backbone and everything else Swin-Large. - Old
.pthcheckpoints (BiRefNet-DIS_ep580.pth,BiRefNet-ep480.pth) are detected by filename and loaded into the old architecture this pack bundles. That's thebirefnet_oldcode path - the reason the pack's tagline is "support the use of new and old versions of BiRefNet models."
Two optional toggles:
- use_weight (default off) - loads pretrained Swin backbone weights alongside the model. For the modern
.safetensorsfiles you almost never need this; the released weights are complete. It exists mainly for people reproducing the old pipeline from scratch, and it means downloading an extraswin_large...pth(orswin_tiny...pthfor Lite) file. - dtype (default
float32) - switch tofloat16for roughly half the VRAM and about double the speed. BiRefNet's author validated FP16 at no meaningful accuracy cost; there's no reason to stay on FP32 for a cutout.
device is AUTO (GPU) or CPU.
Output is a single model (BIREFNET) that plugs into RembgByBiRefNet, RembgByBiRefNetAdvanced, or GetMaskByBiRefNet.
Install and model placement
Standard pack install - ComfyUI Manager (search ComfyUI_BiRefNet_ll) or:
cd ComfyUI/custom_nodes
git clone https://github.com/lldacing/ComfyUI_BiRefNet_ll.git
cd ComfyUI_BiRefNet_ll
pip install -r requirements.txt # numpy, opencv-python, timm
# restart ComfyUI
Then drop your weights into models/BiRefNet/. If you downloaded from the ZhengPeng7 HuggingFace repos, remember the README's rename rule: model.safetensors must be renamed to something like General.safetensors - the filename is the model identifier in the dropdown.
Where people get stuck
- The model dropdown is empty - no files in the folder yet, or the
birefnetpath in yourextra_model_paths.yamlpoints somewhere that isn'tmodels/BiRefNet. Put a.safetensorsfile there and refresh the node list. - A
.pthfile loads but behaves oddly - old checkpoints expect the old preprocessing (normalization to mean 0.5, not the ImageNet-style 0.485/0.456/0.406 the new models use). The pack routes that automatically by filename, so if you renamed an old file to something that doesn't matchBiRefNet-*.pth, it'll get treated as new and look wrong. - "Should I use this or AutoDownload?" - if you don't already have files on disk, use
AutoDownloadBiRefNetModel. It downloads, names, and loads in one step. This node is for the "I keep my models in a shared folder / I want the legacy.pth" crowd.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| model | COMBO | 0 options: | |
| device | COMBO | 2 options: AUTO, CPU | |
| use_weightopt | BOOLEAN | false | — |
| dtypeopt | COMBO | float32 | 2 options: float32, float16 |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| model | BIREFNET | — |