dyk111zn commited on
Commit
2ef44ec
·
verified ·
1 Parent(s): 2fc491d

Document and enable the complete collect-update-world-model-GRPO cycle

Browse files

Adds portable eight-GPU collection of 500 paired trajectories, Cosmos-first concurrent Wan/Cosmos updates, explicit model-pair selection and policy60-to80 continuation. Includes 18 CPU tests and independent restored-runtime import/dry-run evidence.

README.md CHANGED
@@ -26,7 +26,18 @@ base_model:
26
  10 个任务 × 50 次评估成功率为 **77.2%(386/500)**。
27
  `latest_policy.json` 记录最新断点、评估结果和续训入口。40、45、50 步用于历史对比。
28
 
29
- 下载并执行下文的 `restore`、`check` 后,从 60 步继续训练 20 步,到总步数 80:
 
 
 
 
 
 
 
 
 
 
 
30
 
31
  ```bash
32
  screen -dmS spatial-grpo60-to80 bash -c \
@@ -138,10 +149,54 @@ python3 reproduction/portable.py eval --checkpoint 60 --output "$PWD/runs/eval60
138
 
139
  ## 后续世界模型更新
140
 
141
- 源码中保留了采集与更新工具。当前约定为:Cosmos 完成目标步数后,Wan 在下一个
142
- 完整更新处保存并结束,然后用最新双世界模型继续 GRPO。无需让 Wan 补到相同步数,
143
- 视频指标另行安排。使用 `experiments/wm_update_until_cosmos.py` 作为新的并行训练
144
- 入口,读取 `selected_world_models.json` 来打包实际选定的模型。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
 
146
  原服务器的邮件配置、token、登录缓存、Ray 临时目录、活动进程和未完成检查点均
147
  不属于发布包。新服务器需要邮件通知时,另行配置现有 `watch_training_email.py`。
 
26
  10 个任务 × 50 次评估成功率为 **77.2%(386/500)**。
27
  `latest_policy.json` 记录最新断点、评估结果和续训入口。40、45、50 步用于历史对比。
28
 
29
+ 下载并执行下文的 `restore`、`check` 后,完整的下一轮实验使用以下入口:
30
+
31
+ ```bash
32
+ screen -dmS spatial-cycle60 bash -c \
33
+ 'bash reproduction/run_world_model_cycle.sh "$PWD/runs/cycle60"'
34
+ screen -r spatial-cycle60
35
+ ```
36
+
37
+ 它依次执行:60 步策略采集 500 条真实双相机轨迹 → 更新 Wan/Cosmos →
38
+ 打包本轮新模型 → 策略从 60 步继续到 80 步。完整配方见“后续世界模型更新”。
39
+
40
+ 以下单条命令只续训 GRPO,不采集数据或更新世界模型;使用包内 Wan 1000/Cosmos 2000:
41
 
42
  ```bash
43
  screen -dmS spatial-grpo60-to80 bash -c \
 
149
 
150
  ## 后续世界模型更新
151
 
152
+ 完整入口为 `reproduction/run_world_model_cycle.sh`,从恢复好的发布包根目录执行,
153
+ 需要八张可用 GPU。每个原生入口启动前都会检查占用;指定的卡有其他作业时退出。
154
+ 采集和世界模型训练均使用实际计算进程持有的可复用显存缓存,保留 3.5 GiB 设备余量。
155
+
156
+ 先查看命令计划,不启动 GPU 任务:
157
+
158
+ ```bash
159
+ bash reproduction/run_world_model_cycle.sh --dry-run "$PWD/runs/cycle60"
160
+ ```
161
+
162
+ 正式执行上面的 `screen -dmS spatial-cycle60 ...` 命令。各阶段为:
163
+
164
+ 1. **采集真实数据**:八卡使用 `weights/policy/global_step_60/`,在 LIBERO-Spatial
165
+ 的 10 个任务上各采集 50 条轨迹。保留成功和失败,`mode=train`,每条最多 240 步,
166
+ 每次执行 8 个动作;主相机、腕部相机、动作和仿真状态按同一帧索引保存。
167
+ 结果在 `runs/cycle60/collection/`。
168
+ 2. **准备训练集**:新采集的 500 条轨迹与包内 `data/kir_sources/` 的 500 条公开
169
+ Spatial 轨迹组成新数据/回放数据,验证比例 0.2;训练采样的新数据比例为 0.5。
170
+ 生成 `runs/cycle60/manifest.json` 并校验文件。历史每轮采集的原始数据未随包发布;
171
+ 此处回放来源是包内公开轨迹。
172
+ 3. **更新两个世界模型**:Wan/Cosmos 各四卡并行,梯度累计 4 次,有效 batch 各为 16,
173
+ 学习率 `1e-6`,Cosmos 使用 `v3-reconstructed` 配方,目标 2000 步,
174
+ 显式设置 `--save-interval 1000`。从包内 Wan 1000/Cosmos 2000 的模型参数初始化,
175
+ 为本轮数据建立新的世界模型优化器;历史世界模型优化器状态不在发布包中。
176
+ 4. **选择并打包新模型**:使用 `wm_update_until_cosmos.py` 控制两个训练组。
177
+ Cosmos 完成 2000 步后,请求 Wan 在下一个完整优化器更新后保存并结束,
178
+ 不强制 Wan 达到 2000 步。读取 `train/selected_world_models.json`,打包生成
179
+ `runs/cycle60/model_pair/pair.json`。视频指标可另行评估,不阻塞接续。
180
+ 5. **继续 GRPO**:恢复第 60 步策略的完整 DCP 和优化器状态,用本轮新模型训练至
181
+ 总步数 80;第 70、80 步保存完整策略训练状态,每 5 步保存策略并做真实 Spatial
182
+ 10×50 评估。结果在 `runs/cycle60/grpo/`。
183
+
184
+ `reproduction/world_model.py` 为原生采集和更新工具设置本地恢复后的源码、解释器、
185
+ 模型和数据路径。也可分阶段执行;例如本轮世界模型已训练完:
186
+
187
+ ```bash
188
+ python3 reproduction/world_model.py package \
189
+ --selection "$PWD/runs/cycle60/train/selected_world_models.json" \
190
+ --output "$PWD/runs/cycle60/model_pair"
191
+
192
+ python3 reproduction/portable.py train --resume 60 --target 80 \
193
+ --model-pair "$PWD/runs/cycle60/model_pair/pair.json" \
194
+ --output "$PWD/runs/cycle60/grpo"
195
+ ```
196
+
197
+ `--model-pair` 会同时切换 Wan 和 Cosmos,并复用冻结的 VAE、奖励模型和初始观测资源。
198
+ 不用该参数时,继续使用发布包内的世界模型。完整入口使用种子 `20261021`;
199
+ 通过 `WM_CYCLE_GPUS`、`WM_CYCLE_SEED` 可调整物理卡号和本轮随机种子。
200
 
