Skip to content

Commit ec09f9f

Browse files
committed
starvla: remove retired reference tooling
1 parent 508e327 commit ec09f9f

53 files changed

Lines changed: 636 additions & 15764 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CMakeLists.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ add_library(starvla_runtime STATIC
159159
${STARVLA_DIR}/pi_policy.h
160160
${STARVLA_DIR}/pi_v3_policy.cpp
161161
${STARVLA_DIR}/pi_v3_policy.h
162+
${STARVLA_DIR}/policy_gguf.h
162163
${STARVLA_DIR}/qwen3vl_bridge.cpp
163164
${STARVLA_DIR}/qwen3vl_bridge.h
164165
${STARVLA_DIR}/starvla_engine.cpp

‎docs/STARVLA_DEVELOPMENT_ZH.md‎

Lines changed: 18 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ Qwen3 FAST 没有官方微调 policy checkpoint,因此当前不作为运行时
3636
| `src/models/starvla/*_prompt.*` | 各 policy 的 prompt 构造和校验 |
3737
| `src/models/starvla/oft_image_preprocess.*` | 与 Python 路径一致的 RGB resize 和 dynamic grid 处理 |
3838
| `src/models/starvla/normalization.*` | profile 选择、连续 action 反归一化和二值 action 处理 |
39-
| `tools/hf2gguf/starvla/` | checkpoint 清单、拆分、转换、bundle 校验和 Python reference |
39+
| `tools/hf2gguf/starvla/` | checkpoint 清单、下载、转换和 bundle 校验 |
4040
| `tests/starvla/` | C++ 小型测试和 Python 转换工具测试 |
41-
| `eval/simpler_env/` | 本地 Python 与 C++ 的 paired Bridge rollout |
41+
| `eval/simpler_env/` | 本地 GGUF 的 Bridge rollout 和成功率统计 |
4242

4343
`Qwen3VLBridge` 是历史类名,实际同时支持 Qwen2.5-VL 和 Qwen3-VL。新增调用方不应
4444
根据这个类名推断 backbone。
@@ -101,9 +101,9 @@ model-server / model-cli
101101
metadata 决定图像数量。
102102

103103
扩散模型在没有 `observation.initial_noise` 时使用 engine RNG。生成的 Gaussian noise 会先
104-
按 BF16 round-to-nearest-even 舍入再送入 policy。数值对齐时应通过 protocol v4 给 Python
105-
和 C++ 发送同一份显式 noise,而不是比较两种语言各自的随机数生成器。`reset()` 会清理
106-
Qwen KV 状态,但不会重新播种 engine RNG。
104+
按 BF16 round-to-nearest-even 舍入再送入 policy。调用方也可以通过
105+
`observation.initial_noise` 提供固定噪声。`reset()` 会清理 Qwen KV 状态,但不会重新播种
106+
engine RNG。
107107

108108
成功结果只暴露最终 actions、`chunk_size`、`action_dim` 和分阶段耗时。中间 hidden
109109
states、normalized actions 和 token IDs 保留在实现内部。
@@ -121,10 +121,6 @@ states、normalized actions 和 token IDs 保留在实现内部。
121121
- FAST 要求 `n_ctx` 不小于 policy metadata 中的 generation `max_length`,并使用
122122
checkpoint 中固定的 EOS、top-k 和 repetition penalty 配置。
123123

124-
如果调整 dtype、attention 或中间舍入位置,应重新生成同输入的 Python reference,先比较
125-
最终 action,再运行 Bridge rollout。不要只用单个 hidden-state tensor 的误差判断策略是否
126-
可用。
127-
128124
## llama.cpp overlay
129125

130126
StarVLA runtime 依赖 `checkpoint_catalog.json` 中 `source_revisions.llama_cpp` 固定的
@@ -155,7 +151,7 @@ patch 的 submodule。具体命令见转换 README。
155151

156152
[`checkpoint_catalog.json`](../tools/hf2gguf/starvla/checkpoint_catalog.json) 是七个 variant
157153
的单一配置来源,保存 repository、revision、文件大小、SHA256、tensor inventory、转换路径、
158-
normalization profile 和 reference server。
154+
normalization profile。
159155

160156
日常转换只使用统一入口:
161157

@@ -199,7 +195,7 @@ cmake --build build_cuda -j
199195
CUDA_VISIBLE_DEVICES=0 build_cuda/bin/model-cli \
200196
--model-type starvla \
201197
--policy ckpts/starvla/gguf/oft/starvla-oft-policy-fp32.gguf \
202-
--image goldens/inputs/frame-224-rgb.png \
198+
--image /path/to/frame-224-rgb.png \
203199
--image-name image_0 \
204200
--task "grab the block." \
205201
--unnorm-key oxe_bridge \
@@ -220,45 +216,30 @@ uv run --with pytest python -m pytest tests/starvla
220216
(cd build_cuda && ctest --output-on-failure)
221217
```
222218

223-
Python 测试覆盖 catalog、下载安全检查、surgery、metadata、bundle validator、reference
224-
server 和 action 比较工具。CTest 覆盖 model factory、prompt、图像预处理、Qwen profile、
225-
FAST codec/runtime 和协议。两者都不会执行七个完整 checkpoint 的 CUDA 推理。
226-
227-
### Action 对齐
228-
229-
使用相同图像、task、state、normalization profile 和显式 noise 生成本地 Python 与 C++
230-
结果,再运行:
231-
232-
```bash
233-
uv run python tools/hf2gguf/starvla/compare_starvla_actions.py \
234-
--reference golden.json \
235-
--candidate response.json
236-
```
237-
238-
默认比较反归一化后的完整 action chunk,要求 shape 相同、数值有限且全局 relative-L2 不
239-
超过 3%。这一步用于发现转换、dtype boundary 和计算图实现差异。
219+
Python 测试覆盖 catalog、下载安全检查、surgery、metadata 和 bundle validator。CTest
220+
覆盖 model factory、prompt、图像预处理、Qwen profile、FAST codec/runtime 和协议。两者
221+
都不会执行七个完整 checkpoint 的 CUDA 推理。
240222

241223
### Bridge 评测
242224

243225
```bash
244226
VARIANT=oft \
245-
COMPARISON_ID=oft-local-paired-001 \
246-
GPU_IDS=0,1,2,3 PORTS=5600,5601,5602,5603 \
247-
bash eval/simpler_env/scripts/run_paired_local.sh
227+
OUTPUT=ckpts/starvla/results/oft/bridge.json \
228+
bash eval/simpler_env/scripts/run_model_server.sh
248229
```
249230

250-
完整 profile 为四个 task、每个 task 24 个 episode,Python 原始 checkpoint 是本地参照。
251-
比较结果记录两端成功率和逐 episode 一致性,不把 action relative-L2 当作成功率替代品。
231+
完整 profile 为四个 task、每个 task 24 个 episode。结果记录总体和各任务成功率、逐
232+
episode 状态以及推理耗时。
252233

253234
## 增加 checkpoint 或模型
254235

255236
### 同一 backbone/framework 的新 checkpoint
256237

257238
1. 在 `checkpoint_catalog.json` 添加固定 revision、大小、SHA256、文件清单、tensor
258-
inventory、normalization profile 和 reference server。
239+
inventory 和 normalization profile。
259240
2. 检查 `starvla_checkpoint.py` 的 effective config 是否需要 checkpoint-specific 修正。
260241
3. 用 converter 和 bundle validator 生成新 bundle。
261-
4. 生成本地 Python reference,完成 action 对齐和 Bridge smoke,再跑完整 profile。
242+
4. 运行小型单测、CUDA smoke 和 Bridge profile。
262243

263244
只要 GGUF schema 和计算图没有变化,通常不需要新增 public model type 或复制 engine。
264245

@@ -270,7 +251,7 @@ bash eval/simpler_env/scripts/run_paired_local.sh
270251
4. 在 `StarVLAVariant`、`starvla_variant_from_metadata()` 和 engine 调度中接入新组合。
271252
5. 若需要 llama.cpp 尚未提供的能力,优先使用公开 API。确实需要修改第三方代码时,新增
272253
独立 patch、更新一键脚本和 CMake 检查,不直接提交 submodule 内源码。
273-
6. 增加小型 C++ 单测、Python converter/validator 测试、action reference 和 Bridge 配置。
254+
6. 增加小型 C++ 单测、Python converter/validator 测试和 Bridge 配置。
274255

275256
每个新分支都应显式校验输入、metadata 和 tensor shape。不要通过默认值、模糊 tensor
276257
匹配或静默 CPU fallback 接受未知 checkpoint。
@@ -281,8 +262,6 @@ bash eval/simpler_env/scripts/run_paired_local.sh
281262
没有变化。
282263
- bundle UUID 不一致:不要混用不同转换目录的 policy、text 和 mmproj。
283264
- normalization profile 报错:查看 policy 中的 profile keys,并显式传 `--unnorm-key`。
284-
- action 对齐不稳定:确认输入图像预处理、prompt、显式 noise 和 dtype boundary 完全相同。
285265
- FAST 初始化失败:确认使用 Action 版 Qwen2.5-VL 权重、配套 codec,并设置
286266
`--n-ctx` 不小于 policy metadata 中的 generation `max_length`。
287-
- Bridge 结果显示 `partial`:完整运行需要四个 task 各 24 个 episode;smoke run 必须显式
288-
设置 `ALLOW_PARTIAL=1`。
267+
- Bridge 结果显示 `partial`:完整运行需要四个 task 各 24 个 episode。

‎eval/simpler_env/README.md‎

Lines changed: 31 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,28 @@
1-
<p align="center">
2-
<a href="README_ZH.md">简体中文</a> | <strong>English</strong>
3-
</p>
4-
51
# SimplerEnv WidowX Bridge Eval
62

7-
This directory runs StarVLA on the SimplerEnv WidowX Bridge tasks. It can run
8-
the original Python `.pt` checkpoint and the robot.cpp CUDA GGUF build with the
9-
same rollout settings, then compare their results.
3+
This directory evaluates the robot.cpp StarVLA GGUF runtime on the SimplerEnv
4+
WidowX Bridge tasks.
105

116
## Protocol
127

13-
- Four Bridge tasks, object episodes `0..23`, at most 120 steps, and 5 Hz
14-
control.
15-
- Official visual-matching RGB overlay resized to a 224x224 `image_0` with
16-
OpenCV `INTER_AREA`.
17-
- A new action chunk each step and the official seven-prediction FP32 adaptive
18-
ensemble.
19-
- The Python and C++ runs use the same task, episode, seed, prompt, image,
20-
action postprocessing, and termination conditions.
21-
- Diffusion variants receive the same BF16-rounded initial noise for every
22-
episode and policy step through protocol v4.
23-
24-
The full comparison contains 96 rollouts per runtime: 4 tasks x 24 object
25-
episodes. A smaller run is marked `partial`. The comparison reports success
26-
rates but does not assign a pass threshold. Action differences can be checked
27-
separately with `compare_starvla_actions.py`, whose default relative-L2 limit is
28-
3%.
29-
30-
## Setup
8+
- Four Bridge tasks with object episodes `0..23`
9+
- At most 120 steps per episode at 5 Hz
10+
- Visual-matching RGB overlay resized to 224x224 with OpenCV `INTER_AREA`
11+
- One action chunk per step with the official seven-prediction adaptive ensemble
3112

32-
First download and convert the checkpoint as described in the
33-
[StarVLA conversion guide](../../tools/hf2gguf/starvla/README.md), and build the
34-
CUDA runtime. Paired evaluation also needs the catalog-pinned StarVLA checkout
35-
and a local Python reference environment:
13+
A full run contains 96 rollouts. The result reports overall and per-task success
14+
rates; subset runs use `partial` coverage.
3615

37-
```bash
38-
STARVLA_REV="$(python -c 'import json; print(json.load(open("tools/hf2gguf/starvla/checkpoint_catalog.json"))["source_revisions"]["starvla"])')"
39-
git clone https://github.com/starVLA/starVLA.git ckpts/starvla/source/starvla
40-
git -C ckpts/starvla/source/starvla checkout "${STARVLA_REV}"
41-
42-
python3.11 -m venv ckpts/starvla/.venv-official
43-
ckpts/starvla/.venv-official/bin/pip install \
44-
-c tools/hf2gguf/starvla/reference_constraints.txt \
45-
-r ckpts/starvla/source/starvla/requirements.txt
46-
ckpts/starvla/.venv-official/bin/pip install -e ckpts/starvla/source/starvla
47-
```
16+
## Setup
4817

49-
Override these locations with `CHECKPOINT_ROOT`, `STARVLA_SOURCE`,
50-
`REFERENCE_PYTHON`, or `SIMPLER_ENV_ROOT`. The FAST reference also requires the
51-
retained `ckpts/starvla/work/qwen25_fast` staging directory.
18+
Convert a checkpoint as described in the
19+
[StarVLA guide](../../tools/hf2gguf/starvla/README.md) and build the CUDA runtime.
5220

53-
SimplerEnv uses these pinned revisions:
21+
The environment uses these revisions:
5422

5523
```text
56-
SimplerEnv: 06accaca93535902d408da4855f21cece12bceb7
57-
ManiSkill2_real2sim: ef7a4d4fdf4b69f2c2154db5b15b9ac8dfe10682
24+
SimplerEnv: 06accaca93535902d408da4855f21cece12bceb7
25+
ManiSkill2_real2sim: ef7a4d4fdf4b69f2c2154db5b15b9ac8dfe10682
5826
```
5927

6028
```bash
@@ -71,65 +39,35 @@ pip install -e ckpts/simpler_env/source/SimplerEnv/ManiSkill2_real2sim
7139
pip install -e ckpts/simpler_env/source/SimplerEnv
7240
```
7341

74-
Headless simulation needs a working Vulkan ICD. Validate environment creation
75-
before starting rollouts:
76-
77-
```bash
78-
python ckpts/starvla/source/starvla/examples/simBenchmarks/SimplerEnv/eval_files/test_your_simplerEnv.py
79-
```
80-
81-
The paired runner uses the system Vulkan loader by default. Set
82-
`VULKAN_LIBRARY_PATH` and `VULKAN_ICD` only when a custom loader directory or
83-
ICD JSON file is required.
42+
Headless simulation requires a working Vulkan ICD. Run SimplerEnv's environment
43+
test first to confirm that SAPIEN can find a rendering device.
8444

8545
## Run
8646

8747
`VARIANT` accepts `oft`, `groot`, `pi_v3`, `qwen25_oft`, `qwen25_groot`,
88-
`qwen25_pi`, and `qwen25_fast`. The scripts select the checkpoint, Qwen files,
89-
GGUF files, Python server, and normalization profile for the chosen variant.
48+
`qwen25_pi`, and `qwen25_fast`.
9049

91-
Inspect the full command without running it:
92-
93-
```bash
94-
VARIANT=oft DRY_RUN=1 \
95-
bash eval/simpler_env/scripts/run_paired_local.sh
96-
```
97-
98-
Run all 96 rollouts on four GPUs:
50+
Run the full profile:
9951

10052
```bash
53+
CUDA_VISIBLE_DEVICES=0 \
10154
VARIANT=oft \
102-
COMPARISON_ID=oft-local-paired-001 \
103-
GPU_IDS=0,1,2,3 PORTS=5600,5601,5602,5603 \
104-
SIMPLER_ENV_ROOT=ckpts/simpler_env/source/SimplerEnv \
105-
bash eval/simpler_env/scripts/run_paired_local.sh
106-
```
107-
108-
The runner completes four Python shards, then four C++ shards with the same
109-
task/GPU/port mapping, and writes:
110-
111-
```text
112-
ckpts/starvla/results/<variant>/bridge-local-paired-<comparison-id>/comparison.json
55+
OUTPUT=ckpts/starvla/results/oft/bridge.json \
56+
bash eval/simpler_env/scripts/run_model_server.sh
11357
```
11458

115-
An explicit smoke subset must allow partial coverage:
59+
Run one smoke episode:
11660

11761
```bash
118-
VARIANT=groot EPISODE_IDS=0 ALLOW_PARTIAL=1 \
119-
COMPARISON_ID=groot-smoke-001 \
120-
bash eval/simpler_env/scripts/run_paired_local.sh
62+
CUDA_VISIBLE_DEVICES=0 \
63+
VARIANT=groot TASK_IDS=0 EPISODE_IDS=0 \
64+
bash eval/simpler_env/scripts/run_model_server.sh
12165
```
12266

123-
The result is marked `status=partial`. Use `run_python_reference.sh` for a
124-
standalone Python shard and `run_model_server.sh` for a standalone C++ shard or
125-
a full run.
126-
127-
## Output
128-
129-
Each `(task, repeat)` gets a fresh backend server. Results record the StarVLA
130-
`variant`, checkpoint, action shape, and one row per rollout. Before running,
131-
the C++ script verifies the conversion manifest and the GGUF file hashes. The
132-
comparison rejects results produced with different models or rollout settings.
67+
The script reads three GGUF files from `ckpts/starvla/gguf/<variant>` and uses
68+
`build_cuda/bin/model-server` by default. Common overrides are `GGUF_DIR`,
69+
`SERVER_BIN`, `PYTHON`, `SIMPLER_ENV_ROOT`, `UNNORM_KEY`, `TASK_IDS`,
70+
`EPISODE_IDS`, `REPEATS`, and `OUTPUT`.
13371

134-
`comparison.json` contains the success counts and rates, percentage-point
135-
difference, per-episode agreement, and contingency table.
72+
Each task/repeat starts a fresh model-server. Results include checkpoint
73+
identity, rollout records, success rates, and timing summaries.

0 commit comments

Comments
 (0)