zaleni commited on
Commit
1a4e3e6
·
verified ·
1 Parent(s): 6a0b8f8

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +407 -0
README.md ADDED
@@ -0,0 +1,407 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MagicBot-VGA
2
+
3
+ This repository documents how to evaluate our RoboTwin model
4
+ [`zaleni/MagicBot-VGA-Robotwin`](https://huggingface.co/zaleni/MagicBot-VGA-Robotwin)
5
+ with the MagicBot-VGA codebase.
6
+
7
+ [![Repository](https://img.shields.io/badge/Repository-GitHub-181717?logo=github)](https://github.com/zaleni/MagicBot-VGA)
8
+ [![Model](https://img.shields.io/badge/Model-HuggingFace-FFD21E?logo=huggingface&logoColor=000000)](https://huggingface.co/zaleni/MagicBot-VGA-Robotwin)
9
+
10
+ This README focuses on RoboTwin 2.0 environment preparation and evaluation.
11
+
12
+ It covers:
13
+
14
+ - MagicBot environment installation
15
+ - RoboTwin evaluation setup
16
+ - required external model assets
17
+ - single-task evaluation
18
+ - 50-task randomized evaluation
19
+ - CVPR 2026 RoboTwin Track 11-task evaluation
20
+ - submission package generation for the leaderboard workflow
21
+
22
+ ## 1. Requirements
23
+
24
+ The codebase is built and tested with:
25
+
26
+ - Python 3.10
27
+ - CUDA 12.8
28
+ - PyTorch 2.7.1
29
+
30
+ We recommend using a Linux machine with NVIDIA GPUs.
31
+
32
+ ## 2. Install the MagicBot Base Environment
33
+
34
+ Clone the repository:
35
+
36
+ ```bash
37
+ git clone https://github.com/zaleni/MagicBot-VGA.git
38
+ cd MagicBot-VGA
39
+ ```
40
+
41
+ Create a conda environment:
42
+
43
+ ```bash
44
+ conda create -y -n magicbot python=3.10
45
+ conda activate magicbot
46
+ pip install --upgrade pip
47
+ ```
48
+
49
+ Install the basic system dependencies used by the codebase:
50
+
51
+ ```bash
52
+ conda install -c conda-forge ffmpeg=7.1.1 svt-av1 -y
53
+ ```
54
+
55
+ Install PyTorch for CUDA 12.8:
56
+
57
+ ```bash
58
+ pip install torch==2.7.1 torchvision==0.22.1 torchaudio==2.7.1 \
59
+ --index-url https://download.pytorch.org/whl/cu128
60
+ ```
61
+
62
+ Install Python dependencies:
63
+
64
+ ```bash
65
+ pip install torchcodec numpy scipy transformers==4.57.1 mediapy loguru pytest omegaconf
66
+ pip install -e .
67
+ ```
68
+
69
+ ## 3. Qwen3-VL Dependency
70
+
71
+ For `CubeV2`, the recommended dependency is the official Hugging Face `Qwen3-VL`
72
+ implementation provided by `transformers>=4.57.0`.
73
+
74
+ In this repository, `CubeV2` imports Qwen3-VL directly from:
75
+
76
+ ```python
77
+ from transformers.models.qwen3_vl import modeling_qwen3_vl
78
+ from transformers.models.qwen3_vl import Qwen3VLForConditionalGeneration, Qwen3VLTextModel
79
+ ```
80
+
81
+ So for standard evaluation, you do not need to patch `transformers` if your environment
82
+ already uses a recent enough official version such as `transformers==4.57.1`.
83
+
84
+ This repo also contains a vendored replacement file under:
85
+
86
+ ```text
87
+ src/lerobot/policies/cubev2/transformers_replace/models/qwen3_vl/modeling_qwen3_vl.py
88
+ ```
89
+
90
+ That file is best understood as a repo-side override copy. Most users evaluating
91
+ `zaleni/MagicBot-VGA-Robotwin` should not need it unless they intentionally want to
92
+ reproduce a specific local patched behavior.
93
+
94
+ ## 4. Prepare RoboTwin for Evaluation
95
+
96
+ This section is specifically for RoboTwin evaluation. If you only want to load the
97
+ model or run other parts of the codebase, the extra RoboTwin setup below is not required.
98
+
99
+ ### Option A: initialize the bundled RoboTwin submodule
100
+
101
+ ```bash
102
+ git submodule update --init third_party/RoboTwin
103
+ ```
104
+
105
+ ### Option B: copy an existing RoboTwin checkout
106
+
107
+ You do not have to download RoboTwin from scratch if you already have a prepared copy.
108
+ You can copy it into this repository instead.
109
+
110
+ The evaluation code assumes RoboTwin is located exactly at:
111
+
112
+ ```text
113
+ <repo_root>/third_party/RoboTwin
114
+ ```
115
+
116
+ So a valid layout looks like:
117
+
118
+ ```text
119
+ MagicBot-VGA/
120
+ evaluation/
121
+ launch/
122
+ src/
123
+ third_party/
124
+ RoboTwin/
125
+ ```
126
+
127
+ If your RoboTwin directory already exists elsewhere, either:
128
+
129
+ - copy it to `third_party/RoboTwin`, or
130
+ - create a symlink at `third_party/RoboTwin` pointing to your existing RoboTwin directory
131
+
132
+ This path requirement comes from the evaluation code, which imports RoboTwin modules
133
+ and task configs from `third_party/RoboTwin` directly.
134
+
135
+ ### Install RoboTwin-specific system dependency
136
+
137
+ RoboTwin rendering requires Vulkan:
138
+
139
+ ```bash
140
+ sudo apt install -y libvulkan1 mesa-vulkan-drivers vulkan-tools
141
+ ```
142
+
143
+ ### Install RoboTwin Python dependencies and assets
144
+
145
+ ```bash
146
+ cp evaluation/RoboTwin/requirements.txt third_party/RoboTwin/script/requirements.txt
147
+ cd third_party/RoboTwin
148
+ bash script/_install.sh
149
+ bash script/_download_assets.sh
150
+ cd ../../
151
+ ```
152
+
153
+ For more RoboTwin installation details, you can also refer to the official documentation:
154
+ https://robotwin-platform.github.io/doc/usage/robotwin-install.html
155
+
156
+ ## 5. Prepare External Model Assets
157
+
158
+ The released checkpoint `zaleni/MagicBot-VGA-Robotwin` is intended to be lightweight.
159
+ For RoboTwin action evaluation, you should provide the external backbone/tokenizer assets explicitly.
160
+
161
+ Recommended values:
162
+
163
+ - Qwen3-VL backbone and processor: `Qwen/Qwen3-VL-2B-Instruct`
164
+ - Cosmos tokenizer: `nvidia/Cosmos-Tokenizer-CI8x8`
165
+
166
+ You can use either:
167
+
168
+ - public Hugging Face repo ids
169
+ - local directories downloaded in advance
170
+
171
+ Example for offline/local usage:
172
+
173
+ ```bash
174
+ QWEN3_VL_PATH=/path/to/Qwen3-VL-2B-Instruct
175
+ COSMOS_TOKENIZER_PATH=/path/to/Cosmos-Tokenizer-CI8x8
176
+ ```
177
+
178
+ For standard RoboTwin action evaluation, we recommend disabling DA3 teacher instantiation:
179
+
180
+ ```bash
181
+ DISABLE_DA3_TEACHER_FOR_EVAL=true
182
+ ```
183
+
184
+ This avoids loading the frozen DA3 teacher during evaluation while keeping the policy architecture compatible.
185
+
186
+ ## 6. Single-Task Evaluation
187
+
188
+ The most direct way is to call `evaluation/RoboTwin/inference.py` on a single RoboTwin task.
189
+
190
+ Example: evaluate task `0` (`adjust_bottle`) on `demo_clean`:
191
+
192
+ ```bash
193
+ cd third_party/RoboTwin
194
+
195
+ python ../../evaluation/RoboTwin/inference.py \
196
+ --args.ckpt_path zaleni/MagicBot-VGA-Robotwin \
197
+ --args.video_dir ../../evaluation/RoboTwin/output_magicbot/demo_clean/task_00 \
198
+ --args.task_config demo_clean \
199
+ --args.task_idx 0 \
200
+ --args.action_mode delta \
201
+ --args.stats_key aloha \
202
+ --args.dtype bfloat16 \
203
+ --args.qwen3_vl_pretrained_path Qwen/Qwen3-VL-2B-Instruct \
204
+ --args.qwen3_vl_processor_path Qwen/Qwen3-VL-2B-Instruct \
205
+ --args.cosmos_tokenizer_path_or_name nvidia/Cosmos-Tokenizer-CI8x8 \
206
+ --args.disable_3d_teacher_for_eval
207
+ ```
208
+
209
+ If you use local asset directories, replace the public repo ids with your local paths.
210
+
211
+ Important arguments:
212
+
213
+ - `--args.ckpt_path`: model repo id or local `pretrained_model` directory
214
+ - `--args.task_config`: `demo_clean` or `demo_randomized`
215
+ - `--args.task_idx`: task index in `evaluation/RoboTwin/inference.py`
216
+ - `--args.action_mode`: usually `delta` for this model
217
+ - `--args.stats_key`: usually `aloha` for RoboTwin
218
+ - `--args.dtype`: `bfloat16` is recommended on modern GPUs
219
+
220
+ Outputs are written to `--args.video_dir`, including:
221
+
222
+ - replay videos
223
+ - `summary.json`
224
+ - `summary.txt`
225
+
226
+ ## 7. 50-Task Randomized Evaluation
227
+
228
+ For batch evaluation on RoboTwin randomized tasks, use:
229
+
230
+ ```bash
231
+ PRETRAINED_CKPT=zaleni/MagicBot-VGA-Robotwin \
232
+ QWEN3_VL_PRETRAINED_PATH=Qwen/Qwen3-VL-2B-Instruct \
233
+ QWEN3_VL_PROCESSOR_PATH=Qwen/Qwen3-VL-2B-Instruct \
234
+ COSMOS_TOKENIZER_PATH_OR_NAME=nvidia/Cosmos-Tokenizer-CI8x8 \
235
+ DISABLE_DA3_TEACHER_FOR_EVAL=true \
236
+ GPU_IDS=0,1 \
237
+ MAX_JOBS_PER_GPU=2 \
238
+ bash evaluation/RoboTwin/eval_randomized_50.sh
239
+ ```
240
+
241
+ Useful environment variables:
242
+
243
+ - `PRETRAINED_CKPT`: model repo id or local checkpoint directory
244
+ - `GPU_IDS`: comma-separated GPU ids, for example `0,1,2,3`
245
+ - `MAX_JOBS_PER_GPU`: parallel RoboTwin jobs per GPU
246
+ - `TASK_CONFIG`: defaults to `demo_randomized`
247
+ - `TEST_NUM`: number of episodes per task
248
+ - `DTYPE`: `bfloat16` or `float32`
249
+ - `BASE_OUTPUT_PATH`: output root directory
250
+
251
+ This script writes:
252
+
253
+ - per-task logs and videos under `tasks/`
254
+ - aggregated `summary.json`
255
+ - aggregated `summary.txt`
256
+
257
+ ## 8. Evaluate a Continuous Task Range
258
+
259
+ `eval_randomized_50.sh` supports continuous ranges through:
260
+
261
+ - `START_TASK_IDX`
262
+ - `TASK_COUNT`
263
+
264
+ Example: evaluate tasks `10` to `19`:
265
+
266
+ ```bash
267
+ PRETRAINED_CKPT=zaleni/MagicBot-VGA-Robotwin \
268
+ QWEN3_VL_PRETRAINED_PATH=Qwen/Qwen3-VL-2B-Instruct \
269
+ QWEN3_VL_PROCESSOR_PATH=Qwen/Qwen3-VL-2B-Instruct \
270
+ COSMOS_TOKENIZER_PATH_OR_NAME=nvidia/Cosmos-Tokenizer-CI8x8 \
271
+ DISABLE_DA3_TEACHER_FOR_EVAL=true \
272
+ START_TASK_IDX=10 \
273
+ TASK_COUNT=10 \
274
+ bash evaluation/RoboTwin/eval_randomized_50.sh
275
+ ```
276
+
277
+ ## 9. Evaluate the CVPR 2026 RoboTwin Track 11-Task Subset
278
+
279
+ For the Hugging Face leaderboard
280
+ [`open-gigaai/CVPR-2026-RoboTwin-Track-LeaderBoard`](https://huggingface.co/spaces/open-gigaai/CVPR-2026-RoboTwin-Track-LeaderBoard),
281
+ we use the following 11-task subset:
282
+
283
+ ```text
284
+ [2, 3, 9, 10, 12, 15, 17, 25, 28, 30, 44]
285
+ ```
286
+
287
+ The exact task names in `evaluation/RoboTwin/inference.py` are:
288
+
289
+ - `blocks_ranking_rgb`
290
+ - `blocks_ranking_size`
291
+ - `handover_mic`
292
+ - `hanging_mug`
293
+ - `move_can_pot`
294
+ - `move_stapler_pad`
295
+ - `open_microwave`
296
+ - `place_can_basket`
297
+ - `place_dual_shoes`
298
+ - `place_fan`
299
+ - `stack_blocks_three`
300
+
301
+ The current batch script does not take a sparse task list directly, so the recommended approach is to run a shell loop:
302
+
303
+ ```bash
304
+ cd third_party/RoboTwin
305
+
306
+ TASKS=(2 3 9 10 12 15 17 25 28 30 44)
307
+ for t in "${TASKS[@]}"; do
308
+ python ../../evaluation/RoboTwin/inference.py \
309
+ --args.ckpt_path zaleni/MagicBot-VGA-Robotwin \
310
+ --args.video_dir ../../evaluation/RoboTwin/output_magicbot/custom_subset/task_${t} \
311
+ --args.task_config demo_randomized \
312
+ --args.task_idx "${t}" \
313
+ --args.action_mode delta \
314
+ --args.stats_key aloha \
315
+ --args.dtype bfloat16 \
316
+ --args.qwen3_vl_pretrained_path Qwen/Qwen3-VL-2B-Instruct \
317
+ --args.qwen3_vl_processor_path Qwen/Qwen3-VL-2B-Instruct \
318
+ --args.cosmos_tokenizer_path_or_name nvidia/Cosmos-Tokenizer-CI8x8 \
319
+ --args.disable_3d_teacher_for_eval
320
+ done
321
+ ```
322
+
323
+ This produces one output directory per task, each containing replay videos plus `summary.json` and `summary.txt`.
324
+
325
+ ## 10. Package the 11-Task Submission and Export Success Rates
326
+
327
+ After you finish the randomized evaluation run, you can convert those 11 tasks into a submission-style folder with:
328
+
329
+ ```bash
330
+ python util_scripts/package_robotwin_submission.py \
331
+ --run /path/to/output_randomized_50/<run_name>/summary.txt \
332
+ --dst /path/to/output_randomized_50/<run_name>/submission_package \
333
+ --overwrite
334
+ ```
335
+
336
+ If you also want to bundle a policy folder, add:
337
+
338
+ ```bash
339
+ --policy-dir /path/to/policy/Your_Policy
340
+ ```
341
+
342
+ The packaging script will:
343
+
344
+ - create `submission_package/<task_name>/episode0.mp4`, `episode1.mp4`, ...
345
+ - preserve the 11-task ordering by task index
346
+ - write `package_manifest.txt`
347
+ - write `selected_task_summary.json`
348
+ - write `selected_task_summary.txt`
349
+
350
+ The selected-task summary files include:
351
+
352
+ - per-task `success_rate`
353
+ - per-task `success_count` and `test_num`
354
+ - `avg_task_success_rate` across the 11 tasks
355
+ - `overall_episode_success_rate` across all episodes in the 11-task subset
356
+
357
+ This is useful when you want a leaderboard-facing summary for the competition subset rather than the full randomized-50 report.
358
+
359
+ ## 11. Task Index Reference
360
+
361
+ Task indices are defined in [`evaluation/RoboTwin/inference.py`](evaluation/RoboTwin/inference.py).
362
+
363
+ For example:
364
+
365
+ - `0`: `adjust_bottle`
366
+ - `2`: `blocks_ranking_rgb`
367
+ - `3`: `blocks_ranking_size`
368
+ - `9`: `handover_mic`
369
+ - `10`: `hanging_mug`
370
+ - `12`: `move_can_pot`
371
+ - `15`: `move_stapler_pad`
372
+ - `17`: `open_microwave`
373
+ - `25`: `place_can_basket`
374
+ - `28`: `place_dual_shoes`
375
+ - `30`: `place_fan`
376
+ - `44`: `stack_blocks_three`
377
+
378
+ ## 12. Common Notes
379
+
380
+ - `inference.py` can load checkpoints from either a local directory or a Hugging Face repo id.
381
+ - If your server cannot access Hugging Face online, download the external assets in advance and pass local paths.
382
+ - If you use the lightweight checkpoint release for action evaluation, keeping `--args.disable_3d_teacher_for_eval` enabled is recommended.
383
+ - If you want to inspect reconstructed future images during inference, enable `--args.decode_image_flag`, though this is not required for standard RoboTwin scoring.
384
+
385
+ ## 13. Model Link
386
+
387
+ Released RoboTwin checkpoint:
388
+
389
+ - https://huggingface.co/zaleni/MagicBot-VGA-Robotwin
390
+
391
+ ## 14. Acknowledgments
392
+
393
+ MagicBot-VGA is developed on top of the excellent InternVLA framework. Our codebase
394
+ started from that foundation and has since been substantially modified and extended
395
+ for our own model architecture, training pipeline, and evaluation workflow.
396
+
397
+ We sincerely thank the [InternVLA](https://github.com/InternRobotics/InternVLA-A1)
398
+ authors and contributors for open-sourcing their framework and making follow-up
399
+ research and development much easier.
400
+
401
+ We also thank the following open-source projects:
402
+
403
+ - [InternVLA](https://github.com/InternRobotics/InternVLA-A1)
404
+ - [LeRobot](https://github.com/huggingface/lerobot)
405
+ - [RoboTwin](https://github.com/RoboTwin-Platform/RoboTwin)
406
+ - [Qwen3-VL](https://github.com/QwenLM/Qwen3-VL)
407
+ - [NVIDIA Cosmos](https://github.com/nvidia-cosmos)