Skip to content
Last updated

Self-host RMBG 3.0

Run RMBG 3.0, Bria's newest background removal model, on your own hardware with a self-hosted license. This guide installs the model, downloads its weights from Bria, and removes the background from a first image.

RMBG 3.0 or RMBG 2.0?

Both remove backgrounds, and each is licensed on its own: an RMBG 2.0 license does not cover RMBG 3.0.

RMBG 3.0RMBG 2.0
Best forQuality first: cleaner edges on hair, fur, transparent objects and fine detailHigh volume and low latency
SpeedAbout 6 seconds an image on an NVIDIA L40SMuch faster
GPU memory32 GB or moreFits on small GPUs
Python3.11 or 3.123.10 or newer

Use RMBG 2.0 for faster inference on smaller, cheaper GPU machines. Use RMBG 3.0 when quality matters most.

Requirements

  • An active RMBG 3.0 self-hosted license (pricing)
  • One of your organization's API keys
  • A machine with an NVIDIA GPU with 32 GB of memory or more, Python 3.11 or 3.12, and about 26 GB of disk for the weights
  • For the manual install: curl and jq, and network access to the Bria Engine, AWS CodeArtifact and Bria's weights CDN (no Hugging Face account)

1. Get a license

Buy an RMBG 3.0 license on the pricing page. You manage it, and see the installation steps, on the Licenses tab in the Console.

2. Install

Bria Studio installs the package, downloads the weights, and runs a test for you:

npx @bria-ai/studio

Pick RMBG 3.0 when Studio lists your licensed models. It installs rmbg-3 into a Python 3.12 virtual environment at ~/.bria/venvs/rmbg-3.0, downloads the weights, and removes a sample background to confirm the setup.

RMBG 3.0 needs Studio 0.5.0 or newer. If Studio does not list it, run npx @bria-ai/studio@latest.

3. Run it

Run from the environment the model is installed in. If you used Studio, activate the venv it created:

source ~/.bria/venvs/rmbg-3.0/bin/activate

Then load the model with your API key and remove a background. On first load setup() checks your license and downloads the weights to ~/.bria/models, which takes a few minutes; later runs reuse them.

import os
from rmbg_3 import RMBG3, RMBG3Config, RMBG3Input

# Reads BRIA_API_TOKEN; checks the license and downloads ~26 GB of weights on first load.
pipe = RMBG3(config=RMBG3Config(api_token=os.environ["BRIA_API_TOKEN"]))
pipe.setup()

result = pipe.execute([RMBG3Input(image="https://bria-test-images.s3.us-east-1.amazonaws.com/strawberry.jpg")])[0]
result.image.save("cutout.png")  # RGBA cutout with a transparent background

pipe.cleanup()  # free the GPU when you are done

Pass a URL or local path to RMBG3Input.image. Set return_mask=True to also get the grayscale matte as result.mask (white is the subject). The request and the result are the same as RMBG 2.0's, so code written for RemoveBG moves over by changing the class names.

Inputs and outputs stay on your machine — only a small attribution vector is sent to Bria.

Errors and troubleshooting

No license for RMBG 3.0

Your account holds no active RMBG 3.0 license, so the install stops before anything downloads. An RMBG 2.0 license does not cover RMBG 3.0. Buy or renew it on the Licenses tab.

LicenseError when the model starts

The license was cancelled or ended. Open the Licenses tab — the error links straight to it. A card retry (past_due) stays active.

The model won't load and asks for an API token

No BRIA_API_TOKEN is set. Set it, or pass RMBG3Config(api_token="...").

torch.cuda.is_available() is False during setup()

The installed PyTorch doesn't match your NVIDIA driver. pip's default PyTorch needs driver 580 or newer. Install the CUDA 12.8 build first, as in step 2.

CUDA out of memory during setup() or the first image

RMBG 3.0 needs a GPU with 32 GB of memory or more. On a smaller GPU, use RMBG 2.0.

WeightsError during download

The download was interrupted. Run again — it resumes where it stopped.

Usage and billing

Self-hosted runs are counted against your RMBG 3.0 license and shown in Usage & billing in the Console, tagged as self-hosted. See Self-hosted models for how licensing and billing work across models.