Image Segmentation
Transformers
PyTorch
ONNX
Safetensors
Transformers.js
remove background
background
background-removal
Pytorch
vision
legal liability
custom_code
Instructions to use briaai/RMBG-2.0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use briaai/RMBG-2.0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-segmentation", model="briaai/RMBG-2.0", trust_remote_code=True)# Load model directly from transformers import AutoModelForImageSegmentation model = AutoModelForImageSegmentation.from_pretrained("briaai/RMBG-2.0", trust_remote_code=True, dtype="auto") - Transformers.js
How to use briaai/RMBG-2.0 with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-segmentation', 'briaai/RMBG-2.0'); - Inference
- Notebooks
- Google Colab
- Kaggle
Using RMBG-2.0 in removal-background pipeline with Transformers.js
#24
by LuSRodri - opened
I am trying to uses the RMBG-2.0 in background-removal pipeline with Transformers.js, as describe here: https://github.com/huggingface/transformers.js/pull/1216. But I cannot do it. How can I proceded?
The error:
Uncaught Error: Unsupported model type: null
at qd.from_pretrained (transformers:1:563598)
at async transformers:1:670067
Hi there π This model is quite memory intensive and leads to out-of-memory errors (as you're experiencing). The way we're hoping to fix this is with WebGPU support, which is currently being worked on.
You can follow along here: https://github.com/microsoft/onnxruntime/issues/21968
