File size: 5,171 Bytes
bd240f3
 
 
 
69353c8
 
bd240f3
 
69353c8
 
 
 
 
 
 
 
bd240f3
 
69353c8
 
c30b792
69353c8
c30b792
 
 
 
bd240f3
c30b792
 
 
 
bd240f3
c30b792
 
bd240f3
 
c30b792
 
bd240f3
c30b792
 
 
 
 
 
 
 
 
 
 
 
bd240f3
c30b792
 
 
69353c8
 
c30b792
 
 
 
 
 
 
 
 
 
 
 
bd240f3
c30b792
 
 
bd240f3
69353c8
 
 
c30b792
 
 
 
 
 
 
 
 
 
69353c8
 
 
 
 
 
 
 
c30b792
bd240f3
 
 
 
 
 
 
 
 
 
c30b792
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#!/usr/bin/env bash
set -euo pipefail

# Set up a conda environment capable of running the full online GWAM final graph:
# RoboCasa/robosuite + torch + SAM2 code + OpenAI CLIP.
#
# Usage:
#   bash scripts/setup_realtime_final_graph_env.sh robocasa
#
# Notes:
# - This script installs SAM2/CLIP code. The SAM2/CLIP checkpoints are bundled
#   under models/ in the HF package and are used by default.
# - RoboCasa assets are not redistributed here; users must comply with RoboCasa
#   upstream setup/asset instructions.
# - The torch command below targets CUDA 13.0 wheels. Change the index/device for
#   CPU or other CUDA versions.

ENV_NAME="${1:-robocasa}"
WORK_ROOT="${GWAM_SETUP_ROOT:-$HOME/gwam_realtime_deps}"
ROBOCASA_ROOT="${ROBOCASA_ROOT:-$WORK_ROOT/robocasa}"
ROBOSUITE_ROOT="${ROBOSUITE_ROOT:-$WORK_ROOT/robosuite}"
SAM2_ROOT="${SAM2_ROOT:-$WORK_ROOT/sam2}"
ROBOSUITE_COMMIT="5ce6643f3092639d08f7b0f90ed1c6a84f50552c"
ROBOCASA_COMMIT="b4684e6ee37d377cc392e98302a6b916d588b415"
SAM2_COMMIT="2b90b9f5ceec907a1c18123530e92e794ad901a4"
CLIP_COMMIT="d05afc436d78f1c48dc0dbf8e5980a9d471f35f6"

if command -v conda >/dev/null 2>&1; then
  CONDA_EXE="$(command -v conda)"
elif [[ -x /home/chris/anaconda3/bin/conda ]]; then
  CONDA_EXE="/home/chris/anaconda3/bin/conda"
else
  echo "conda not found; install Miniconda/Anaconda first" >&2
  exit 2
fi

if ! "$CONDA_EXE" env list | awk '{print $1}' | grep -qx "$ENV_NAME"; then
  "$CONDA_EXE" create -y -n "$ENV_NAME" python=3.11
fi
CONDA_BASE="$("$CONDA_EXE" info --base)"
ENV_PREFIX="$("$CONDA_BASE/bin/python" - "$ENV_NAME" <<'PY'
import json, subprocess, sys
name = sys.argv[1]
payload = json.loads(subprocess.check_output([sys.executable.replace('/bin/python', '/bin/conda'), 'env', 'list', '--json'], text=True))
matches = [path for path in payload['envs'] if path.rsplit('/', 1)[-1] == name]
if len(matches) != 1:
    raise SystemExit(f'expected one conda environment named {name}, got {matches}')
print(matches[0])
PY
)"
PYTHON="$ENV_PREFIX/bin/python"

"$PYTHON" -m pip install --upgrade pip
"$PYTHON" -m pip install numpy opencv-python
"$PYTHON" -m pip install "git+https://github.com/openai/CLIP.git@${CLIP_COMMIT}"

mkdir -p "$WORK_ROOT"