201
  原服务器的邮件配置、token、登录缓存、Ray 临时目录、活动进程和未完成检查点均
202
  不属于发布包。新服务器需要邮件通知时,另行配置现有 `watch_training_email.py`。
SHA256SUMS CHANGED
@@ -10,7 +10,7 @@ b8817d9f58408022ff30bbf1abd39521e7e291c83b33ff04969c45ac46bd6c65 LICENSES/PI05-
10
  c7c92fee190b604e2d18e27df517aca77871d0c6829d1a58b71521807d3acdb1 LICENSES/README.md
11
  4bcf87ecfbbb8e07a01b21415a970c8b53a5283bf6872b657040d3f45c9241f7 LICENSES/WAN-SPATIAL-MODEL-CARD.md
12
  9491f7a2676a19460f8e9d3c625dabd53841fa8fe3db92bf6cd73780dbf0348e NOTICE
13
- a233ff8ba459e8daa3ab72c2c2061c6cb2f9a38f682d9cd0be7840b881b59e0b README.md
14
  5b119a98ad7824507ddff3c6c7507ca244261ee416dcfa623876702160c580d3 assets/cosmos/libero_dataset_statistics.json
15
  8a03499676c6c196127c577144b9fd09bb02c30f9caf058adbcef09bb99ad8f5 assets/cosmos/libero_t5_embeddings.pkl
16
  38071ab59bd94681c686fa51d75a1968f64e470262043be31f7a094e442fd981 assets/cosmos/tokenizer.pth
@@ -31,13 +31,16 @@ d9c2426cd1209ca943b280c3ed217d410cd571e3085fc3945b1a84befea911a2 evidence/evalu
31
  54128b9e3c050b89b1582cd6fac382543c037096fb41d13dcad34cfb8c392e09 evidence/evaluations/global_step_50.json
32
  06b80579aa0beae3bf11400d3734e6b5ac9e19bb9fab8c7603ad0123b03a27c2 evidence/evaluations/global_step_60.json
33
  cc963ddd48281aece1af1a1ccafde791879340728d117f0d692f1136ee289e59 evidence/policy_step60_resume.json
 
34
  fdc3869dc035263b05b2c4ff9b2f6826282e3a6cc3f4cd268f43cd9a329d2159 evidence/rlinf_environment.json
35
  b1d0dca8515f82edbd9ffeb1b33f9023e24f23c68a1a644faf23caefedf7c8d1 evidence/world_model_training_manifest.json
36
- f436503a0dd25df2dc327a73c54dd776945cf3d952c30875942e72032d99492d latest_policy.json
37
- 1a62781c9104b8dfb0a9d2fd869da6ba0886e6fcf4967dc566090bb4873532c5 reproduction/README.zh-CN.md
38
  f490f560a262e9402230bb0e7f1f965853dc24c4c72b4d6b3941293c40802e0b reproduction/eval_train.py
39
  8d0c9116b5b8624aa8dba4f13b76206b7d326a44aa6a9c2b627076c8266b4582 reproduction/launcher.py
40
- b6418fea3feeab7d912f0f84c0a9866cade77c000ec0b574d02fe97295a0230f reproduction/portable.py
 
 
41
  936193ae5fa7432637b050654633496a62455573abd0224dcfb8e118aceb8f39 runtime/cosmos_packages_0.tar.zst
42
  bbac3dee6879dc41b12082e07400aa6adac52bbf1c4dc8728e53bf8df20ef709 runtime/cosmos_packages_1.tar.zst
43
  c4940b5a72db60e1de3eb94534034d4d96be53714acb11044f910c0a8c24f1b2 runtime/python310.tar.zst
@@ -47,6 +50,7 @@ a659145d90481d3028e12cc780dead4d8340b64b8e9b692bbec7a3185f359719 runtime/rlinf_
47
  19114ac59362c80778ca751a7ae8635717ffb64d13c81ab0451c420c14b29bc9 runtime/rlinf_packages_1.tar.zst
48
  574001e4ec917eaba32464fa65f81a3257b8691f9b41ea351c19ceff8e552175 source/grpo_spatial_source.tar.zst
49
  08e1648ba07ce8429bc2faee49fe9a5517fde7d81eae94441e91a07872c91319 source/step60_reproduction_update.tar.zst
 
