JingwuLuo commited on
Commit
4df08ca
·
verified ·
1 Parent(s): a1d33b6

Add README.md

Browse files
Files changed (1) hide show
  1. README.md +111 -0
README.md ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ tags:
4
+ - robotics
5
+ - unitree-g1
6
+ - pi0.5
7
+ - ggml
8
+ ---
9
+
10
+ # G1 pi0.5 deployment bundle
11
+
12
+ Migration snapshot of an on-Orin pi0.5 inference stack for a Unitree G1:
13
+ a WebSocket policy server running `pi0.5-ggml` (CUDA, `sm_87`) on the robot's
14
+ Jetson Orin NX, plus the GGUF exports it serves and the client it talks to.
15
+
16
+ Captured 2026-09-17 from `unitree-g1-nx` (Jetson Orin NX, JetPack / CUDA 12.6,
17
+ 15 GB unified memory).
18
+
19
+ ## Contents
20
+
21
+ | path | size | what |
22
+ |---|---:|---|
23
+ | `g1-migration-code.zip` | 124 MB | all source (see below) |
24
+ | `models/gguf_fp16/` | 6.3 GB | FP16 GGUF export — the accuracy baseline |
25
+ | `models/gguf_q8_h32/` | 3.9 GB | Q8_0 GGUF export — the quantized candidate |
26
+ | `models/stack-cube-eef-24k_pytorch/` | 7.3 GB | source PyTorch checkpoint (copy of `LGG100/stack-cube-eef-24k`) |
27
+
28
+ `g1-migration-code.zip` unpacks to:
29
+
30
+ ```
31
+ pi0.5-server/ the policy server + open-loop eval harness (written for this deployment)
32
+ g1-client/ robot-side client (git: luo-jingw/g1-client)
33
+ pi05-main/ pi0.5-ggml, master (git: luo-jingw/pi0.5-ggml)
34
+ pi05-neowise/ pi0.5-ggml, amir_neowise_q8 branch
35
+ datasets/ 3 episodes of LGG100/Stack-the-cubes, for the open-loop test
36
+ models/ckpt_h32/config.json the corrected export config (see below)
37
+ ```
38
+
39
+ `build/` directories, `.git/`, and `__pycache__` were excluded. The three source
40
+ trees are live git repos upstream — prefer cloning them and using this zip only
41
+ for `pi0.5-server/` and to see exactly which commits were deployed.
42
+
43
+ Start at `pi0.5-server/README.md`.
44
+
45
+ ## Two corrections baked into these exports
46
+
47
+ Both were real bugs found while bringing this up; the models here have them fixed.
48
+
49
+ **1. `action_horizon` must be 32, not 10.** The PyTorch checkpoint's
50
+ `config.json` says `action_horizon = 10`, which is a placeholder borrowed during
51
+ conversion, not the training value. Exporting with 10 made the arm travel only
52
+ **4–5 mm per chunk** — it looked like the robot was barely moving. At 32 it is
53
+ 20–38 mm. Corroborated independently: GGUFs built from this checkpoint through
54
+ the correct pipeline elsewhere all carry `action_horizon = 32`.
55
+
56
+ `models/ckpt_h32/config.json` in the zip is the corrected config used for these
57
+ exports.
58
+
59
+ **2. Do not feed the model a discrete state vector.** `pi05_g1_eef` was not
60
+ trained with state as an input (confirmed by the model owner). pi0.5-ggml only
61
+ wants one for checkpoints trained with `discrete_state_input=True`
62
+ (`include/pi05.h:92`); passing it otherwise wraps the prompt into a
63
+ `Task:/State:` form the model never saw. The server accepts
64
+ `observation.state` on the wire but does not forward it unless
65
+ `--discrete-state` is given.
66
+
67
+ Measured open-loop, FP16, mean EEF position error over a chunk:
68
+ **22.2 mm with state vs 9.0 mm without**.
69
+
70
+ ## Measured on this hardware
71
+
72
+ Open-loop against `LGG100/Stack-the-cubes` (24 samples / 3 episodes,
73
+ `--steps 10`, state omitted). Mean EEF position error, both arms:
74
+
75
+ | | t=0 | whole chunk | latency | peak host mem |
76
+ |---|---:|---:|---:|---:|
77
+ | FP16 (stock ggml) | **8.7 mm** | **9.0 mm** | ~1484 ms | 9.8 GB |
78
+ | Q8_0 + NEOWISE variant 4 | 24.4 mm | 28.5 mm | ~1150 ms | 10.0 GB |
79
+ | "hold current pose" baseline | — | 17.0 mm | — | — |
80
+
81
+ The NEOWISE Q8 INT8 kernel (`amir_neowise_q8` branch) costs **~3.2× accuracy**
82
+ here and does not beat a do-nothing baseline. Its published −25 % speedup was
83
+ measured on AGX Thor (Blackwell); `docs/neowise.md` listed Orin as unmeasured.
84
+ On this Orin NX it is also *slower* than stock in end-to-end benchmark
85
+ (1227.8 ms vs 1199.7 ms) and uses 2.5 GB more memory.
86
+
87
+ Caveats on the accuracy numbers: `Stack-the-cubes` stores **joint** actions
88
+ while this is an **EEF** checkpoint, so ground truth is pushed through the same
89
+ forward kinematics the runtime uses — this is not the checkpoint's training set,
90
+ and the FK frame convention is unverified against training. A frame mismatch
91
+ would shift all absolute errors; the FP16-vs-Q8 comparison is unaffected. The
92
+ dataset is also `Unitree_G1_Dex1_Sim` (simulation), and open-loop error is not a
93
+ success rate.
94
+
95
+ ## Rebuilding
96
+
97
+ ```bash
98
+ cmake -S . -B build -DCMAKE_BUILD_TYPE=Release \
99
+ -DGGML_CUDA=ON -DGGML_CUDA_NO_VMM=ON \
100
+ -DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc \
101
+ -DCUDAToolkit_ROOT=/usr/local/cuda \
102
+ -DCMAKE_CUDA_ARCHITECTURES=87 \
103
+ -DCMAKE_CUDA_RUNTIME_LIBRARY=Shared \
104
+ -DPython_EXECUTABLE=<py3.11 env>/bin/python
105
+ cmake --build build -j6
106
+ ```
107
+
108
+ `sm_87` for Orin; CMake < 3.24 cannot auto-detect it. `nvcc` is not on PATH on
109
+ JetPack. Python 3.11 + pybind11. For the neowise build add
110
+ `-DUSE_NEOWISE_Q8=ON -DCUSTOM_KERNEL_VERSION=4` (variant 6 is a Blackwell
111
+ CUTLASS kernel and cannot run on Ampere).