# RoboCasa main requires robosuite master APIs such as load_model_on_init.
# The PyPI robosuite==1.5.2 release is not compatible with RoboCasa 1.0.1.
if [[ ! -d "$ROBOSUITE_ROOT/.git" ]]; then
  git clone https://github.com/ARISE-Initiative/robosuite.git "$ROBOSUITE_ROOT"
fi
git -C "$ROBOSUITE_ROOT" fetch origin "$ROBOSUITE_COMMIT"
git -C "$ROBOSUITE_ROOT" checkout --detach "$ROBOSUITE_COMMIT"
"$PYTHON" -m pip install -e "$ROBOSUITE_ROOT"

if [[ ! -d "$ROBOCASA_ROOT/.git" ]]; then
  git clone https://github.com/robocasa/robocasa.git "$ROBOCASA_ROOT"
fi
git -C "$ROBOCASA_ROOT" fetch origin "$ROBOCASA_COMMIT"
git -C "$ROBOCASA_ROOT" checkout --detach "$ROBOCASA_COMMIT"
"$PYTHON" -m pip install -e "$ROBOCASA_ROOT"

if [[ ! -d "$SAM2_ROOT/.git" ]]; then
  git clone https://github.com/facebookresearch/sam2.git "$SAM2_ROOT"
fi
git -C "$SAM2_ROOT" fetch origin "$SAM2_COMMIT"
git -C "$SAM2_ROOT" checkout --detach "$SAM2_COMMIT"
"$PYTHON" -m pip install -e "$SAM2_ROOT"

# RoboCasa/LeRobot dependencies may downgrade torch to a CUDA 12.6 wheel that
# cannot execute on Blackwell (sm_120). Re-assert the CUDA 13 wheel last.
"$PYTHON" -m pip install --upgrade torch torchvision --index-url https://download.pytorch.org/whl/cu130
# Reinstall NCCL from PyPI: the dependency copy selected during mixed-index
# resolution can carry the same version metadata but omit ncclCommResume.
"$PYTHON" -m pip install --force-reinstall --no-cache-dir nvidia-nccl-cu13==2.29.7

cat <<'EOF'

RoboCasa code deps are installed. If this is a fresh machine, also install/download
RoboCasa kitchen assets according to upstream RoboCasa instructions before running
live simulator tasks. This dataset does not redistribute RoboCasa assets.
EOF

"$PYTHON" - <<'PY'
import importlib.util
missing=[]
for m in ['robocasa','robosuite','torch','clip','sam2','cv2','numpy']:
    ok = importlib.util.find_spec(m) is not None
    print(m, ok)
    if not ok: missing.append(m)
if missing:
    raise SystemExit(f'missing imports: {missing}')
print('setup_realtime_final_graph_env_ok')
PY

"$PYTHON" - <<'PY'
import torch
print("torch", torch.__version__, "cuda", torch.version.cuda, "available", torch.cuda.is_available())
if torch.cuda.is_available():
    value = float((torch.ones(8, device="cuda") ** 2).sum().item())
    if value != 8.0:
        raise SystemExit(f"CUDA execution smoke differs: {value}")
    print("setup_realtime_final_graph_cuda_smoke_ok", value)
PY

"$PYTHON" - <<PY
from pathlib import Path
checks = {
    Path("$ROBOSUITE_ROOT"): "$ROBOSUITE_COMMIT",
    Path("$ROBOCASA_ROOT"): "$ROBOCASA_COMMIT",
    Path("$SAM2_ROOT"): "$SAM2_COMMIT",
}
import subprocess
for root, expected in checks.items():
    got = subprocess.check_output(["git", "-C", str(root), "rev-parse", "HEAD"], text=True).strip()
    print(root.name, got)
    if got != expected:
        raise SystemExit(f"commit mismatch for {root}: {got} != {expected}")
print("setup_realtime_final_graph_commits_ok")
PY