modelbeast/scripts/install_sf3d.sh
MODELBEAST 605b1ae347 Phase 1 + framework: settings/secrets, queue lanes, job mgmt, inbox, 8 new operators
Framework:
- server/settings.py: key/value settings + secrets, env-injected into operator
  subprocesses, secret values masked in API and redacted from job logs
- runner: gpu/cpu/net concurrency lanes, job cancel/retry/delete, multi-input,
  graceful 'not installed' error when a tool venv is missing
- db: settings table, asset_ids column (migrated), MODELBEAST_DATA test override
- main: settings + job-action endpoints, inbox watch folder auto-ingest
- store: operators can tag output asset kind (splat, colmap_dataset)

Operators (11 total):
- fal_trellis/trellis2/hunyuan3d/rodin via shared _lib/fal_common.py (verified
  params + endpoint ids; recursive result-URL extractor handles per-endpoint keys)
- sf3d, trellis_mac: local MPS image-to-3D, installed with Metal kernels built,
  gated on owner HuggingFace auth
- colmap_poses (COLMAP 4.x + GLOMAP global mapper), brush_train (native Metal 3DGS)
- Scan pipeline validated end-to-end through the UI: frames -> colmap (48/48
  registered, 0.6px) -> brush -> splat.ply -> in-app SplatViewer

Frontend:
- Settings modal, operator gating (lock + disabled run when requires_env unmet),
  job cancel/retry/delete, Compare grid (multi-select side-by-side viewers),
  SplatViewer (gaussian-splats-3d, Ply format forced for extensionless URLs)

Tooling: scripts/install_{colmap,brush,sf3d,trellis_mac}.sh; vendor/ + venvs/
gitignored; tests/smoke.sh (12 checks passing); BENCHMARKS.md

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-12 21:42:27 +10:00

36 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Stable Fast 3D (SF3D) — Stability, official MPS. Weights gated on HF: the owner
# must `huggingface-cli login` and accept the stabilityai/stable-fast-3d license
# once; otherwise the first run errors with a clear message.
set -euo pipefail
cd "$(dirname "$0")/.."
ROOT=$(pwd)
UV=/opt/homebrew/bin/uv
echo "[sf3d] OpenMP runtime for Metal/C++ kernel compile ..."
brew list libomp >/dev/null 2>&1 || brew install libomp
mkdir -p vendor
[ -d vendor/stable-fast-3d ] || git clone --depth 1 https://github.com/Stability-AI/stable-fast-3d vendor/stable-fast-3d
echo "[sf3d] creating venv (python 3.11) ..."
$UV venv --python 3.11 venvs/sf3d
PY="$ROOT/venvs/sf3d/bin/python"
echo "[sf3d] installing torch + build tooling ..."
$UV pip install --python "$PY" -U "setuptools==69.5.1" wheel ninja
$UV pip install --python "$PY" torch torchvision
echo "[sf3d] installing sf3d requirements ..."
cd vendor/stable-fast-3d
LIBOMP=$(brew --prefix libomp)
export CPPFLAGS="-Xclang -fopenmp -I$LIBOMP/include ${CPPFLAGS:-}"
export LDFLAGS="-L$LIBOMP/lib -lomp ${LDFLAGS:-}"
# --no-build-isolation so the local texture_baker/uv_unwrapper packages can see
# the torch we just installed at build time (they import torch in setup.py).
$UV pip install --python "$PY" --no-build-isolation -r requirements.txt
echo "[sf3d] verifying import ..."
"$PY" -c "import torch; print('[sf3d] torch', torch.__version__, 'mps', torch.backends.mps.is_available())"
echo "[sf3d] done — weights download on first run (needs HF login for stabilityai/stable-fast-3d)"