Spaces:
Running on Zero
Running on Zero
Plus ZeroGPU shell
Browse files- README.md +17 -6
- app.py +76 -0
- packages.txt +7 -0
- requirements.txt +28 -0
README.md
CHANGED
|
@@ -1,13 +1,24 @@
|
|
| 1 |
---
|
| 2 |
title: BeyondRetargetPlus
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
-
python_version:
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
title: BeyondRetargetPlus
|
| 3 |
+
emoji: 🤖
|
| 4 |
+
colorFrom: indigo
|
| 5 |
+
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 5.49.1
|
| 8 |
+
python_version: 3.10
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
+
short_description: Monocular video to motion for eight humanoid robots
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# BeyondRetarget-plus
|
| 15 |
+
|
| 16 |
+
Interactive ZeroGPU demo for **BeyondRetarget-plus: Collecting Executable Robot
|
| 17 |
+
Motion Data from Massive Internet Human Videos**.
|
| 18 |
+
|
| 19 |
+
The public Space contains only this deployment shell. The inference code, model
|
| 20 |
+
weights, robot assets, and renderer are stored in the private Hugging Face model
|
| 21 |
+
repository `bear-ty/BeyondRetargetPlus-runtime-private` and downloaded through a
|
| 22 |
+
Space secret at runtime.
|
| 23 |
+
|
| 24 |
+
Online build: static / slowly moving camera, single person, up to 5 seconds.
|
app.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Minimal public ZeroGPU shell for the private BeyondRetarget-plus runtime."""
|
| 2 |
+
|
| 3 |
+
from __future__ import annotations
|
| 4 |
+
|
| 5 |
+
import os
|
| 6 |
+
import sys
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
import gradio as gr
|
| 10 |
+
import spaces
|
| 11 |
+
from huggingface_hub import snapshot_download
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
PRIVATE_REPO_ID = os.environ.get(
|
| 15 |
+
"PRIVATE_REPO_ID",
|
| 16 |
+
"bear-ty/BeyondRetargetPlus-runtime-private",
|
| 17 |
+
).strip()
|
| 18 |
+
PRIVATE_REPO_TOKEN = os.environ.get("PRIVATE_REPO_TOKEN", "").strip()
|
| 19 |
+
|
| 20 |
+
if not PRIVATE_REPO_TOKEN:
|
| 21 |
+
raise RuntimeError(
|
| 22 |
+
"PRIVATE_REPO_TOKEN is not configured. Add it as a Hugging Face Space secret."
|
| 23 |
+
)
|
| 24 |
+
|
| 25 |
+
RUNTIME_ROOT = Path("/tmp/brplus_runtime")
|
| 26 |
+
snapshot_download(
|
| 27 |
+
repo_id=PRIVATE_REPO_ID,
|
| 28 |
+
repo_type="model",
|
| 29 |
+
token=PRIVATE_REPO_TOKEN,
|
| 30 |
+
local_dir=str(RUNTIME_ROOT),
|
| 31 |
+
max_workers=8,
|
| 32 |
+
)
|
| 33 |
+
RUNTIME_ROOT = RUNTIME_ROOT.resolve()
|
| 34 |
+
|
| 35 |
+
required = [
|
| 36 |
+
RUNTIME_ROOT / "app_runtime.py",
|
| 37 |
+
RUNTIME_ROOT / "plus_engine.py",
|
| 38 |
+
RUNTIME_ROOT / "weights" / "vimo_checkpoint.pth.tar",
|
| 39 |
+
RUNTIME_ROOT / "weights" / "experiments" /
|
| 40 |
+
"stage2_shared_static" / "20261017_012204" / "checkpoints" / "best.pt",
|
| 41 |
+
RUNTIME_ROOT / "weights" / "yolo" / "yolov8x.pt",
|
| 42 |
+
RUNTIME_ROOT / "vitpose" / "inputs" / "checkpoints" / "vitpose" / "vitpose-h-multi-coco.pth",
|
| 43 |
+
RUNTIME_ROOT / "src" / "configs" / "config_beyondretarget_motion_g1.yaml",
|
| 44 |
+
RUNTIME_ROOT / "renderer" / "render_8robot_two_rows_remote.py",
|
| 45 |
+
]
|
| 46 |
+
missing = [str(path.relative_to(RUNTIME_ROOT)) for path in required if not path.is_file()]
|
| 47 |
+
if missing:
|
| 48 |
+
raise RuntimeError(f"Private Plus runtime is incomplete; missing: {', '.join(missing)}")
|
| 49 |
+
|
| 50 |
+
os.environ.setdefault("BRPLUS_SRC", str(RUNTIME_ROOT / "src"))
|
| 51 |
+
os.environ.setdefault("BRPLUS_WEIGHTS", str(RUNTIME_ROOT / "weights"))
|
| 52 |
+
os.environ.setdefault("BRPLUS_RENDERER", str(RUNTIME_ROOT / "renderer" / "render_8robot_two_rows_remote.py"))
|
| 53 |
+
os.environ.setdefault("BRPLUS_RENDER_XML", str(RUNTIME_ROOT / "renderer" / "assets" / "atlas_g1_gr1t1_h1_gr2_r1_tk_t1.xml"))
|
| 54 |
+
os.environ.setdefault("BRPLUS_VITPOSE_ROOT", str(RUNTIME_ROOT / "vitpose"))
|
| 55 |
+
os.environ.setdefault("BRPLUS_OUTPUT_DIR", "/tmp/brplus_outputs")
|
| 56 |
+
os.environ.setdefault("MUJOCO_GL", "egl")
|
| 57 |
+
os.environ.setdefault("PYOPENGL_PLATFORM", "egl")
|
| 58 |
+
os.environ.setdefault("LIBGL_ALWAYS_SOFTWARE", "1")
|
| 59 |
+
os.environ.setdefault("KMP_DUPLICATE_LIB_OK", "TRUE")
|
| 60 |
+
|
| 61 |
+
sys.path.insert(0, str(RUNTIME_ROOT))
|
| 62 |
+
|
| 63 |
+
from app_runtime import create_demo, run_gpu_stage # noqa: E402
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
@spaces.GPU(duration=120, size="large")
|
| 67 |
+
def zero_gpu_inference(video_path: str, progress=gr.Progress()) -> dict:
|
| 68 |
+
return run_gpu_stage(video_path, progress=progress)
|
| 69 |
+
|
| 70 |
+
|
| 71 |
+
demo = create_demo(zero_gpu_inference)
|
| 72 |
+
demo.queue(default_concurrency_limit=1, max_size=3)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
if __name__ == "__main__":
|
| 76 |
+
demo.launch()
|
packages.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
ffmpeg
|
| 2 |
+
libegl1
|
| 3 |
+
libgl1
|
| 4 |
+
libgl1-mesa-dri
|
| 5 |
+
libglfw3
|
| 6 |
+
libosmesa6
|
| 7 |
+
mesa-utils
|
requirements.txt
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio==5.49.1
|
| 2 |
+
spaces>=0.42.0
|
| 3 |
+
huggingface_hub>=0.34.0
|
| 4 |
+
|
| 5 |
+
torch==2.8.0
|
| 6 |
+
torchvision==0.23.0
|
| 7 |
+
|
| 8 |
+
numpy==1.26.4
|
| 9 |
+
scipy==1.15.3
|
| 10 |
+
opencv-python-headless==4.11.0.86
|
| 11 |
+
av==13.0.0
|
| 12 |
+
imageio==2.34.1
|
| 13 |
+
imageio-ffmpeg==0.6.0
|
| 14 |
+
Pillow>=10.0.0
|
| 15 |
+
scikit-image==0.24.0
|
| 16 |
+
|
| 17 |
+
omegaconf==2.3.0
|
| 18 |
+
pytorch-lightning==2.6.1
|
| 19 |
+
timm==0.9.12
|
| 20 |
+
einops==0.8.2
|
| 21 |
+
yacs==0.1.8
|
| 22 |
+
tqdm==4.66.5
|
| 23 |
+
ultralytics==8.3.0
|
| 24 |
+
smplx==0.1.28
|
| 25 |
+
|
| 26 |
+
mujoco==3.1.6
|
| 27 |
+
trimesh==4.11.5
|
| 28 |
+
ffmpeg-python==0.2.0
|