50
  b4a01639bdac0e98073499bbb3a84cd29b2274dba80fa286f0c7ee27bf75b949 weights/cosmos_step2000/checkpoint_manifest.json
51
  7110ea589cfb2dabf4c90941cf5fc5c5d23fdf47ab78b7a16b56b5014e7a87bf weights/cosmos_step2000/iter_000002000/model/.metadata
52
  01f1eb9e46b123df765f614a18835e86393c3bdf7d6147b7be4453bc551b99e4 weights/cosmos_step2000/iter_000002000/model/__0_0.distcp
 
10
  c7c92fee190b604e2d18e27df517aca77871d0c6829d1a58b71521807d3acdb1 LICENSES/README.md
11
  4bcf87ecfbbb8e07a01b21415a970c8b53a5283bf6872b657040d3f45c9241f7 LICENSES/WAN-SPATIAL-MODEL-CARD.md
12
  9491f7a2676a19460f8e9d3c625dabd53841fa8fe3db92bf6cd73780dbf0348e NOTICE
13
+ 398a6b9b5e1dd0a85b326e5e7c9e35370ed8818e41c5ebdd1d27c1e046a92a2e README.md
14
  5b119a98ad7824507ddff3c6c7507ca244261ee416dcfa623876702160c580d3 assets/cosmos/libero_dataset_statistics.json
15
  8a03499676c6c196127c577144b9fd09bb02c30f9caf058adbcef09bb99ad8f5 assets/cosmos/libero_t5_embeddings.pkl
16
  38071ab59bd94681c686fa51d75a1968f64e470262043be31f7a094e442fd981 assets/cosmos/tokenizer.pth
 
31
  54128b9e3c050b89b1582cd6fac382543c037096fb41d13dcad34cfb8c392e09 evidence/evaluations/global_step_50.json
32
  06b80579aa0beae3bf11400d3734e6b5ac9e19bb9fab8c7603ad0123b03a27c2 evidence/evaluations/global_step_60.json
33
  cc963ddd48281aece1af1a1ccafde791879340728d117f0d692f1136ee289e59 evidence/policy_step60_resume.json
34
+ caf6b507e714451c894f14e3b4b0a6a889cb63c839b1cf6024333a53363c2169 evidence/reproduction_cycle60.json
35
  fdc3869dc035263b05b2c4ff9b2f6826282e3a6cc3f4cd268f43cd9a329d2159 evidence/rlinf_environment.json
36
  b1d0dca8515f82edbd9ffeb1b33f9023e24f23c68a1a644faf23caefedf7c8d1 evidence/world_model_training_manifest.json
37
+ ff3818dca101b19d4bf7f7cf146c93fa58d399ea6babe0b16f150b3563064e80 latest_policy.json
38
+ 78e03d367bb5d43544ff1b7e672d3eb7a31d2c6e0131399850e40a66b08b9a9d reproduction/README.zh-CN.md
39
  f490f560a262e9402230bb0e7f1f965853dc24c4c72b4d6b3941293c40802e0b reproduction/eval_train.py
40
  8d0c9116b5b8624aa8dba4f13b76206b7d326a44aa6a9c2b627076c8266b4582 reproduction/launcher.py
41
+ 18b7d75582005b89b0b59ac705aad2ece7c61b47152d058794c02f07f10197c4 reproduction/portable.py
42
+ 6827405385e2a143d0b593cf630865ba6b5c1ed5cd6bac94db5e38bc71c65695 reproduction/run_world_model_cycle.sh
43
+ 9ae94e1f81f214044aa270223c5a4ddee318908627042f17e4186eb6f29fa157 reproduction/world_model.py
44
  936193ae5fa7432637b050654633496a62455573abd0224dcfb8e118aceb8f39 runtime/cosmos_packages_0.tar.zst
45
  bbac3dee6879dc41b12082e07400aa6adac52bbf1c4dc8728e53bf8df20ef709 runtime/cosmos_packages_1.tar.zst
46
  c4940b5a72db60e1de3eb94534034d4d96be53714acb11044f910c0a8c24f1b2 runtime/python310.tar.zst
 
50
  19114ac59362c80778ca751a7ae8635717ffb64d13c81ab0451c420c14b29bc9 runtime/rlinf_packages_1.tar.zst
51
  574001e4ec917eaba32464fa65f81a3257b8691f9b41ea351c19ceff8e552175 source/grpo_spatial_source.tar.zst
52
  08e1648ba07ce8429bc2faee49fe9a5517fde7d81eae94441e91a07872c91319 source/step60_reproduction_update.tar.zst
53
+ 6825a0fdfa9693513de7df0c5d49fdbdb9065b3db4b1d4928bff1840a734e2f7 source/world_model_cycle_update.tar.zst
54
  b4a01639bdac0e98073499bbb3a84cd29b2274dba80fa286f0c7ee27bf75b949 weights/cosmos_step2000/checkpoint_manifest.json
55
  7110ea589cfb2dabf4c90941cf5fc5c5d23fdf47ab78b7a16b56b5014e7a87bf weights/cosmos_step2000/iter_000002000/model/.metadata
56
  01f1eb9e46b123df765f614a18835e86393c3bdf7d6147b7be4453bc551b99e4 weights/cosmos_step2000/iter_000002000/model/__0_0.distcp
