-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·310 lines (284 loc) · 12 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·310 lines (284 loc) · 12 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
#!/usr/bin/env bash
# Tether VLA bootstrap installer
# Runs hardware + Python checks BEFORE pip install so users on
# unsupported configs don't waste time debugging the wrong thing.
#
# Usage:
# curl -sSf https://fastcrest.com/install | sh
# curl -sSf https://fastcrest.com/install | sh -s -- --extras serve,gpu
# curl -sSf https://fastcrest.com/install | sh -s -- --jetson --jetpack 6.2
#
# Source: https://github.com/FastCrest/tether
set -eu
# -- ANSI colors --------------------------------------------------------------
if [ -t 1 ] && [ -z "${NO_COLOR:-}" ]; then
BOLD="\033[1m"; DIM="\033[2m"; RESET="\033[0m"
RED="\033[31m"; GREEN="\033[32m"; YELLOW="\033[33m"; BLUE="\033[34m"; CYAN="\033[36m"
else
BOLD=""; DIM=""; RESET=""; RED=""; GREEN=""; YELLOW=""; BLUE=""; CYAN=""
fi
info() { printf "%b%s%b\n" "${BLUE}" "$*" "${RESET}"; }
ok() { printf "%b✓%b %s\n" "${GREEN}" "${RESET}" "$*"; }
warn() { printf "%b⚠%b %s\n" "${YELLOW}" "${RESET}" "$*"; }
fail() { printf "%b✗%b %s\n" "${RED}" "${RESET}" "$*"; }
note() { printf "%b%s%b\n" "${DIM}" "$*" "${RESET}"; }
printf "\n%b%s%b\n" "${BOLD}${CYAN}" "Tether VLA installer" "${RESET}"
note " Bootstrap that checks your environment before installing."
echo
# -- Parse args ---------------------------------------------------------------
EXTRAS=""
FORCE_JETSON=0
JETPACK_ARG=""
while [ $# -gt 0 ]; do
case "$1" in
--extras) EXTRAS="$2"; shift 2 ;;
--extras=*) EXTRAS="${1#--extras=}"; shift ;;
--jetson) FORCE_JETSON=1; shift ;;
--jetpack) JETPACK_ARG="$2"; shift 2 ;;
--jetpack=*) JETPACK_ARG="${1#--jetpack=}"; shift ;;
*) shift ;;
esac
done
# -- Detect OS ----------------------------------------------------------------
OS="$(uname -s)"
ARCH="$(uname -m)"
info "Environment"
echo " OS: $OS"
echo " Arch: $ARCH"
# -- Detect Python ------------------------------------------------------------
PYTHON=""
for candidate in python3.13 python3.12 python3.11 python3.10 python3 python; do
if command -v "$candidate" >/dev/null 2>&1; then
PYTHON="$candidate"; break
fi
done
if [ -z "$PYTHON" ]; then
echo
fail "No Python interpreter found."
note " Install Python 3.10+ first:"
note " macOS: brew install python@3.11"
note " Linux: pyenv install 3.11.9 && pyenv global 3.11.9"
exit 1
fi
PY_VER="$($PYTHON -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}")')"
PY_MAJOR="$($PYTHON -c 'import sys; print(sys.version_info.major)')"
PY_MINOR="$($PYTHON -c 'import sys; print(sys.version_info.minor)')"
echo " Python: $PY_VER ($PYTHON)"
echo
# -- Hardware detection -------------------------------------------------------
JETSON_MODEL=""
if [ -r /proc/device-tree/model ]; then
# Strip null bytes that Jetson DT model files often have
JETSON_MODEL="$(tr -d '\0' < /proc/device-tree/model 2>/dev/null || true)"
fi
IS_OLD_NANO=0
IS_JETSON=0
JETPACK_VERSION=""
if [ -n "$JETSON_MODEL" ]; then
case "$JETSON_MODEL" in
*"Jetson Nano"*|*"jetson-nano"*|*"Tegra X1"*|*"p3450"*|*"p3448"*)
IS_OLD_NANO=1 ;;
*"Orin"*|*"orin"*|*"Thor"*|*"thor"*)
IS_JETSON=1 ;;
esac
fi
# Detect JetPack version from nv_tegra_release if available
if [ "$IS_JETSON" -eq 1 ] || [ "$FORCE_JETSON" -eq 1 ]; then
if [ -r /etc/nv_tegra_release ]; then
# Format: # R36 (release), REVISION: 2.2, GCID: 34907586, BOARD: ...
# R36 = JetPack 6.x
JETPACK_VERSION="$(head -1 /etc/nv_tegra_release | grep -oP 'REVISION: \K[0-9.]+' || true)"
fi
# Override with explicit arg
if [ -n "$JETPACK_ARG" ]; then
JETPACK_VERSION="$JETPACK_ARG"
fi
fi
# -- Branch on hardware -------------------------------------------------------
if [ "$IS_OLD_NANO" -eq 1 ]; then
echo
fail "Detected: $JETSON_MODEL"
echo
warn "The original Jetson Nano (Maxwell, 2019) is too old for Tether."
note " • NVIDIA EOL'd it at JetPack 4.6 (Ubuntu 18 / Python 3.6) in 2022."
note " • Maxwell GPU has no Tensor Cores; modern VLA models can't run usefully."
note " • 4 GB shared memory will OOM loading pi0 / SmolVLA in FP32."
echo
info "Recommended paths:"
echo " ${BOLD}1. Run on a Mac${RESET} (CPU path, works for chat + dev)"
echo " pip install 'fastcrest-tether[serve,onnx]'"
echo " ${BOLD}2. Run on Jetson Orin${RESET} (Orin Nano / NX / AGX) — full GPU support"
echo " ${BOLD}3. Run in the cloud${RESET} (Modal, Lambda, RunPod with NVIDIA T4+)"
echo
exit 1
fi
# -- Python version check -----------------------------------------------------
if [ "$PY_MAJOR" -lt 3 ] || { [ "$PY_MAJOR" -eq 3 ] && [ "$PY_MINOR" -lt 10 ]; }; then
fail "Python $PY_VER is too old. Tether requires Python 3.10+."
echo
info "Install a newer Python:"
case "$OS" in
Darwin)
note " brew install python@3.11"
note " # or: pyenv install 3.11.9 && pyenv global 3.11.9" ;;
Linux)
note " pyenv install 3.11.9 && pyenv global 3.11.9"
note " # or via your distro: apt install python3.11 (Ubuntu 22+)" ;;
*)
note " Use pyenv or your platform's package manager to install Python 3.10+." ;;
esac
echo
exit 1
fi
ok "Python $PY_VER (>=3.10 required)"
# -- Jetson-specific Python version check ------------------------------------
# JetPack 6 ships Python 3.10. Jetson Zoo wheels are built for cp310.
# Running on Python 3.11+ means no pre-built GPU wheel and a source build.
if [ "$IS_JETSON" -eq 1 ] || [ "$FORCE_JETSON" -eq 1 ]; then
if [ "$PY_MINOR" -ne 10 ]; then
echo
warn "Jetson detected but Python is $PY_VER."
note " Jetson Zoo provides GPU wheels for Python 3.10 only."
note " Python $PY_VER will work for CPU inference but GPU (CUDA) may fail."
note " Recommended: use Python 3.10, e.g. pyenv or a Docker image."
echo
if [ "$FORCE_JETSON" -eq 0 ]; then
read -r -p "Continue anyway? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY]) ;; # continue
*) exit 1 ;;
esac
fi
fi
fi
# -- Pick install extras based on detected platform ---------------------------
if [ -z "$EXTRAS" ]; then
if [ "$IS_JETSON" -eq 1 ] || [ "$FORCE_JETSON" -eq 1 ]; then
# NEVER install [gpu] on Jetson — those are x86_64 wheels (nvidia-cu12,
# tensorrt). They will either fail to install, segfault, or silently
# fall back to CPU.
#
# NEVER install [monolithic] on Jetson — it depends on lerobot==0.5.1
# which requires Python >=3.12. JetPack 6 ships Python 3.10. Export
# on a Python 3.12+ host, then serve the ONNX on the Jetson.
#
# Instead we install [serve] only, and pre-install numpy<2, torch, and
# onnxruntime-gpu from the Jetson AI Lab index BEFORE tether so
# pip doesn't pull incompatible x86_64 or numpy-2.x-linked wheels.
EXTRAS="serve"
ok "Detected Jetson ($JETSON_MODEL) → installing with [serve]"
note " Jetson-specific GPU deps (numpy<2, torch, ort) will be installed first."
note " [monolithic] skipped — lerobot requires Python >=3.12 (Jetson has 3.10)."
note " Export on a desktop/cloud host, then serve the ONNX here."
elif [ "$OS" = "Darwin" ]; then
EXTRAS="serve,onnx,monolithic"
ok "Detected macOS → installing with [serve,onnx,monolithic] (CPU runtime)"
elif command -v nvidia-smi >/dev/null 2>&1; then
EXTRAS="serve,gpu,monolithic"
ok "Detected NVIDIA GPU → installing with [serve,gpu,monolithic]"
else
EXTRAS="serve,onnx,monolithic"
ok "No GPU detected → installing with [serve,onnx,monolithic] (CPU runtime)"
fi
if [ "$IS_JETSON" -eq 0 ] && echo "$EXTRAS" | grep -q "monolithic"; then
note " (monolithic adds the extras 'tether go' needs to actually deploy a model — not just chat)"
fi
fi
echo
# -- Ensure pip is available --------------------------------------------------
if ! "$PYTHON" -m pip --version >/dev/null 2>&1; then
warn "pip not available for $PYTHON — trying to bootstrap via ensurepip"
if "$PYTHON" -m ensurepip --upgrade >/dev/null 2>&1; then
ok "Installed pip via ensurepip"
else
fail "pip is missing and ensurepip can't bootstrap it on this system."
echo
info "Install pip for your distro, then re-run this installer:"
note " Arch: sudo pacman -S python-pip"
note " Debian: sudo apt install python3-pip"
note " Fedora: sudo dnf install python3-pip"
note " Alpine: sudo apk add py3-pip"
note " macOS: pip ships with the Python.org installer / Homebrew Python"
echo
exit 1
fi
fi
# -- Jetson: pre-install GPU deps from Jetson AI Lab --------------------------
# This MUST happen BEFORE `pip install fastcrest-tether[serve]` so that:
# 1. numpy<2 is locked in place before torch's transitive dep pulls 2.x
# 2. torch comes from the Jetson AI Lab aarch64 wheel (not PyPI x86_64)
# 3. onnxruntime-gpu comes from Jetson AI Lab (not the unresolvable PyPI one)
if [ "$IS_JETSON" -eq 1 ] || [ "$FORCE_JETSON" -eq 1 ]; then
echo
info "Pre-installing Jetson GPU dependencies..."
# JetPack version → index URL mapping
# Default to JP6.0/6.1 (cu126) since that's the current standard.
# JP6.2+ uses cu129 and has cp310 + cp312 wheels.
case "${JETPACK_VERSION:-}" in
6.2*|6.3*|6.4*)
JETSON_INDEX="https://pypi.jetson-ai-lab.io/jp6/cu129"
ok "Detected JetPack $JETPACK_VERSION → using cu129 index"
;;
6.0*|6.1*|""|*)
JETSON_INDEX="https://pypi.jetson-ai-lab.io/jp6/cu126"
if [ -n "${JETPACK_VERSION:-}" ]; then
ok "Detected JetPack $JETPACK_VERSION → using cu126 index"
else
warn "Could not detect JetPack version. Assuming JetPack 6.0/6.1 (cu126)."
note " If you are on JetPack 6.2+, run with: --jetpack 6.2"
fi
;;
esac
# 1. Pin numpy<2 FIRST — Jetson AI Lab torch and ort wheels are compiled
# against numpy 1.x C ABI. numpy 2.x causes:
# "A module that was compiled using NumPy 1.x cannot be run in NumPy 2.x"
note " Step 1/3: Pinning numpy<2 for Jetson AI Lab ABI compatibility..."
"$PYTHON" -m pip install 'numpy<2' || warn "numpy pin failed — may cause runtime issues"
# 2. Install Jetson-native torch (aarch64, CUDA-enabled)
note " Step 2/3: Installing torch from Jetson AI Lab index..."
if "$PYTHON" -m pip install --index-url "$JETSON_INDEX" torch torchvision; then
ok "Installed torch (Jetson AI Lab, $JETSON_INDEX)"
else
warn "Jetson AI Lab torch install failed — pip will fall back to PyPI torch."
note " PyPI torch may be CPU-only on aarch64."
fi
# 3. Install Jetson-native onnxruntime-gpu
note " Step 3/3: Installing onnxruntime-gpu from Jetson AI Lab index..."
if "$PYTHON" -m pip install --index-url "$JETSON_INDEX" onnxruntime-gpu; then
ok "Installed onnxruntime-gpu (Jetson AI Lab, $JETSON_INDEX)"
else
echo
fail "Jetson AI Lab onnxruntime-gpu install failed."
info "Manual install command:"
note " $PYTHON -m pip install 'numpy<2'"
note " $PYTHON -m pip install --index-url $JETSON_INDEX torch torchvision"
note " $PYTHON -m pip install --index-url $JETSON_INDEX onnxruntime-gpu"
echo
warn "Tether will be installed but inference will fall back to CPU (slow)."
fi
echo
fi
# -- Run pip install ----------------------------------------------------------
PIP_TARGET="fastcrest-tether[$EXTRAS]"
info "Installing: $PIP_TARGET"
echo
"$PYTHON" -m pip install --upgrade "$PIP_TARGET"
echo
ok "Installed."
echo
info "Next:"
echo " tether doctor # check your install (Jetson: should show CUDAExecutionProvider)"
echo " tether chat # natural-language CLI"
echo " tether --help # see all commands"
echo
if [ "$IS_JETSON" -eq 1 ] || [ "$FORCE_JETSON" -eq 1 ]; then
info "Jetson deployment:"
echo " tether go --preset franka # one-command deploy (after ONNX export)"
echo " tether serve /path/to/export # serve a pre-exported model"
echo
note "For the published Jetson/arm64 Docker image:"
note " docker pull ghcr.io/fastcrest/tether:latest-arm64"
note " # Bring-your-own JetPack CUDA/cuDNN/TensorRT via nvidia-container-runtime."
note " # For fully-bundled local experiments, build Dockerfile.jetpack yourself."
fi
note "Source: https://github.com/FastCrest/tether"