|
| 1 | +#!/bin/bash |
| 2 | +# End-to-end GPU smoke for the EgoInfinity pipeline on a single 16 GB card |
| 3 | +# (e.g. RTX 4070 Ti SUPER). Runs from the OFFICIAL repo and exercises every |
| 4 | +# component that fits, reusing the dev repo's weights + a dev clip's frames. |
| 5 | +# |
| 6 | +# Part A setup : WiLoR clone+patch (B2), MANO, weights, GPU check |
| 7 | +# Part B phase1 A->E : MoGe2 / GeoCalib / YOLO+WiLoR / MEMFOF+depth / |
| 8 | +# HaWoR infiller / SAM3+SAM2 masks / bg fill |
| 9 | +# (RUN_SAM3D=0 + RUN_TRACK=0: SAM3D-mesh needs >13 GB, |
| 10 | +# D-track needs meshes -> covered by Part C instead) |
| 11 | +# Part C post-track : canonical 8-stage post-tracking on a mesh-containing |
| 12 | +# pkl (pose_track / grasp_veto / bake / scale / spurious) |
| 13 | +# |
| 14 | +# SAM3D mesh generation (Phase D-sam3d) is intentionally skipped (VRAM); the |
| 15 | +# pre-computed meshes in the dev clip are reused for Part C. |
| 16 | +# |
| 17 | +# Usage: |
| 18 | +# bash tests/smoke/run_pipeline_smoke.sh |
| 19 | +# Override via env: PYTHON, EGOINFINITY_CKPT_DIR, DEV_REPO, CLIP, OUT_ROOT, MANO_SRC |
| 20 | +set -uo pipefail |
| 21 | + |
| 22 | +# ── Resolve repo root (this script lives in tests/smoke/) ──────────────────── |
| 23 | +HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" |
| 24 | +REPO="$(cd "$HERE/../.." && pwd)" |
| 25 | +cd "$REPO" |
| 26 | + |
| 27 | +PYTHON="${PYTHON:-python}" |
| 28 | +DEV_REPO="${DEV_REPO:-$REPO/../EgoInfinity-dev}" |
| 29 | +CLIP="${CLIP:--F8ykWfiTZg_417.5_431.3}" # a dev clip with frames/ + sam3_meshes/ |
| 30 | +DEV_FAV="${DEV_FAV:-$DEV_REPO/exo_browser/cache/favorites}" |
| 31 | +OUT_ROOT="${OUT_ROOT:-/tmp/ei_smoke}" |
| 32 | +MANO_SRC="${MANO_SRC:-$DEV_REPO/third_party/wilor/mano_data/MANO_RIGHT.pkl}" |
| 33 | + |
| 34 | +# Use the dev repo's weights if the official checkout has none. |
| 35 | +if [ -z "${EGOINFINITY_CKPT_DIR:-}" ] && [ ! -f "$REPO/pretrained_models/wilor_final.ckpt" ]; then |
| 36 | + export EGOINFINITY_CKPT_DIR="$DEV_REPO/pretrained_models" |
| 37 | +fi |
| 38 | +CKPT="${EGOINFINITY_CKPT_DIR:-$REPO/pretrained_models}" |
| 39 | + |
| 40 | +say() { printf '\n\033[1m== %s ==\033[0m\n' "$*"; } |
| 41 | +A_OK=skip; B_OK=skip; C_OK=skip |
| 42 | + |
| 43 | +# ── Part A: setup + preflight ──────────────────────────────────────────────── |
| 44 | +say "Part A: setup + preflight" |
| 45 | +echo "repo=$REPO python=$($PYTHON -c 'import sys;print(sys.executable)') ckpt=$CKPT" |
| 46 | + |
| 47 | +if ! $PYTHON -c "import torch,sys; sys.exit(0 if torch.cuda.is_available() else 1)" 2>/dev/null; then |
| 48 | + echo "FATAL: torch.cuda.is_available() is False — bring up the NVIDIA driver first." |
| 49 | + echo " (4070 Ti needs the nvidia module for the running kernel; see notes.)" |
| 50 | + exit 1 |
| 51 | +fi |
| 52 | +echo "GPU: $($PYTHON -c 'import torch;print(torch.cuda.get_device_name(0))' 2>/dev/null)" |
| 53 | + |
| 54 | +# WiLoR (B2): clone upstream + apply patch if not already present |
| 55 | +if [ ! -f third_party/wilor/models/wilor.py ]; then |
| 56 | + echo "WiLoR not present — running scripts/setup_wilor.sh ..." |
| 57 | + bash scripts/setup_wilor.sh || { echo "FATAL: setup_wilor.sh failed"; exit 1; } |
| 58 | +fi |
| 59 | +# MANO (non-redistributable): copy from dev if missing |
| 60 | +if [ ! -f third_party/wilor/mano_data/MANO_RIGHT.pkl ]; then |
| 61 | + if [ -f "$MANO_SRC" ]; then cp "$MANO_SRC" third_party/wilor/mano_data/ && echo "MANO copied from $MANO_SRC"; |
| 62 | + else echo "FATAL: MANO_RIGHT.pkl missing and not at $MANO_SRC"; exit 1; fi |
| 63 | +fi |
| 64 | +# weights |
| 65 | +miss=0 |
| 66 | +for w in detector.pt wilor_final.ckpt sam2.1_hiera_small.pt infiller.pt; do |
| 67 | + [ -f "$CKPT/$w" ] && echo " ok $w" || { echo " MISSING $w"; miss=1; } |
| 68 | +done |
| 69 | +[ "$miss" = 0 ] || { echo "FATAL: weights missing in $CKPT (set EGOINFINITY_CKPT_DIR or run scripts/setup_weights.sh)"; exit 1; } |
| 70 | +[ -d "$DEV_FAV/$CLIP" ] || { echo "FATAL: clip not found: $DEV_FAV/$CLIP (set CLIP / DEV_FAV)"; exit 1; } |
| 71 | +A_OK=PASS |
| 72 | +echo "Part A: PASS" |
| 73 | + |
| 74 | +# ── Part B: phase1 (A->E), skip SAM3D-mesh + D-track ───────────────────────── |
| 75 | +say "Part B: phase1 A->E smoke (RUN_SAM3D=0, RUN_TRACK=0)" |
| 76 | +B_DIR="$OUT_ROOT/phase1/$CLIP" |
| 77 | +rm -rf "$B_DIR" |
| 78 | +$PYTHON -m egoinfinity import "$DEV_FAV/$CLIP" -o "$B_DIR" --copy || { echo "Part B: FAIL (import)"; B_OK=FAIL; } |
| 79 | +if [ "$B_OK" != FAIL ]; then |
| 80 | + EGOINFINITY_RUN_SAM3D=0 EGOINFINITY_RUN_TRACK=0 \ |
| 81 | + $PYTHON -m egoinfinity run phase1 "$B_DIR" -v |
| 82 | + rc=$? |
| 83 | + if [ $rc -eq 0 ] && [ -f "$B_DIR/pipeline_result.pkl.gz" ]; then |
| 84 | + sz=$(du -h "$B_DIR/pipeline_result.pkl.gz" | cut -f1) |
| 85 | + echo "Part B: PASS (re-ran phase1 A->E; pkl=$sz)"; B_OK=PASS |
| 86 | + else |
| 87 | + echo "Part B: FAIL (exit=$rc, pkl present=$([ -f "$B_DIR/pipeline_result.pkl.gz" ] && echo yes || echo no))"; B_OK=FAIL |
| 88 | + fi |
| 89 | +fi |
| 90 | + |
| 91 | +# ── Part C: canonical post-tracking on a mesh-containing pkl ───────────────── |
| 92 | +say "Part C: post-tracking smoke (canonical 6-stage)" |
| 93 | +C_DIR="$OUT_ROOT/posttrack/$CLIP" |
| 94 | +rm -rf "$C_DIR" |
| 95 | +$PYTHON -m egoinfinity import "$DEV_FAV/$CLIP" -o "$C_DIR" --copy || { echo "Part C: FAIL (import)"; C_OK=FAIL; } |
| 96 | +if [ "$C_OK" != FAIL ]; then |
| 97 | + $PYTHON -m egoinfinity process "$C_DIR" \ |
| 98 | + --config tests/smoke/smoke_canonical.yaml \ |
| 99 | + --force pose_track_p1,grasp_veto,pose_track_p2,bake_fp,scale_sanity,spurious -v |
| 100 | + rc=$? |
| 101 | + [ $rc -eq 0 ] && { echo "Part C: PASS (canonical post-tracking ran)"; C_OK=PASS; } \ |
| 102 | + || { echo "Part C: FAIL (exit=$rc)"; C_OK=FAIL; } |
| 103 | +fi |
| 104 | + |
| 105 | +# ── Summary ────────────────────────────────────────────────────────────────── |
| 106 | +say "SMOKE SUMMARY" |
| 107 | +echo " A setup : $A_OK" |
| 108 | +echo " B phase1 A->E : $B_OK (WiLoR Phase B / MoGe2 / SAM3+SAM2 / MEMFOF / infiller)" |
| 109 | +echo " C post-track : $C_OK (pose_track / grasp_veto / bake / scale / spurious)" |
| 110 | +echo "" |
| 111 | +echo "Skipped by design: SAM3D mesh gen (Phase D-sam3d, needs >13 GB) + D-track" |
| 112 | +echo " (D-track + post-track numeric parity vs dev is already 29/29 — tests/smoke/REPORT.md)" |
| 113 | +[ "$B_OK" = PASS ] && [ "$C_OK" = PASS ] && { echo "RESULT: PASS"; exit 0; } || { echo "RESULT: FAIL"; exit 1; } |
0 commit comments