evidence/reproduction_cycle60.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "schema": "spatial-reproduction-cycle-v1",
3
+ "policy_resume_step": 60,
4
+ "collect_episodes": 500,
5
+ "tasks": 10,
6
+ "episodes_per_task": 50,
7
+ "max_steps": 240,
8
+ "collection_mode": "train",
9
+ "seed": 20261021,
10
+ "replay_source": "data/kir_sources",
11
+ "replay_episodes": 500,
12
+ "historical_collected_replay_included": false,
13
+ "validation_fraction": 0.2,
14
+ "new_data_sampling_fraction": 0.5,
15
+ "wan_ranks": 4,
16
+ "cosmos_ranks": 4,
17
+ "accumulation": 4,
18
+ "effective_batch": 16,
19
+ "learning_rate": 1e-06,
20
+ "cosmos_steps": 2000,
21
+ "save_interval": 1000,
22
+ "cosmos_recipe": "v3-reconstructed",
23
+ "wan_stop": "next complete update after Cosmos finishes",
24
+ "reserve_memory": true,
25
+ "memory_headroom_gib": 3.5,
26
+ "model_initializers": {
27
+ "wan_step": 1000,
28
+ "cosmos_step": 2000
29
+ },
30
+ "world_model_optimizer": "new optimizer for the new round",
31
+ "policy_optimizer": "resume complete step60 DCP",
32
+ "grpo_target_step": 80,
33
+ "paired_model_selection": "train/selected_world_models.json",
34
+ "entry": "bash reproduction/run_world_model_cycle.sh \"$PWD/runs/cycle60\"",
35
+ "validation": {
36
+ "status": "passed",
37
+ "tests_passed": 18,
38
+ "cpu_only": true,
39
+ "independent_runtime_check": true,
40
+ "wan_and_cosmos_imports": true,
41
+ "native_training_dry_run": true,
42
+ "ranks_per_model": 4,
43
+ "effective_batch": 16,
44
+ "reserve_memory": true,
45
+ "save_interval": 1000,
46
+ "workflow_stages": 7,
47
+ "documentation_bash_blocks": 10,
48
+ "gpu_collection_or_training_started": false
49
+ }
50
+ }
latest_policy.json CHANGED
@@ -20,5 +20,9 @@
20
  },
21
  "completed_utc": "2026-10-25T13:18:28Z",
22
  "recommended_resume_step": 60,
23
- "continuation_example": "python3 reproduction/portable.py train --resume 60 --target 80 --output \"$PWD/runs/resume60_to80\""
 
 
 
 
24
  }
 
20
  },
21
  "completed_utc": "2026-10-25T13:18:28Z",
22
  "recommended_resume_step": 60,
23
+ "continuation_example": "bash reproduction/run_world_model_cycle.sh \"$PWD/runs/cycle60\"",
24
+ "direct_grpo_example": "python3 reproduction/portable.py train --resume 60 --target 80 --output \"$PWD/runs/resume60_to80\"",
25
+ "direct_grpo_updates_world_models": false,
26
+ "recommended_workflow": "collect 500 episodes, update Wan/Cosmos, then resume policy60 to80",
27
+ "workflow_evidence": "evidence/reproduction_cycle60.json"
28
  }
release_manifest.json CHANGED
@@ -67,8 +67,8 @@
67
  },
68
  {
69
  "path": "README.md",
70
- "size": 7625,
71
- "sha256": "a233ff8ba459e8daa3ab72c2c2061c6cb2f9a38f682d9cd0be7840b881b59e0b"
72
  },
73
  {
74
  "path": "assets/cosmos/libero_dataset_statistics.json",
@@ -170,6 +170,11 @@
170
  "size": 453,
171
  "sha256": "cc963ddd48281aece1af1a1ccafde791879340728d117f0d692f1136ee289e59"
172
  },
 
 
 
 
 
173
  {
174
  "path": "evidence/rlinf_environment.json",
175
  "size": 22254,
@@ -182,13 +187,13 @@
182
  },
183
  {
184
  "path": "latest_policy.json",
185
- "size": 722,
186
- "sha256": "f436503a0dd25df2dc327a73c54dd776945cf3d952c30875942e72032d99492d"
187
  },
188
  {
189
  "path": "reproduction/README.zh-CN.md",
190
- "size": 7253,
191
- "sha256": "1a62781c9104b8dfb0a9d2fd869da6ba0886e6fcf4967dc566090bb4873532c5"
192
  },
193
  {
194
  "path": "reproduction/eval_train.py",
@@ -202,8 +207,18 @@
202
  },
203
  {
204
  "path": "reproduction/portable.py",
205
- "size": 15007,
206
- "sha256": "b6418fea3feeab7d912f0f84c0a9866cade77c000ec0b574d02fe97295a0230f"
 
 
 
 
 
 
 
 
 
 
207
  },
208
  {
209
  "path": "runtime/cosmos_packages_0.tar.zst",
@@ -250,6 +265,11 @@
250
  "size": 13965,
251
  "sha256": "08e1648ba07ce8429bc2faee49fe9a5517fde7d81eae94441e91a07872c91319"
252
  },
 
 
 
 
 
253
  {
254
  "path": "weights/cosmos_step2000/checkpoint_manifest.json",
255
  "size": 1095,
@@ -551,9 +571,14 @@
551
  "path": "source/step60_reproduction_update.tar.zst",
552
  "destination": ".",
553
  "sha256": "08e1648ba07ce8429bc2faee49fe9a5517fde7d81eae94441e91a07872c91319"
 
 
 
 
 
554
  }
555
  ],
556
- "total_bytes": 126318775207,
557
  "reference": {
558
  "suite": "libero_spatial",
559
  "resume_policy_step": 40,
@@ -582,7 +607,9 @@
582
  }
