mirror of
https://github.com/shinyobjectz/raea.git
synced 2026-12-01 12:44:11 -10:00
Each local model's setup is now tools/<model>/setup.py (standard library only, on tools/local_setup.py), run by uv on any OS as raea runs it: uv on the PATH, else raea's own uv 0.12.24 fetched once into ~/.cache/raea-tools/uv (where tools/ensure.sh puts it) and checked against its SHA-256. The setup.sh beside each is a wrapper for a Mac or Linux. Until now each setup was a sh script needing uv already installed (brew install uv), so Windows had no way to install any local model. - SAO: Core ML on a Mac, ONNX Runtime elsewhere (CUDA where nvidia-smi finds a GPU; RAEA_SAO_CUDA=0|1); its WAV is written by Python's wave module, not an installed ffmpeg (same samples) - matchmove, splat: footage read through PyAV, whose wheels carry FFmpeg's libraries (no ffmpeg/ffprobe needed); splat fetches Brush v0.3.0's release build for macOS arm64, Linux x86_64 or Windows x86_64, each SHA-256 checked - goo: Taichi on Metal on a Mac, else its best GPU (CUDA, Vulkan) or the CPU; the backend is reported as run - TokenSynth: its code as GitHub's archive at a pinned commit (no git); coremltools only on a Mac - the engine runs .venv\Scripts\python.exe on Windows (venv_python), Brush's brush_app.exe - tools/release.sh ships tools/local_setup.py
62 lines
3.4 KiB
Python
62 lines
3.4 KiB
Python
"""Splat training for raea-render's asset store: `Store::splat(input, {frames, steps, ...})` makes a 3D Gaussian splat
|
|
from footage (frames read through PyAV, then COLMAP through pycolmap: BSD, then Brush: Apache-2.0, Rust + wgpu: Metal on
|
|
a Mac, Vulkan or DX12 elsewhere) and keeps the .ply and its sidecar, cached by the input's content and the params.
|
|
run.py is copied in beside the venv; Brush is its v0.3.0 release build for this OS, checked against its SHA-256.
|
|
Installs into $RAEA_SPLAT (default ~/.cache/raea-splat); raea-render runs this the first time a splat is asked for, and
|
|
`raea splat setup` runs it on purpose, on any OS (tools/local_setup.py). Size: about 360 MB (the venv, Brush's binary).
|
|
No model weights."""
|
|
|
|
import platform
|
|
import shutil
|
|
import sys
|
|
import tarfile
|
|
import zipfile
|
|
from pathlib import Path
|
|
|
|
HERE = Path(__file__).resolve().parent
|
|
sys.path.insert(0, str(HERE.parent))
|
|
from local_setup import FOOTAGE, WINDOWS, Setup # noqa: E402
|
|
|
|
BRUSH = "v0.3.0"
|
|
# Brush's release builds raea runs, by (OS, machine), and their SHA-256 (the release's sha256.sum)
|
|
BUILDS = {
|
|
("Darwin", "arm64"): ("brush-app-aarch64-apple-darwin.tar.xz", "65b2631398c839be3c1d4d7160fe2326389dec87830aac0710985e6690a1048c"),
|
|
("Linux", "x86_64"): ("brush-app-x86_64-unknown-linux-gnu.tar.xz", "4f0f9a8785d1951c62df26aae247c02c5bba32b00f40b06df4e1c9b867399e20"),
|
|
("Windows", "AMD64"): ("brush-app-x86_64-pc-windows-msvc.zip", "b68e3e9cf052d51bf3ee30776fa5a364de7f2ba13b58443128ff797bb7bcfcd6"),
|
|
}
|
|
|
|
with Setup("splat", "RAEA_SPLAT", "raea-splat") as s:
|
|
s.venv("3.11", FOOTAGE, imports=("pycolmap", "numpy", "cv2", "PIL", "av"))
|
|
exe = Path("brush") / ("brush_app.exe" if WINDOWS else "brush_app")
|
|
version = Path("brush/.version")
|
|
if not exe.is_file() or not version.is_file() or version.read_text().strip() != BRUSH:
|
|
build = BUILDS.get((platform.system(), platform.machine()))
|
|
if not build:
|
|
sys.exit(f"splat setup: Brush {BRUSH} has no release build for {platform.system()} {platform.machine()}: build it "
|
|
f"(cargo install --git https://github.com/ArthurBrussee/brush --tag {BRUSH} brush-app) and put brush_app in {s.dir / 'brush'}")
|
|
name, sha = build
|
|
s.say(f"fetching Brush {BRUSH}")
|
|
shutil.rmtree("brush.part", ignore_errors=True)
|
|
s.fetch(f"brush.part/{name}", f"https://github.com/ArthurBrussee/brush/releases/download/{BRUSH}/{name}", sha)
|
|
if name.endswith(".zip"):
|
|
with zipfile.ZipFile(f"brush.part/{name}") as z:
|
|
z.extractall("brush.part")
|
|
else:
|
|
with tarfile.open(f"brush.part/{name}") as t:
|
|
t.extractall("brush.part", **({"filter": "data"} if hasattr(tarfile, "data_filter") else {}))
|
|
shutil.rmtree("brush", ignore_errors=True)
|
|
Path("brush").mkdir()
|
|
found = [p for p in Path("brush.part").rglob(exe.name) if p.is_file()]
|
|
if not found:
|
|
sys.exit(f"splat setup: {name} has no {exe.name}")
|
|
shutil.move(found[0], exe)
|
|
for lic in Path("brush.part").rglob("LICENSE*"):
|
|
shutil.move(lic, Path("brush") / lic.name)
|
|
break
|
|
exe.chmod(0o755)
|
|
version.write_text(BRUSH + "\n")
|
|
shutil.rmtree("brush.part", ignore_errors=True)
|
|
s.run([exe.resolve(), "--version"], stdout=sys.stderr)
|
|
shutil.copy2(HERE / "run.py", "run.py")
|
|
s.ready(".venv", "brush")
|