-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·214 lines (190 loc) · 8.77 KB
/
setup.sh
File metadata and controls
executable file
·214 lines (190 loc) · 8.77 KB
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#!/bin/bash
# ============================================================
# SIM1 dependency installation (setup.sh)
#
# Installs all dependencies for SIM1-DataGen and SIM1-Sim,
# including MuJoCo, Warp, and the Newton physics engine.
#
# Prerequisites:
# - A conda environment activated with Python 3.11
# conda create -n sim1 python=3.11 -y && conda activate sim1
# - CUDA toolkit >= 11.8
#
# Reference:
# https://newton-physics.github.io/newton/0.2.2/guide/installation.html#method-3-manual-setup-using-pip-in-a-virtual-environment
#
# Usage:
# conda activate sim1
# bash setup.sh
#
# PyTorch wheels (optional override):
# Default: CUDA 12.x (cu124 index). For CPU-only:
# TORCH_INDEX_URL=https://download.pytorch.org/whl/cpu bash setup.sh
#
# Render pipeline (components/render/main.py Steps 1–4, MeisterRender submodule) is installed
# by default into the same conda env: yourdfpy, imageio, lmdb, bpy, omegaconf, minexr, opencv-python, …
# See components/render/README.md for package → step mapping.
# To skip (e.g. bpy wheel unavailable on your platform):
# SIM1_SKIP_RENDER=1 bash setup.sh
#
# What gets installed (exact pip lines are in the script body; README does not duplicate this list):
# - mujoco, mujoco-warp, warp-lang (NVIDIA pre-release index)
# - Newton from ./newton (pip install -e ".[dev]")
# - torch, torchvision, torchaudio (TORCH_INDEX_URL, default CUDA 12.4 / cu124)
# - einops, rotary-embedding-torch, diffusers (DataGen --use_dp)
# - numpy, scipy, matplotlib, opencv-python-headless, Pillow, tqdm, lmdb, imageio[ffmpeg], huggingface_hub
# - unless SIM1_SKIP_RENDER=1: render packages (yourdfpy/imageio/lmdb/bpy/minexr/omegaconf/opencv-python/...)
# ============================================================
set -e
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "============================================================"
echo " SIM1 Installation"
echo "============================================================"
echo "Project root: $PROJECT_ROOT"
echo ""
# ─── Step 1: Install MuJoCo and Warp ───────────────────────
echo "[Step 1/5] Installing MuJoCo..."
python -m pip install mujoco
echo ""
echo "[Step 2/5] Installing MuJoCo-Warp..."
python -m pip install mujoco-warp
echo ""
echo "[Step 3/5] Installing NVIDIA Warp (pre-release)..."
python -m pip install warp-lang --pre -U -f https://pypi.nvidia.com/warp-lang/
# ─── Step 2: Install Newton (editable mode) ────────────────
echo ""
echo "[Step 4/5] Installing Newton physics engine (editable)..."
NEWTON_DIR="${PROJECT_ROOT}/newton"
if [ ! -d "${NEWTON_DIR}" ] || [ ! -f "${NEWTON_DIR}/pyproject.toml" ]; then
echo "Error: Newton source not found at ${NEWTON_DIR}"
echo "Please ensure the newton/ directory contains the Newton source code."
echo " Expected: ${NEWTON_DIR}/pyproject.toml"
exit 1
fi
cd "${NEWTON_DIR}"
python -m pip install -e ".[dev]"
cd "${PROJECT_ROOT}"
# ─── Step 3: PyTorch (DataGen / diffusion pipeline) ────────
echo ""
echo "[Step 5/5] Installing PyTorch (torch, torchvision, torchaudio)..."
TORCH_INDEX_URL="${TORCH_INDEX_URL:-https://download.pytorch.org/whl/cu124}"
python -m pip install torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 --index-url "${TORCH_INDEX_URL}"
echo ""
echo "[Info] Installing DataGen dependencies required by run_pipeline/datagen (einops, rotary-embedding-torch, diffusers)..."
python -m pip install -U einops rotary-embedding-torch diffusers
# ─── Step 4: Other Python dependencies ─────────────────────
echo ""
echo "[Info] Installing additional dependencies..."
# lmdb + imageio: required by components/render/step4_render_acone.py (always import before Step 4)
# huggingface_hub: required by download_assets.sh (asset download from HuggingFace)
python -m pip install numpy scipy matplotlib opencv-python-headless Pillow tqdm lmdb "imageio[ffmpeg]" huggingface_hub
# ─── Render stack (default): main.py Steps 1–4 + MeisterRender / step4_render_acone.py ──
if [ "${SIM1_SKIP_RENDER:-0}" = "1" ]; then
echo ""
echo "[Info] Skipping render pipeline install (SIM1_SKIP_RENDER=1)."
else
echo ""
echo "============================================================"
echo " SIM1 render stack (components/render/) — default install"
echo " pip: all render deps from setup.sh (no separate install needed)"
echo "============================================================"
echo ""
echo "[Render] Installing Steps 1-4 dependencies..."
# Inline all render dependencies here so users only run setup.sh once.
# Step 1-3:
# yourdfpy, tqdm
# Step 4 + MeisterRender:
# imageio[ffmpeg], lmdb, bpy, minexr, omegaconf, opencv-python
python -m pip install \
yourdfpy \
tqdm \
"imageio[ffmpeg]" \
lmdb \
"bpy==4.5" \
"minexr==1.0.2" \
"omegaconf==2.3.0" \
"opencv-python==4.10.0.84"
echo ""
echo "[Render] Verifying MeisterRender (step4_render_acone.py) import ..."
python -c "
import os, sys
root = r'${PROJECT_ROOT}/components/render/MeisterRender'
if os.path.isdir(root):
sys.path.insert(0, root)
from api import RenderEngine
print(' MeisterRender RenderEngine OK')
else:
print(' Warning: MeisterRender submodule not found; run git submodule update --init --recursive')
" || echo " Warning: MeisterRender import check failed."
fi
# ─── Verify installation ───────────────────────────────────
echo ""
echo "============================================================"
echo " Verifying Installation"
echo "============================================================"
echo ""
echo "[Verify] Checking Newton import..."
python -c "import newton; print(' Newton version:', newton.__version__)" 2>/dev/null || {
echo " Warning: Could not import newton. Please check the installation."
}
echo ""
echo "[Verify] Checking Warp import..."
python -c "import warp as wp; print(' Warp OK')" 2>/dev/null || {
echo " Warning: Could not import warp."
}
echo ""
echo "[Verify] Checking PyTorch..."
python -c "import torch; import torchvision; print(' torch:', torch.__version__, '| cuda:', torch.cuda.is_available())" 2>/dev/null || {
echo " Warning: Could not import torch/torchvision."
}
echo ""
echo "[Verify] Checking DataGen DP stack (einops, rotary_embedding_torch, diffusers)..."
python -c "import einops; import rotary_embedding_torch; import diffusers; print(' einops / rotary_embedding_torch / diffusers OK')" 2>/dev/null || {
echo " Warning: Could not import einops, rotary_embedding_torch, or diffusers."
}
echo ""
echo "[Verify] Checking huggingface_hub (required by download_assets.sh)..."
python -c "import huggingface_hub; print(' huggingface_hub', huggingface_hub.__version__, 'OK')" 2>/dev/null || {
echo " Warning: Could not import huggingface_hub."
}
echo ""
echo "[Verify] Checking Python version..."
python --version
if [ "${SIM1_SKIP_RENDER:-0}" != "1" ]; then
echo ""
echo "[Verify] Render pipeline (yourdfpy, imageio, lmdb, Step 4 / MeisterRender) ..."
python -c "import yourdfpy; import imageio; import lmdb; print(' yourdfpy / imageio / lmdb OK')" 2>/dev/null || {
echo " Warning: yourdfpy, imageio, or lmdb import failed."
}
fi
echo ""
echo "============================================================"
echo " Installation Complete!"
echo "============================================================"
echo ""
echo "Quick start (run from project root: cd \"${PROJECT_ROOT}\"):"
echo ""
echo " # Interactive teleoperation (requires display/OpenGL)"
echo " python apps/teleoperation_app.py --task lift_manip_shirt"
echo ""
echo " # Data generation"
echo " python apps/datagen_app.py --data_folder ./dataset/example --num 2 --use_dp"
echo ""
echo " # Replay: headless (default, no window)"
echo " python apps/replay_app.py ./dataset/example/gen/000000.npz"
echo ""
echo " # Replay: OpenGL window (visualize)"
echo " python apps/replay_app.py ./dataset/example/gen/000000.npz --no-headless"
echo ""
echo " # Replay: window + save MP4 (--save_video requires --no-headless)"
echo " python apps/replay_app.py ./dataset/example/gen/000000.npz --no-headless --save_video"
echo ""
echo " # Replay outputs: replay/<folder_name>_NNNN/{npz,usd,video}/ (NNNN auto-increments)"
echo ""
echo " # Render: Steps 1–3 (default), then batch Step 4"
echo " python components/render/main.py --root_dir ./replay/your_session_0001"
echo " bash components/render/batch_step4.sh ./replay/your_session_0001"
echo ""
echo " # Skip render packages during setup: SIM1_SKIP_RENDER=1 bash setup.sh"
echo ""
echo "For more details, see README.md and components/render/README.md"