583
  },
584
  "latest_policy_step": 60,
585
- "recommended_resume_step": 60
 
 
586
  },
587
- "updated_utc": "2026-10-26T08:43:18.347958+00:00"
588
  }
 
67
  },
68
  {
69
  "path": "README.md",
70
+ "size": 10813,
71
+ "sha256": "398a6b9b5e1dd0a85b326e5e7c9e35370ed8818e41c5ebdd1d27c1e046a92a2e"
72
  },
73
  {
74
  "path": "assets/cosmos/libero_dataset_statistics.json",
 
170
  "size": 453,
171
  "sha256": "cc963ddd48281aece1af1a1ccafde791879340728d117f0d692f1136ee289e59"
172
  },
173
+ {
174
+ "path": "evidence/reproduction_cycle60.json",
175
+ "size": 1495,
176
+ "sha256": "caf6b507e714451c894f14e3b4b0a6a889cb63c839b1cf6024333a53363c2169"
177
+ },
178
  {
179
  "path": "evidence/rlinf_environment.json",
180
  "size": 22254,
 
187
  },
188
  {
189
  "path": "latest_policy.json",
190
+ "size": 1017,
191
+ "sha256": "ff3818dca101b19d4bf7f7cf146c93fa58d399ea6babe0b16f150b3563064e80"
192
  },
193
  {
194
  "path": "reproduction/README.zh-CN.md",
195
+ "size": 10441,
196
+ "sha256": "78e03d367bb5d43544ff1b7e672d3eb7a31d2c6e0131399850e40a66b08b9a9d"
197
  },
198
  {
199
  "path": "reproduction/eval_train.py",
 
207
  },
208
  {
209
  "path": "reproduction/portable.py",
210
+ "size": 16580,
211
+ "sha256": "18b7d75582005b89b0b59ac705aad2ece7c61b47152d058794c02f07f10197c4"
212
+ },
213
+ {
214
+ "path": "reproduction/run_world_model_cycle.sh",
215
+ "size": 2817,
216
+ "sha256": "6827405385e2a143d0b593cf630865ba6b5c1ed5cd6bac94db5e38bc71c65695"
217
+ },
218
+ {
219
+ "path": "reproduction/world_model.py",
220
+ "size": 1859,
221
+ "sha256": "9ae94e1f81f214044aa270223c5a4ddee318908627042f17e4186eb6f29fa157"
222
  },
223
  {
224
  "path": "runtime/cosmos_packages_0.tar.zst",
 
265
  "size": 13965,
266
  "sha256": "08e1648ba07ce8429bc2faee49fe9a5517fde7d81eae94441e91a07872c91319"
267
  },
268
+ {
269
+ "path": "source/world_model_cycle_update.tar.zst",
270
+ "size": 18283,
271
+ "sha256": "6825a0fdfa9693513de7df0c5d49fdbdb9065b3db4b1d4928bff1840a734e2f7"
272
+ },
273
  {
274
  "path": "weights/cosmos_step2000/checkpoint_manifest.json",
275
  "size": 1095,
 
571
  "path": "source/step60_reproduction_update.tar.zst",
572
  "destination": ".",
573
  "sha256": "08e1648ba07ce8429bc2faee49fe9a5517fde7d81eae94441e91a07872c91319"
574
+ },
575
+ {
576
+ "path": "source/world_model_cycle_update.tar.zst",
577
+ "destination": ".",
578
+ "sha256": "6825a0fdfa9693513de7df0c5d49fdbdb9065b3db4b1d4928bff1840a734e2f7"
579
  }
580
  ],
581
+ "total_bytes": 126318807905,
582
  "reference": {
583
  "suite": "libero_spatial",
584
  "resume_policy_step": 40,
 
607
  }
608
  },
609
  "latest_policy_step": 60,
610
+ "recommended_resume_step": 60,
611
+ "recommended_workflow": "collect500_update_wms_resume60_to80",
612
+ "recommended_target_step": 80
613
  },
614
+ "updated_utc": "2026-10-26T13:36:55.864669+00:00"
615
  }
reproduction/README.zh-CN.md CHANGED
@@ -7,7 +7,18 @@
7
  10 个任务 × 50 次评估成功率为 **77.2%(386/500)**。
8
  `latest_policy.json` 记录最新断点、评估结果和续训入口。40、45、50 步用于历史对比。
9
 
10
- 下载并执行下文的 `restore`、`check` 后,从 60 步继续训练 20 步,到总步数 80:
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  ```bash
13
  screen -dmS spatial-grpo60-to80 bash -c \
@@ -119,10 +130,54 @@ python3 reproduction/portable.py eval --checkpoint 60 --output "$PWD/runs/eval60
119
 
120
  ## 后续世界模型更新
121
 
122
- 源码中保留了采集与更新工具。当前约定为:Cosmos 完成目标步数后,Wan 在下一个
123
- 完整更新处保存并结束,然后用最新双世界模型继续 GRPO。无需让 Wan 补到相同步数,
124
- 视频指标另行安排。使用 `experiments/wm_update_until_cosmos.py` 作为新的并行训练
125
- 入口,读取 `selected_world_models.json` 来打包实际选定的模型。
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
 
127
  原服务器的邮件配置、token、登录缓存、Ray 临时目录、活动进程和未完成检查点均
128
  不属于发布包。新服务器需要邮件通知时,另行配置现有 `watch_training_email.py`。
 
7
  10 个任务 × 50 次评估成功率为 **77.2%(386/500)**。
8
  `latest_policy.json` 记录最新断点、评估结果和续训入口。40、45、50 步用于历史对比。
9
 
10
+ 下载并执行下文的 `restore`、`check` 后,完整的下一轮实验使用以下入口:
11
+
12
+ ```bash
13
+ screen -dmS spatial-cycle60 bash -c \
14
+ 'bash reproduction/run_world_model_cycle.sh "$PWD/runs/cycle60"'
15
+ screen -r spatial-cycle60
16
+ ```
17
+
18
+ 它依次执行:60 步策略采集 500 条真实双相机轨迹 → 更新 Wan/Cosmos →
19
+ 打包本轮新模型 → 策略从 60 步继续到 80 步。完整配方见“后续世界模型更新”。
20
+
21
+ 以下单条命令只续训 GRPO,不采集数据或更新世界模型;使用包内 Wan 1000/Cosmos 2000:
22
 
23
  ```bash
