modelbeast/scripts/install_rmbg.sh
MODELBEAST 1cc0b80d89 bg_remove_local: local RMBG-2.0 background removal on MPS
New operator: briaai/RMBG-2.0 image->transparent cutout, fully local on Apple
Silicon (weights unlocked by owner HF license). Free local alternative to the
cloud fal_bg_remove; the recommended pre-pass before SF3D / image->3D. Verified:
clean 1024px cutout of the FLUX astrolabe (alpha 0-255, 86.6% removed, thin rings
preserved). Same OpenMP guardrails as sf3d. scripts/install_rmbg.sh; venvs/rmbg.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-13 01:32:38 +10:00

15 lines
775 B
Bash
Executable File

#!/usr/bin/env bash
# briaai/RMBG-2.0 local background removal on Apple Silicon (MPS). Weights are
# HF-gated (owner has access); downloaded on first run via the HF token in Settings.
set -euo pipefail
cd "$(dirname "$0")/.."
UV=/opt/homebrew/bin/uv
echo "[rmbg] creating venv (python 3.11) ..."
$UV venv --python 3.11 venvs/rmbg
PY="$(pwd)/venvs/rmbg/bin/python"
echo "[rmbg] installing deps (transformers + RMBG-2.0 remote-code deps) ..."
$UV pip install --python "$PY" torch torchvision transformers pillow numpy kornia timm scikit-image einops
echo "[rmbg] verifying ..."
"$PY" -c "import torch, transformers, kornia, timm; print('[rmbg] torch', torch.__version__, 'mps', torch.backends.mps.is_available(), '| transformers', transformers.__version__)"
echo "[rmbg] done"