24
  screen -dmS spatial-grpo60-to80 bash -c \
 
130
 
131
  ## 后续世界模型更新
132
 
133
+ 完整入口为 `reproduction/run_world_model_cycle.sh`,从恢复好的发布包根目录执行,
134
+ 需要八张可用 GPU。每个原生入口启动前都会检查占用;指定的卡有其他作业时退出。
135
+ 采集和世界模型训练均使用实际计算进程持有的可复用显存缓存,保留 3.5 GiB 设备余量。
136
+
137
+ 先查看命令计划,不启动 GPU 任务:
138
+
139
+ ```bash
140
+ bash reproduction/run_world_model_cycle.sh --dry-run "$PWD/runs/cycle60"
141
+ ```
142
+
143
+ 正式执行上面的 `screen -dmS spatial-cycle60 ...` 命令。各阶段为:
144
+
145
+ 1. **采集真实数据**:八卡使用 `weights/policy/global_step_60/`,在 LIBERO-Spatial
146
+ 的 10 个任务上各采集 50 条轨迹。保留成功和失败,`mode=train`,每条最多 240 步,
147
+ 每次执行 8 个动作;主相机、腕部相机、动作和仿真状态按同一帧索引保存。
148
+ 结果在 `runs/cycle60/collection/`。
149
+ 2. **准备训练集**:新采集的 500 条轨迹与包内 `data/kir_sources/` 的 500 条公开
150
+ Spatial 轨迹组成新数据/回放数据,验证比例 0.2;训练采样的新数据比例为 0.5。
151
+ 生成 `runs/cycle60/manifest.json` 并校验文件。历史每轮采集的原始数据未随包发布;
152
+ 此处回放来源是包内公开轨迹。
153
+ 3. **更新两个世界模型**:Wan/Cosmos 各四卡并行,梯度累计 4 次,有效 batch 各为 16,
154
+ 学习率 `1e-6`,Cosmos 使用 `v3-reconstructed` 配方,目标 2000 步,
155
+ 显式设置 `--save-interval 1000`。从包内 Wan 1000/Cosmos 2000 的模型参数初始化,
156
+ 为本轮数据建立新的世界模型优化器;历史世界模型优化器状态不在发布包中。
157
+ 4. **选择并打包新模型**:使用 `wm_update_until_cosmos.py` 控制两个训练组。
158
+ Cosmos 完成 2000 步后,请求 Wan 在下一个完整优化器更新后保存并结束,
159
+ 不强制 Wan 达到 2000 步。读取 `train/selected_world_models.json`,打包生成
160
+ `runs/cycle60/model_pair/pair.json`。视频指标可另行评估,不阻塞接续。
161
+ 5. **继续 GRPO**:恢复第 60 步策略的完整 DCP 和优化器状态,用本轮新模型训练至
162
+ 总步数 80;第 70、80 步保存完整策略训练状态,每 5 步保存策略并做真实 Spatial
163
+ 10×50 评估。结果在 `runs/cycle60/grpo/`。
164
+
165
+ `reproduction/world_model.py` 为原生采集和更新工具设置本地恢复后的源码、解释器、
166
+ 模型和数据路径。也可分阶段执行;例如本轮世界模型已训练完:
167
+
168
+ ```bash
169
+ python3 reproduction/world_model.py package \
170
+ --selection "$PWD/runs/cycle60/train/selected_world_models.json" \
171
+ --output "$PWD/runs/cycle60/model_pair"
172
+
173
+ python3 reproduction/portable.py train --resume 60 --target 80 \
174
+ --model-pair "$PWD/runs/cycle60/model_pair/pair.json" \
175
+ --output "$PWD/runs/cycle60/grpo"
176
+ ```
177
+
178
+ `--model-pair` 会同时切换 Wan 和 Cosmos,并复用冻结的 VAE、奖励模型和初始观测资源。
179
+ 不用该参数时,继续使用发布包内的世界模型。完整入口使用种子 `20261021`;
180
+ 通过 `WM_CYCLE_GPUS`、`WM_CYCLE_SEED` 可调整物理卡号和本轮随机种子。
181
 
182
  原服务器的邮件配置、token、登录缓存、Ray 临时目录、活动进程和未完成检查点均
183
  不属于发布包。新服务器需要邮件通知时,另行配置现有 `watch_training_email.py`。
reproduction/portable.py CHANGED
@@ -250,6 +250,28 @@ def environment(root, output):
250
  return env
251
 
252
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
  def run(root, args):
254
  ready = root / '.restore/ready.json'
255
  if not ready.exists() or read(ready).get('root') != str(root):
@@ -258,6 +280,9 @@ def run(root, args):
258
  if args.command != 'check' and output.exists():
259
  raise FileExistsError(f'Choose a new run output: {output}')
260
  env = environment(root, output)
 
 
 
261
  project = root / 'project'
262
  command = ['bash', str(project / 'experiments/run_spatial_wovr_shared_pool_8gpu.sh')]
263
  if args.command == 'check':
@@ -288,7 +313,9 @@ def run(root, args):
288
  command += ['actor.fsdp_config.save_training_state_at_steps=' + json.dumps(saves, separators=(',', ':'))]
289
  write(root / 'runs' / f'launch_{args.command}.json', dict(command=command,
290
  output=str(output), source_policy_step=args.checkpoint if args.command == 'eval' else args.resume,
291
- wan_step=1000, cosmos_step=2000))
 
 
292
  print('Command:', ' '.join(command), flush=True)
293
  return subprocess.call(command, env=env, cwd=project)
294
 
@@ -302,6 +329,7 @@ def main():
302
  parser.add_argument('--checkpoint', type=int, choices=[40, 45, 50, 60], default=60)
303
  parser.add_argument('--steps', type=int, default=20)
304
  parser.add_argument('--target', type=int)
 
305
  parser.add_argument('--output', type=Path)
306
  args = parser.parse_args()
307
  root = args.root.resolve()
 
250
  return env
251
 
252
 
253
+ def select_model_pair(root, env, pair_path):
254
+ """Select updated model weights while retaining the frozen VAE and assets."""
255
+ pair_path = pair_path.resolve()
256
+ pair = read(pair_path)
257
+ if pair.get('schema') != 'spatial-wm-pair-v1':
258
+ raise ValueError('Expected a packaged world-model pair.json')
259
+ wan, cosmos = Path(pair['wan']), Path(pair['cosmos'])
260
+ if not wan.is_absolute() or not cosmos.is_absolute():
261
+ raise ValueError('Package the model pair using an absolute --output directory')
262
+ baseline = root / 'assets/wan_baseline'
263
+ if (wan / 'Wan2.2_VAE.pth').resolve() != (baseline / 'Wan2.2_VAE.pth').resolve():
264
+ raise ValueError('The updated pair must retain the frozen Wan VAE')
265
+ deployment = root / 'runs/wm_deployments' / checksum(pair_path)[:16]
266
+ link(deployment / 'model-00001.safetensors', wan / 'model-00001.safetensors')
267
+ for name in ['Wan2.2_VAE.pth', 'resnet_rm.pth']:
268
+ link(deployment / name, baseline / name)
269
+ link(deployment / 'dataset', root / 'data/wan_initial')
270
+ env.update(SPATIAL_WOVR_MODEL_PAIR=str(pair_path),
271
+ WAN_SPATIAL_CHECKPOINT=str(deployment), COSMOS_WRIST_CHECKPOINT=str(cosmos))
272
+ return pair
273
+
274
+
275
  def run(root, args):
276
  ready = root / '.restore/ready.json'
277
  if not ready.exists() or read(ready).get('root') != str(root):
 
280
  if args.command != 'check' and output.exists():
281
  raise FileExistsError(f'Choose a new run output: {output}')
282
  env = environment(root, output)
283
+ selected = None
284
+ if getattr(args, 'model_pair', None):
285
+ selected = select_model_pair(root, env, args.model_pair)
286
  project = root / 'project'
287
  command = ['bash', str(project / 'experiments/run_spatial_wovr_shared_pool_8gpu.sh')]
288
  if args.command == 'check':
 
313
  command += ['actor.fsdp_config.save_training_state_at_steps=' + json.dumps(saves, separators=(',', ':'))]
314
  write(root / 'runs' / f'launch_{args.command}.json', dict(command=command,
315
  output=str(output), source_policy_step=args.checkpoint if args.command == 'eval' else args.resume,
316
+ model_pair=env['SPATIAL_WOVR_MODEL_PAIR'],
317
+ wan_step=selected['wan_step'] if selected else 1000,
318
+ cosmos_step=selected['cosmos_step'] if selected else 2000))
319
  print('Command:', ' '.join(command), flush=True)
320
  return subprocess.call(command, env=env, cwd=project)
321
 
 
329
  parser.add_argument('--checkpoint', type=int, choices=[40, 45, 50, 60], default=60)
330
  parser.add_argument('--steps', type=int, default=20)
331
  parser.add_argument('--target', type=int)
332
+ parser.add_argument('--model-pair', type=Path, help='Use the newly packaged world-model pair.json')
333
  parser.add_argument('--output', type=Path)
334
  args = parser.parse_args()
335
  root = args.root.resolve()
reproduction/run_world_model_cycle.sh ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ # Collect real truth, update the paired WMs, then resume the latest policy.
3
+ set -euo pipefail
4
+ bundle_root="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd -P)"
5
+ cycle_dry_run=0
6
+ if [[ "${1:-}" == "--dry-run" ]]; then cycle_dry_run=1; shift; fi
7
+ cycle_output="${1:-$bundle_root/runs/cycle60}"
8
+ if [[ "$cycle_output" != /* ]]; then cycle_output="$PWD/$cycle_output"; fi
9
+ cycle_gpus="${WM_CYCLE_GPUS:-0,1,2,3,4,5,6,7}"
10
+ cycle_policy_step="${WM_CYCLE_POLICY_STEP:-60}"
11
+ cycle_target_step="${WM_CYCLE_TARGET_STEP:-80}"
12
+ cycle_wm_steps="${WM_CYCLE_WM_STEPS:-2000}"
13
+ cycle_seed="${WM_CYCLE_SEED:-20261021}"
14
+ if [[ "$cycle_output" == *$'\n'* ]]; then exit 2; fi
15
+ if [[ "$cycle_dry_run" == 0 ]]; then
16
+ if [[ -e "$cycle_output" ]]; then
17
+ printf 'Choose a new cycle output directory: %s\n' "$cycle_output" >&2
18
+ exit 1
19
+ fi
20
+ mkdir -p -- "$cycle_output"
21
+ fi
22
+ run_cycle_stage() {
23
+ if [[ "$cycle_dry_run" == 1 ]]; then
24
+ printf '%q ' "$@"
25
+ printf '\n'
26
+ else
27
+ "$@"
28
+ fi
29
+ }
30
+ run_cycle_stage python3 "$bundle_root/reproduction/world_model.py" check \
31
+ --check-runtime --output "$cycle_output/check"
32
+ run_cycle_stage python3 "$bundle_root/reproduction/world_model.py" collect \
33
+ --gpus "$cycle_gpus" --per-task 50 --mode train \
34
+ --policy-config "$bundle_root/config/spatial.reference.yaml" \
35
+ --policy-checkpoint "$bundle_root/weights/policy/global_step_$cycle_policy_step" \
36
+ --seed "$cycle_seed" --max-steps 240 --settle-steps 10 \
37
+ --reserve-memory --memory-headroom-gib 3.5 --output "$cycle_output/collection"
38
+ run_cycle_stage python3 "$bundle_root/reproduction/world_model.py" prepare \
39
+ --collection "$cycle_output/collection" --replay-root "$bundle_root/data/kir_sources" \
40
+ --val-fraction 0.2 --seed "$cycle_seed" --output "$cycle_output/manifest.json"
41
+ run_cycle_stage python3 "$bundle_root/reproduction/world_model.py" inspect \
42
+ --manifest "$cycle_output/manifest.json" --verify-files
43
+ run_cycle_stage python3 "$bundle_root/reproduction/world_model.py" train \
44
+ --model both --gpus "$cycle_gpus" --ranks-per-model 4 --accumulation 4 \
45
+ --steps "$cycle_wm_steps" --save-interval 1000 --lr 1e-6 --seed "$cycle_seed" \
46
+ --cosmos-recipe v3-reconstructed \
47
+ --settings "$bundle_root/project/experiments/config/spatial_wm_update.json" \
48
+ --manifest "$cycle_output/manifest.json" --reserve-memory --memory-headroom-gib 3.5 \
49
+ --output "$cycle_output/train"
50
+ run_cycle_stage python3 "$bundle_root/reproduction/world_model.py" package \
51
+ --selection "$cycle_output/train/selected_world_models.json" \
52
+ --output "$cycle_output/model_pair"
53
+ run_cycle_stage env SPATIAL_WOVR_GPUS="$cycle_gpus" python3 "$bundle_root/reproduction/portable.py" train \
54
+ --resume "$cycle_policy_step" --target "$cycle_target_step" \
55
+ --model-pair "$cycle_output/model_pair/pair.json" --output "$cycle_output/grpo"
reproduction/world_model.py ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Run the existing collector/update tools with the restored bundle's paths."""
3
+ import argparse
4
+ import os
5
+ from pathlib import Path
6
+ import sys
7
+
8
+ from portable import environment, read, select_model_pair
9
+
10
+ ENTRIES = {
11
+ 'check': 'wm_update.py',
12
+ 'collect': 'wm_update_reserved_collect.py',
13
+ 'prepare': 'wm_update.py',
14
+ 'inspect': 'wm_update.py',
15
+ 'train': 'wm_update_until_cosmos.py',
16
+ 'package': 'wm_update_until_cosmos.py',
17
+ }
18
+
19
+
20
+ def main():
21
+ parser = argparse.ArgumentParser(description=__doc__, add_help=False, allow_abbrev=False)
22
+ parser.add_argument('command', choices=list(ENTRIES))
23
+ parser.add_argument('--root', type=Path, default=Path(__file__).resolve().parents[1])
24
+ parser.add_argument('--init-pair', type=Path, help='Initialize this update from a previously packaged pair')
25
+ if len(sys.argv) == 1 or sys.argv[1] in ['-h', '--help']:
26
+ parser.print_help()
27
+ return 0
28
+ args, native_args = parser.parse_known_args()
29
+ root = args.root.resolve()
30
+ ready = root / '.restore/ready.json'
31
+ if not ready.is_file() or read(ready).get('root') != str(root):
32
+ raise RuntimeError('Run reproduction/portable.py restore and check first')
33
+ env = environment(root, root / 'runs/wm_update')
34
+ if args.init_pair:
35
+ select_model_pair(root, env, args.init_pair)
36
+ env.update(PYTHONPATH=os.pathsep.join([str(root / 'project'), str(root / 'project/experiments')]),
37
+ WM_UPDATE_RESERVE_MEMORY='1', WM_UPDATE_MEMORY_HEADROOM_GIB='3.5')
38
+ if args.command == 'check':
39
+ env['CUDA_VISIBLE_DEVICES'] = ''
40
+ python = root / 'envs/rlinf/bin/python'
41
+ command = [str(python), str(root / 'project/experiments' / ENTRIES[args.command]),
42
+ args.command, *native_args]
43
+ os.execve(str(python), command, env)
44
+
45
+
46
+ if __name__ == '__main__':
47
+ raise SystemExit(main())
source/world_model_cycle_update.tar.zst ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6825a0fdfa9693513de7df0c5d49fdbdb9065b3db4b1d4928bff1840a734e2f7
3
+ size 18283