Update README.md
Browse files
README.md
CHANGED
|
@@ -5,7 +5,6 @@ tags:
|
|
| 5 |
- text-to-video
|
| 6 |
- video-generation
|
| 7 |
- world-model
|
| 8 |
-
- video
|
| 9 |
- latent-video
|
| 10 |
- text-conditioned
|
| 11 |
- flow-matching
|
|
@@ -14,452 +13,777 @@ tags:
|
|
| 14 |
- torch-xla
|
| 15 |
- google-tpu
|
| 16 |
- spatiotemporal
|
|
|
|
| 17 |
- research
|
| 18 |
---
|
| 19 |
|
| 20 |
-
# WorldDiT —
|
| 21 |
|
| 22 |
-
|
| 23 |
|
| 24 |
-
|
| 25 |
|
| 26 |
-
The
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
- **Flow matching:** The network predicts the velocity field connecting real video latents and Gaussian noise.
|
| 37 |
-
- **EMA:** An exponential moving average of model parameters is maintained for video generation.
|
| 38 |
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|---|---:|---:|---:|---:|
|
| 43 |
-
| Base | 768 | 12 | 12 | ~159M |
|
| 44 |
-
| Large | 1408 | 24 | 22 | ~1.056B |
|
| 45 |
|
| 46 |
-
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
|
|
| 51 |
|---|---:|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
| Latent channels | 128 |
|
| 53 |
-
| Temporal positions | 13 |
|
| 54 |
-
|
|
| 55 |
| Tokens per sequence | 832 |
|
| 56 |
| Text embedding dimension | 768 |
|
|
|
|
| 57 |
|
| 58 |
-
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
-
The
|
| 63 |
|
| 64 |
-
|
| 65 |
|
| 66 |
-
|
| 67 |
-
x_t=(1-t)x_0+t\epsilon
|
| 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 |
-
python -c "import torch, torch_xla, numpy, av, lpips; print('Environment OK')"
|
| 104 |
-
```
|
| 105 |
|
| 106 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
-
The
|
| 109 |
|
| 110 |
```text
|
| 111 |
-
|
| 112 |
-
wm.py
|
| 113 |
-
train.py
|
| 114 |
-
train_1b.py
|
| 115 |
-
vae.py
|
| 116 |
-
text_emb.py
|
| 117 |
```
|
| 118 |
|
| 119 |
-
The
|
| 120 |
|
| 121 |
-
|
| 122 |
-
~/wm_data/
|
| 123 |
-
latents.npy
|
| 124 |
-
txt_emb.npy
|
| 125 |
-
txt_mask.npy
|
| 126 |
-
txt_idx.npy
|
| 127 |
|
| 128 |
-
|
| 129 |
-
last.pt
|
| 130 |
|
| 131 |
-
|
| 132 |
-
lat_stats.npz
|
| 133 |
-
```
|
| 134 |
|
| 135 |
-
|
| 136 |
|
| 137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
|
| 139 |
-
|
| 140 |
|
| 141 |
-
|
| 142 |
-
cd ~/WorldDiT
|
| 143 |
-
MAX_MIN=240 python train.py
|
| 144 |
-
```
|
| 145 |
|
| 146 |
-
|
|
|
|
|
|
|
| 147 |
|
| 148 |
-
The
|
| 149 |
|
| 150 |
```text
|
| 151 |
-
|
| 152 |
```
|
| 153 |
|
| 154 |
-
|
| 155 |
|
| 156 |
-
|
| 157 |
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 162 |
|
| 163 |
-
The
|
| 164 |
|
| 165 |
```text
|
| 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 |
-
from text_emb import encode
|
| 191 |
|
| 192 |
-
|
| 193 |
-
```
|
| 194 |
|
| 195 |
-
|
|
|
|
|
|
|
| 196 |
|
| 197 |
-
The
|
| 198 |
|
| 199 |
-
|
|
|
|
|
|
|
| 200 |
|
| 201 |
-
|
| 202 |
|
| 203 |
-
|
|
|
|
|
|
|
| 204 |
|
| 205 |
-
|
| 206 |
|
| 207 |
-
|
| 208 |
-
2. Decoding generated latents into RGB video frames.
|
| 209 |
|
| 210 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 211 |
|
| 212 |
-
|
| 213 |
-
~/vae_run/last.pt
|
| 214 |
-
```
|
| 215 |
|
| 216 |
-
|
| 217 |
|
| 218 |
-
The
|
| 219 |
|
| 220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 221 |
|
| 222 |
-
|
| 223 |
|
| 224 |
-
|
| 225 |
|
| 226 |
-
|
| 227 |
|
| 228 |
```text
|
| 229 |
-
~/
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
```
|
| 235 |
|
| 236 |
-
The
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 237 |
|
| 238 |
| File | Expected shape | Description |
|
| 239 |
|---|---|---|
|
| 240 |
-
| `latents.npy` | `(N, 128, 13, 8, 8)` | VAE-encoded video
|
| 241 |
-
| `txt_emb.npy` | `(M, L, 768)` |
|
| 242 |
| `txt_mask.npy` | `(M, L)` | Text attention masks |
|
| 243 |
-
| `txt_idx.npy` | `(N,)` | Mapping from video
|
| 244 |
-
|
| 245 |
-
|
|
|
|
| 246 |
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
The normalization statistics are stored in:
|
| 250 |
|
| 251 |
```text
|
| 252 |
~/wm_run/lat_stats.npz
|
| 253 |
```
|
| 254 |
|
| 255 |
-
The
|
| 256 |
|
| 257 |
```python
|
| 258 |
mean
|
| 259 |
std
|
| 260 |
```
|
| 261 |
|
| 262 |
-
|
| 263 |
|
| 264 |
-
|
|
|
|
|
|
|
| 265 |
|
| 266 |
-
|
| 267 |
|
| 268 |
-
|
|
|
|
|
|
|
| 269 |
|
| 270 |
-
```
|
| 271 |
-
~/wm.py
|
| 272 |
-
~/vae.py
|
| 273 |
-
~/text_emb.py
|
| 274 |
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
txt_mask.npy
|
| 279 |
-
txt_idx.npy
|
| 280 |
|
| 281 |
-
|
| 282 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
|
| 284 |
-
|
| 285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
```
|
| 287 |
|
| 288 |
-
|
| 289 |
|
| 290 |
-
|
| 291 |
|
| 292 |
-
|
| 293 |
|
| 294 |
-
|
| 295 |
|
| 296 |
-
|
| 297 |
|
| 298 |
-
|
|
|
|
|
|
|
| 299 |
|
| 300 |
-
|
| 301 |
-
- PyTorch
|
| 302 |
-
- PyTorch/XLA
|
| 303 |
-
- NumPy
|
| 304 |
-
- PyAV
|
| 305 |
-
- Google Cloud TPU runtime
|
| 306 |
|
| 307 |
-
|
|
|
|
|
|
|
| 308 |
|
| 309 |
-
The
|
| 310 |
|
| 311 |
-
|
| 312 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 313 |
```
|
| 314 |
|
| 315 |
-
|
| 316 |
|
| 317 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
|
| 319 |
-
##
|
| 320 |
|
| 321 |
-
|
| 322 |
|
| 323 |
-
|
|
|
|
|
|
|
| 324 |
|
| 325 |
-
|
| 326 |
|
| 327 |
-
|
| 328 |
-
|
| 329 |
-
|
| 330 |
-
|
| 331 |
-
|
| 332 |
-
|
| 333 |
-
|
| 334 |
-
|
| 335 |
-
|
| 336 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 337 |
|
| 338 |
-
|
| 339 |
|
| 340 |
```bash
|
| 341 |
-
|
| 342 |
```
|
| 343 |
|
| 344 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 345 |
|
| 346 |
-
|
| 347 |
|
| 348 |
-
|
| 349 |
|
| 350 |
-
|
| 351 |
|
| 352 |
| Parameter | Value |
|
| 353 |
|---|---:|
|
| 354 |
-
|
|
| 355 |
-
|
|
| 356 |
-
|
|
| 357 |
-
|
|
| 358 |
-
|
|
| 359 |
-
|
|
| 360 |
| Optimizer | AdamW |
|
| 361 |
-
|
|
| 362 |
-
|
|
| 363 |
-
|
|
| 364 |
-
|
|
| 365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 366 |
|
| 367 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 368 |
|
| 369 |
```bash
|
| 370 |
-
MAX_MIN=
|
|
|
|
|
|
|
| 371 |
```
|
| 372 |
|
| 373 |
-
|
| 374 |
|
| 375 |
-
|
| 376 |
|
| 377 |
```text
|
| 378 |
-
~/
|
|
|
|
|
|
|
|
|
|
| 379 |
```
|
| 380 |
|
| 381 |
-
|
| 382 |
|
| 383 |
-
|
|
|
|
|
|
|
|
|
|
| 384 |
|
| 385 |
-
|
| 386 |
|
| 387 |
-
```
|
| 388 |
-
|
| 389 |
-
|
|
|
|
|
|
|
|
|
|
| 390 |
```
|
| 391 |
|
| 392 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 393 |
|
| 394 |
-
|
| 395 |
-
- `ema`: Exponential moving average parameters.
|
| 396 |
-
- `step`: Training step.
|
| 397 |
-
- `cfg`: Architecture configuration (large model only).
|
| 398 |
|
| 399 |
-
The
|
| 400 |
|
| 401 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 402 |
|
| 403 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 404 |
|
| 405 |
```text
|
| 406 |
-
|
| 407 |
-
test_step0004000.mp4
|
| 408 |
```
|
| 409 |
|
| 410 |
-
The
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 411 |
|
| 412 |
-
|
|
|
|
|
|
|
|
|
|
| 413 |
|
| 414 |
```text
|
| 415 |
-
|
|
|
|
|
|
|
|
|
|
| 416 |
```
|
| 417 |
|
| 418 |
-
|
| 419 |
|
| 420 |
-
|
| 421 |
|
| 422 |
-
|
| 423 |
|
| 424 |
-
|
| 425 |
|
| 426 |
-
|
| 427 |
|
| 428 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 429 |
|
| 430 |
-
|
| 431 |
|
| 432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 433 |
|
| 434 |
-
|
| 435 |
|
| 436 |
-
|
|
|
|
|
|
|
| 437 |
|
| 438 |
-
|
| 439 |
|
| 440 |
-
|
| 441 |
-
from wm import WorldDiT
|
| 442 |
|
| 443 |
-
|
|
|
|
| 444 |
```
|
| 445 |
|
| 446 |
-
|
| 447 |
|
| 448 |
-
```
|
| 449 |
-
|
| 450 |
-
d=1408,
|
| 451 |
-
depth=24,
|
| 452 |
-
heads=22
|
| 453 |
-
)
|
| 454 |
```
|
| 455 |
|
| 456 |
-
|
| 457 |
|
| 458 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 459 |
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
- text-to-video
|
| 6 |
- video-generation
|
| 7 |
- world-model
|
|
|
|
| 8 |
- latent-video
|
| 9 |
- text-conditioned
|
| 10 |
- flow-matching
|
|
|
|
| 13 |
- torch-xla
|
| 14 |
- google-tpu
|
| 15 |
- spatiotemporal
|
| 16 |
+
- egocentric-video
|
| 17 |
- research
|
| 18 |
---
|
| 19 |
|
| 20 |
+
# WorldDiT — Clustered Latent Video World Models
|
| 21 |
|
| 22 |
+
WorldDiT is a collection of compact Transformer-based video world models trained on clustered egocentric video data.
|
| 23 |
|
| 24 |
+
Instead of training one large model on the entire dataset, the training pipeline divides the dataset into four semantic groups. Each group receives its own WorldDiT model, trained independently on a dedicated TPU chip.
|
| 25 |
|
| 26 |
+
The models operate in a learned spatiotemporal latent space produced by a separate Variational Autoencoder (VAE). Text embeddings condition video generation, while temporal context and hand-related features are incorporated into the automatically generated training prompts.
|
| 27 |
|
| 28 |
+
The implementation uses PyTorch, PyTorch/XLA, and Google Cloud TPUs.
|
| 29 |
+
|
| 30 |
+
## Overview
|
| 31 |
|
| 32 |
+
The training pipeline consists of four main stages:
|
| 33 |
|
| 34 |
+
1. **Semantic clustering:** Video segments are grouped into four clusters using cosine similarity between text embeddings.
|
| 35 |
+
2. **Group preparation:** A larger and more diverse set of clips is selected for each cluster. New prompts are generated using task descriptions, temporal context, environment information, and hand features.
|
| 36 |
+
3. **Independent model training:** Four separate WorldDiT models are trained, with one training process assigned to each TPU chip.
|
| 37 |
+
4. **Video reconstruction:** The trained EMA models generate latent video sequences, which are decoded into RGB videos using the pretrained VAE.
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
Each group is trained as an independent model rather than as a shard of one distributed model.
|
| 40 |
|
| 41 |
+
## Architecture
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
+
### Model configuration
|
| 44 |
|
| 45 |
+
Each group uses the same WorldDiT architecture:
|
| 46 |
|
| 47 |
+
| Parameter | Value |
|
| 48 |
|---|---:|
|
| 49 |
+
| Hidden size | 512 |
|
| 50 |
+
| Transformer depth | 10 |
|
| 51 |
+
| Attention heads | 8 |
|
| 52 |
+
| Head dimension | 64 |
|
| 53 |
+
| Approximate parameters | 50M |
|
| 54 |
| Latent channels | 128 |
|
| 55 |
+
| Temporal latent positions | 13 |
|
| 56 |
+
| Spatial latent resolution | 8 × 8 |
|
| 57 |
| Tokens per sequence | 832 |
|
| 58 |
| Text embedding dimension | 768 |
|
| 59 |
+
| Text sequence length in v2 | 64 |
|
| 60 |
|
| 61 |
+
The model is instantiated as:
|
| 62 |
|
| 63 |
+
```python
|
| 64 |
+
model = WorldDiT(
|
| 65 |
+
d=512,
|
| 66 |
+
depth=10,
|
| 67 |
+
heads=8
|
| 68 |
+
)
|
| 69 |
+
```
|
| 70 |
|
| 71 |
+
The parameter count is also printed by the training script when each group starts.
|
| 72 |
|
| 73 |
+
### Video latent representation
|
| 74 |
|
| 75 |
+
WorldDiT does not directly predict RGB pixels.
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
Each training example is a VAE-encoded video sequence with the shape:
|
| 78 |
|
| 79 |
+
```text
|
| 80 |
+
(128, 13, 8, 8)
|
| 81 |
+
```
|
| 82 |
|
| 83 |
+
The dimensions represent:
|
| 84 |
|
| 85 |
+
- 128 latent channels.
|
| 86 |
+
- 13 temporal positions.
|
| 87 |
+
- An 8 × 8 spatial latent grid.
|
| 88 |
+
|
| 89 |
+
The resulting sequence contains 832 spatiotemporal tokens.
|
| 90 |
|
| 91 |
+
The pretrained VAE decoder reconstructs the generated latent representation into RGB video. In the current implementation, the decoded output has the shape:
|
| 92 |
|
| 93 |
+
```text
|
| 94 |
+
(3, 97, 256, 256)
|
| 95 |
+
```
|
| 96 |
|
| 97 |
+
This corresponds to 97 RGB frames at 256 × 256 resolution.
|
| 98 |
|
| 99 |
+
## Semantic clustering
|
| 100 |
|
| 101 |
+
The initial clustering stage divides the dataset into four groups.
|
| 102 |
|
| 103 |
+
The clustering script uses precomputed text embeddings and attention masks:
|
| 104 |
|
| 105 |
+
```text
|
| 106 |
+
~/wm_data/
|
| 107 |
+
txt_emb.npy
|
| 108 |
+
txt_mask.npy
|
| 109 |
+
txt_idx.npy
|
| 110 |
+
texts.json
|
| 111 |
+
meta.json
|
| 112 |
```
|
| 113 |
|
| 114 |
+
For each text entry, token embeddings are averaged using the attention mask and normalized to unit length.
|
| 115 |
|
| 116 |
+
The embedding of each video segment is selected through `txt_idx.npy`.
|
| 117 |
|
| 118 |
+
Clustering uses cosine similarity and k-means++ initialization:
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
| Parameter | Value |
|
| 121 |
+
|---|---:|
|
| 122 |
+
| Number of groups | 4 |
|
| 123 |
+
| Initialization | k-means++ |
|
| 124 |
+
| Restarts | 5 |
|
| 125 |
+
| Iterations per restart | 50 |
|
| 126 |
+
| Distance | Cosine distance |
|
| 127 |
|
| 128 |
+
The initial clustering stage selects 10 representative clips per group and writes:
|
| 129 |
|
| 130 |
```text
|
| 131 |
+
~/wm_groups/groups.json
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
```
|
| 133 |
|
| 134 |
+
The v2 preparation stage reuses the same clustering procedure but increases the selection to 38 clips per group.
|
| 135 |
|
| 136 |
+
This produces four groups with up to 38 selected video segments each.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 137 |
|
| 138 |
+
## V2 dataset preparation
|
|
|
|
| 139 |
|
| 140 |
+
The v2 pipeline creates more detailed and diverse text conditions for each selected video segment.
|
|
|
|
|
|
|
| 141 |
|
| 142 |
+
It uses several sources of information:
|
| 143 |
|
| 144 |
+
- Original task descriptions.
|
| 145 |
+
- Environment descriptions.
|
| 146 |
+
- Current action or keystep.
|
| 147 |
+
- Previous and next actions from the same video.
|
| 148 |
+
- Hand visibility and movement features.
|
| 149 |
+
- Whether a hand is gripping an object or has an open palm.
|
| 150 |
+
- Approximate hand movement speed.
|
| 151 |
+
- The position of the segment within the full video.
|
| 152 |
|
| 153 |
+
### Hand features
|
| 154 |
|
| 155 |
+
The preparation script loads:
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
+
```text
|
| 158 |
+
~/wm_data/hand_feats.npy
|
| 159 |
+
```
|
| 160 |
|
| 161 |
+
The array is reshaped into:
|
| 162 |
|
| 163 |
```text
|
| 164 |
+
(-1, 4, 2, 10)
|
| 165 |
```
|
| 166 |
|
| 167 |
+
The hand features are used to construct textual descriptions of the observed hands.
|
| 168 |
|
| 169 |
+
The generated descriptions distinguish between:
|
| 170 |
|
| 171 |
+
- Both hands visible.
|
| 172 |
+
- One hand visible.
|
| 173 |
+
- Hands mostly outside the frame.
|
| 174 |
+
- Gripping an object.
|
| 175 |
+
- Open palm.
|
| 176 |
+
- Quick hand movement.
|
| 177 |
+
- Slow deliberate motion.
|
| 178 |
+
- Hands nearly still.
|
| 179 |
+
|
| 180 |
+
### Temporal context
|
| 181 |
|
| 182 |
+
The preparation stage reads:
|
| 183 |
|
| 184 |
```text
|
| 185 |
+
~/ego-raw/spans.csv
|
| 186 |
```
|
| 187 |
|
| 188 |
+
It uses the `clip_id`, `start_s`, `end_s`, and `keystep` fields to recover the previous and next actions surrounding each selected segment.
|
| 189 |
|
| 190 |
+
This adds temporal context to the generated prompt.
|
| 191 |
|
| 192 |
+
For example, a prompt can describe the current action while also mentioning what happened immediately before it and what action follows.
|
| 193 |
+
|
| 194 |
+
### Prompt generation
|
| 195 |
+
|
| 196 |
+
The v2 pipeline uses multiple prompt templates combining task, environment, current action, previous and next actions, hand state, and movement speed.
|
| 197 |
+
|
| 198 |
+
The resulting prompts are encoded with the external `text_emb.py` module.
|
| 199 |
+
|
| 200 |
+
The encoder is configured with:
|
| 201 |
+
|
| 202 |
+
```python
|
| 203 |
+
text_emb.L = 64
|
| 204 |
```
|
| 205 |
|
| 206 |
+
For each group, the preparation stage writes:
|
| 207 |
|
| 208 |
+
```text
|
| 209 |
+
~/wm_groups/v2/
|
| 210 |
+
groups_v2.json
|
| 211 |
+
emb_g0.npy
|
| 212 |
+
emb_g1.npy
|
| 213 |
+
emb_g2.npy
|
| 214 |
+
emb_g3.npy
|
| 215 |
+
msk_g0.npy
|
| 216 |
+
msk_g1.npy
|
| 217 |
+
msk_g2.npy
|
| 218 |
+
msk_g3.npy
|
| 219 |
+
```
|
| 220 |
|
| 221 |
+
Each group's embeddings and masks correspond to that group's selected prompts.
|
| 222 |
|
| 223 |
+
The generated group metadata contains:
|
| 224 |
|
| 225 |
+
- Group identifier.
|
| 226 |
+
- Original cluster size.
|
| 227 |
+
- Most common tasks.
|
| 228 |
+
- Selected clip indices.
|
| 229 |
+
- Generated text prompts.
|
| 230 |
|
| 231 |
+
## Flow-matching objective
|
| 232 |
|
| 233 |
+
WorldDiT is trained using a flow-matching objective.
|
|
|
|
| 234 |
|
| 235 |
+
Given a clean latent sequence \(x_0\), Gaussian noise \(\epsilon\), and a time variable \(t\), the training script constructs:
|
|
|
|
| 236 |
|
| 237 |
+
\[
|
| 238 |
+
x_t=(1-t)x_0+t\epsilon
|
| 239 |
+
\]
|
| 240 |
|
| 241 |
+
The target velocity is:
|
| 242 |
|
| 243 |
+
\[
|
| 244 |
+
v=\epsilon-x_0
|
| 245 |
+
\]
|
| 246 |
|
| 247 |
+
The model predicts:
|
| 248 |
|
| 249 |
+
\[
|
| 250 |
+
\hat v_\theta(x_t,t,c)
|
| 251 |
+
\]
|
| 252 |
|
| 253 |
+
where \(c\) represents the text embeddings and attention mask.
|
| 254 |
|
| 255 |
+
The training loss is:
|
|
|
|
| 256 |
|
| 257 |
+
\[
|
| 258 |
+
\mathcal{L}=
|
| 259 |
+
\mathbb{E}\left[
|
| 260 |
+
\left\|
|
| 261 |
+
\hat v_\theta(x_t,t,c)-(\epsilon-x_0)
|
| 262 |
+
\right\|_2^2
|
| 263 |
+
\right]
|
| 264 |
+
\]
|
| 265 |
|
| 266 |
+
The time variable is sampled independently for each temporal position in a video sequence. With a probability of 50%, all temporal positions in a training example share the same time value.
|
|
|
|
|
|
|
| 267 |
|
| 268 |
+
### Optimization
|
| 269 |
|
| 270 |
+
The training process uses:
|
| 271 |
|
| 272 |
+
- AdamW optimizer.
|
| 273 |
+
- BF16 autocasting on XLA.
|
| 274 |
+
- Gradient clipping.
|
| 275 |
+
- Learning-rate warmup.
|
| 276 |
+
- Exponential moving average of model parameters.
|
| 277 |
|
| 278 |
+
The EMA parameters are updated with a decay of 0.99.
|
| 279 |
|
| 280 |
+
## Repository and file layout
|
| 281 |
|
| 282 |
+
The scripts expect the following files under the user's home directory:
|
| 283 |
|
| 284 |
```text
|
| 285 |
+
~/
|
| 286 |
+
wm.py
|
| 287 |
+
vae.py
|
| 288 |
+
text_emb.py
|
| 289 |
+
|
| 290 |
+
wm_data/
|
| 291 |
+
latents.npy
|
| 292 |
+
txt_emb.npy
|
| 293 |
+
txt_mask.npy
|
| 294 |
+
txt_idx.npy
|
| 295 |
+
texts.json
|
| 296 |
+
meta.json
|
| 297 |
+
hand_feats.npy
|
| 298 |
+
|
| 299 |
+
wm_run/
|
| 300 |
+
lat_stats.npz
|
| 301 |
+
|
| 302 |
+
vae_run/
|
| 303 |
+
last.pt
|
| 304 |
+
|
| 305 |
+
ego-raw/
|
| 306 |
+
spans.csv
|
| 307 |
+
|
| 308 |
+
wm_groups/
|
| 309 |
+
cluster.py
|
| 310 |
+
train_group.py
|
| 311 |
+
groups.json
|
| 312 |
+
|
| 313 |
+
v2/
|
| 314 |
+
groups_v2.json
|
| 315 |
+
emb_g0.npy
|
| 316 |
+
emb_g1.npy
|
| 317 |
+
emb_g2.npy
|
| 318 |
+
emb_g3.npy
|
| 319 |
+
msk_g0.npy
|
| 320 |
+
msk_g1.npy
|
| 321 |
+
msk_g2.npy
|
| 322 |
+
msk_g3.npy
|
| 323 |
+
run_v2.sh
|
| 324 |
+
stdout_g0.txt
|
| 325 |
+
stdout_g1.txt
|
| 326 |
+
stdout_g2.txt
|
| 327 |
+
stdout_g3.txt
|
| 328 |
+
done.txt
|
| 329 |
+
|
| 330 |
+
g0/
|
| 331 |
+
wm.pt
|
| 332 |
+
log.txt
|
| 333 |
+
gen10.mp4
|
| 334 |
+
|
| 335 |
+
g1/
|
| 336 |
+
wm.pt
|
| 337 |
+
log.txt
|
| 338 |
+
gen10.mp4
|
| 339 |
+
|
| 340 |
+
g2/
|
| 341 |
+
wm.pt
|
| 342 |
+
log.txt
|
| 343 |
+
gen10.mp4
|
| 344 |
+
|
| 345 |
+
g3/
|
| 346 |
+
wm.pt
|
| 347 |
+
log.txt
|
| 348 |
+
gen10.mp4
|
| 349 |
+
|
| 350 |
+
train_group2.py
|
| 351 |
```
|
| 352 |
|
| 353 |
+
The v2 preparation script generates `train_group2.py` and `run_v2.sh`.
|
| 354 |
+
|
| 355 |
+
The exact contents of the generated training script depend on the source `train_group.py` and the transformations performed by the preparation script.
|
| 356 |
+
|
| 357 |
+
## Dataset format
|
| 358 |
+
|
| 359 |
+
The training pipeline expects precomputed NumPy arrays.
|
| 360 |
|
| 361 |
| File | Expected shape | Description |
|
| 362 |
|---|---|---|
|
| 363 |
+
| `latents.npy` | `(N, 128, 13, 8, 8)` | VAE-encoded video segments |
|
| 364 |
+
| `txt_emb.npy` | `(M, L, 768)` | Original text embeddings |
|
| 365 |
| `txt_mask.npy` | `(M, L)` | Text attention masks |
|
| 366 |
+
| `txt_idx.npy` | `(N,)` | Mapping from video segments to text entries |
|
| 367 |
+
| `hand_feats.npy` | Compatible with `(-1, 4, 2, 10)` | Hand-related features |
|
| 368 |
+
| `texts.json` | List of strings | Text descriptions |
|
| 369 |
+
| `meta.json` | Segment metadata | Clip ID and segment start/end times |
|
| 370 |
|
| 371 |
+
The latent normalization statistics are stored in:
|
|
|
|
|
|
|
| 372 |
|
| 373 |
```text
|
| 374 |
~/wm_run/lat_stats.npz
|
| 375 |
```
|
| 376 |
|
| 377 |
+
The archive must contain:
|
| 378 |
|
| 379 |
```python
|
| 380 |
mean
|
| 381 |
std
|
| 382 |
```
|
| 383 |
|
| 384 |
+
The trainer normalizes latents using:
|
| 385 |
|
| 386 |
+
```python
|
| 387 |
+
normalized_latents = (latents - mean) / std
|
| 388 |
+
```
|
| 389 |
|
| 390 |
+
Before VAE decoding, the original scale is restored:
|
| 391 |
|
| 392 |
+
```python
|
| 393 |
+
decoded_latents = generated_latents * std + mean
|
| 394 |
+
```
|
| 395 |
|
| 396 |
+
The selected clip indices in the group metadata must be valid indices into `latents.npy`, `txt_idx.npy`, `meta.json`, and the corresponding hand feature data.
|
|
|
|
|
|
|
|
|
|
| 397 |
|
| 398 |
+
## Training environment
|
| 399 |
+
|
| 400 |
+
The implementation uses:
|
|
|
|
|
|
|
| 401 |
|
| 402 |
+
- Python.
|
| 403 |
+
- PyTorch.
|
| 404 |
+
- PyTorch/XLA.
|
| 405 |
+
- NumPy.
|
| 406 |
+
- PyAV.
|
| 407 |
+
- The project's `wm.py`, `vae.py`, and `text_emb.py` modules.
|
| 408 |
+
- Google Cloud TPU runtime.
|
| 409 |
|
| 410 |
+
The PyTorch and PyTorch/XLA versions must be compatible with the installed TPU runtime.
|
| 411 |
+
|
| 412 |
+
The group training script uses:
|
| 413 |
+
|
| 414 |
+
```python
|
| 415 |
+
import torch_xla.core.xla_model as xm
|
| 416 |
+
|
| 417 |
+
dev = xm.xla_device()
|
| 418 |
```
|
| 419 |
|
| 420 |
+
It uses one TPU device per process.
|
| 421 |
|
| 422 |
+
The v2 launcher starts four separate processes, assigning one visible TPU chip to each group. This is not a single GSPMD-sharded model.
|
| 423 |
|
| 424 |
+
## Training
|
| 425 |
|
| 426 |
+
### Step 1. Prepare the initial groups
|
| 427 |
|
| 428 |
+
Run the initial clustering script:
|
| 429 |
|
| 430 |
+
```bash
|
| 431 |
+
python ~/wm_groups/cluster.py
|
| 432 |
+
```
|
| 433 |
|
| 434 |
+
This creates:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 435 |
|
| 436 |
+
```text
|
| 437 |
+
~/wm_groups/groups.json
|
| 438 |
+
```
|
| 439 |
|
| 440 |
+
The v2 preparation script reads the original clustering implementation and reuses its clustering calculations.
|
| 441 |
|
| 442 |
+
### Step 2. Prepare the v2 groups
|
| 443 |
+
|
| 444 |
+
Run the v2 preparation code.
|
| 445 |
+
|
| 446 |
+
This stage:
|
| 447 |
+
|
| 448 |
+
1. Loads the original clustering implementation.
|
| 449 |
+
2. Repeats clustering with four groups and up to 38 selected clips per group.
|
| 450 |
+
3. Loads hand features and temporal action spans.
|
| 451 |
+
4. Creates richer prompts for selected clips.
|
| 452 |
+
5. Encodes prompts using `text_emb.py` with a sequence length of 64.
|
| 453 |
+
6. Saves group metadata, embeddings, and masks.
|
| 454 |
+
7. Generates `train_group2.py`.
|
| 455 |
+
8. Generates `run_v2.sh`.
|
| 456 |
+
|
| 457 |
+
The preparation script should finish by printing:
|
| 458 |
+
|
| 459 |
+
```text
|
| 460 |
+
BUILD_OK
|
| 461 |
```
|
| 462 |
|
| 463 |
+
After this step, verify that the generated files exist:
|
| 464 |
|
| 465 |
+
```bash
|
| 466 |
+
ls -lh ~/wm_groups/v2/groups_v2.json
|
| 467 |
+
ls -lh ~/wm_groups/v2/emb_g*.npy
|
| 468 |
+
ls -lh ~/wm_groups/v2/msk_g*.npy
|
| 469 |
+
ls -lh ~/wm_groups/train_group2.py
|
| 470 |
+
ls -lh ~/wm_groups/v2/run_v2.sh
|
| 471 |
+
```
|
| 472 |
|
| 473 |
+
### Step 3. Start all four TPU training processes
|
| 474 |
|
| 475 |
+
Run:
|
| 476 |
|
| 477 |
+
```bash
|
| 478 |
+
bash ~/wm_groups/v2/run_v2.sh
|
| 479 |
+
```
|
| 480 |
|
| 481 |
+
The generated launcher executes:
|
| 482 |
|
| 483 |
+
```bash
|
| 484 |
+
for g in 0 1 2 3; do
|
| 485 |
+
TPU_CHIPS_PER_PROCESS_BOUNDS=1,1,1 \
|
| 486 |
+
TPU_PROCESS_BOUNDS=1,1,1 \
|
| 487 |
+
TPU_VISIBLE_CHIPS=$g \
|
| 488 |
+
TPU_PROCESS_PORT=$((8476+g)) \
|
| 489 |
+
CLOUD_TPU_TASK_ID=0 \
|
| 490 |
+
PJRT_DEVICE=TPU \
|
| 491 |
+
GROUP=$g \
|
| 492 |
+
MAX_MIN=12 \
|
| 493 |
+
RESUME=1 \
|
| 494 |
+
nohup ~/xla_env/bin/python \
|
| 495 |
+
~/wm_groups/train_group2.py \
|
| 496 |
+
> ~/wm_groups/v2/stdout_g$g.txt 2>&1 &
|
| 497 |
+
done
|
| 498 |
+
|
| 499 |
+
wait
|
| 500 |
+
echo DONE > ~/wm_groups/v2/done.txt
|
| 501 |
+
```
|
| 502 |
+
|
| 503 |
+
Each process receives its own `GROUP` value:
|
| 504 |
+
|
| 505 |
+
| Process | Group | TPU chip |
|
| 506 |
+
|---|---:|---:|
|
| 507 |
+
| Process 0 | 0 | 0 |
|
| 508 |
+
| Process 1 | 1 | 1 |
|
| 509 |
+
| Process 2 | 2 | 2 |
|
| 510 |
+
| Process 3 | 3 | 3 |
|
| 511 |
+
|
| 512 |
+
All four groups train concurrently.
|
| 513 |
+
|
| 514 |
+
The launcher uses the `~/xla_env/bin/python` environment.
|
| 515 |
+
|
| 516 |
+
### Important: checkpoint initialization
|
| 517 |
|
| 518 |
+
The launcher sets:
|
| 519 |
|
| 520 |
```bash
|
| 521 |
+
RESUME=1
|
| 522 |
```
|
| 523 |
|
| 524 |
+
This means the training script must find the checkpoint specified in its `RESUME` branch.
|
| 525 |
+
|
| 526 |
+
There are two checkpoint-path variants in the current scripts:
|
| 527 |
+
|
| 528 |
+
- The original group trainer loads `OUT/wm.pt`.
|
| 529 |
+
- The v2 preparation code rewrites the generated trainer to initialize from `~/wm_groups/g{G}/wm.pt`.
|
| 530 |
+
- Another trainer variant may use `~/wm_groups/v2/g{G}/wm_prev.pt`.
|
| 531 |
+
|
| 532 |
+
These are different paths and must not be treated as interchangeable.
|
| 533 |
+
|
| 534 |
+
Before launching, inspect the actual generated trainer:
|
| 535 |
+
|
| 536 |
+
```bash
|
| 537 |
+
grep -n -E 'RESUME|torch.load|OUT =' ~/wm_groups/train_group2.py
|
| 538 |
+
```
|
| 539 |
+
|
| 540 |
+
Make sure the checkpoint path in the `RESUME` branch exists for all four groups.
|
| 541 |
+
|
| 542 |
+
The intended v2 initialization in the preparation script uses the previous group checkpoints under:
|
| 543 |
+
|
| 544 |
+
```text
|
| 545 |
+
~/wm_groups/g0/wm.pt
|
| 546 |
+
~/wm_groups/g1/wm.pt
|
| 547 |
+
~/wm_groups/g2/wm.pt
|
| 548 |
+
~/wm_groups/g3/wm.pt
|
| 549 |
+
```
|
| 550 |
|
| 551 |
+
If training should start from randomly initialized weights, remove `RESUME=1` from the generated launcher or unset the resume branch in the training script.
|
| 552 |
|
| 553 |
+
## Training configuration
|
| 554 |
|
| 555 |
+
Each group uses the following defaults:
|
| 556 |
|
| 557 |
| Parameter | Value |
|
| 558 |
|---|---:|
|
| 559 |
+
| Model | WorldDiT |
|
| 560 |
+
| Hidden size | 512 |
|
| 561 |
+
| Depth | 10 |
|
| 562 |
+
| Attention heads | 8 |
|
| 563 |
+
| Batch size | 20 |
|
| 564 |
+
| Learning rate | 4e-4 |
|
| 565 |
| Optimizer | AdamW |
|
| 566 |
+
| Betas | (0.9, 0.95) |
|
| 567 |
+
| Weight decay | 0 |
|
| 568 |
+
| Gradient clipping | 1.0 |
|
| 569 |
+
| LR warmup | 150 steps |
|
| 570 |
+
| EMA decay | 0.99 |
|
| 571 |
+
| Default maximum runtime | 8 minutes |
|
| 572 |
+
| Runtime in v2 launcher | 12 minutes |
|
| 573 |
+
| Default early-stop target | 0.05 |
|
| 574 |
+
| Loss logging interval | 50 steps |
|
| 575 |
+
|
| 576 |
+
The learning-rate scheduler uses linear warmup:
|
| 577 |
|
| 578 |
+
\[
|
| 579 |
+
lr_s=lr_{\mathrm{base}}\cdot
|
| 580 |
+
\min\left(1,\frac{s+1}{150}\right)
|
| 581 |
+
\]
|
| 582 |
+
|
| 583 |
+
The training loop stops when the runtime limit is reached or when the configured early-stop condition is met.
|
| 584 |
+
|
| 585 |
+
The early-stop condition is checked after at least 600 steps:
|
| 586 |
+
|
| 587 |
+
\[
|
| 588 |
+
\text{average recent loss}<\text{TARGET}
|
| 589 |
+
\]
|
| 590 |
+
|
| 591 |
+
The trainer calculates the average using the most recent six logged loss measurements.
|
| 592 |
+
|
| 593 |
+
The runtime and learning-rate settings can be changed using environment variables:
|
| 594 |
|
| 595 |
```bash
|
| 596 |
+
MAX_MIN=12
|
| 597 |
+
LR=4e-4
|
| 598 |
+
TARGET=0.05
|
| 599 |
```
|
| 600 |
|
| 601 |
+
## Checkpoints
|
| 602 |
|
| 603 |
+
Each group writes its checkpoint to:
|
| 604 |
|
| 605 |
```text
|
| 606 |
+
~/wm_groups/v2/g0/wm.pt
|
| 607 |
+
~/wm_groups/v2/g1/wm.pt
|
| 608 |
+
~/wm_groups/v2/g2/wm.pt
|
| 609 |
+
~/wm_groups/v2/g3/wm.pt
|
| 610 |
```
|
| 611 |
|
| 612 |
+
The checkpoint contains:
|
| 613 |
|
| 614 |
+
- `ema`: EMA model state dictionary.
|
| 615 |
+
- `clips`: Selected clip indices.
|
| 616 |
+
- `step`: Final training step.
|
| 617 |
+
- `cfg`: Model configuration.
|
| 618 |
|
| 619 |
+
The model configuration is:
|
| 620 |
|
| 621 |
+
```python
|
| 622 |
+
{
|
| 623 |
+
"d": 512,
|
| 624 |
+
"depth": 10,
|
| 625 |
+
"heads": 8
|
| 626 |
+
}
|
| 627 |
```
|
| 628 |
|
| 629 |
+
The checkpoint stores EMA weights rather than the complete optimizer and scheduler state.
|
| 630 |
+
|
| 631 |
+
AdamW optimizer state is not saved, and resuming does not restore the original optimizer or learning-rate scheduler state.
|
| 632 |
+
|
| 633 |
+
## Video generation and validation
|
| 634 |
|
| 635 |
+
After the training loop, each group runs a generation test using its EMA model.
|
|
|
|
|
|
|
|
|
|
| 636 |
|
| 637 |
+
The generation process:
|
| 638 |
|
| 639 |
+
1. Creates a Gaussian noise latent sequence.
|
| 640 |
+
2. Uses the corresponding text embeddings and masks.
|
| 641 |
+
3. Runs 40 flow-matching sampling steps.
|
| 642 |
+
4. Compares generated latents with the selected original latents.
|
| 643 |
+
5. Decodes generated latents through the pretrained VAE.
|
| 644 |
+
6. Saves a video montage.
|
| 645 |
|
| 646 |
+
The sampling update is:
|
| 647 |
+
|
| 648 |
+
\[
|
| 649 |
+
x \leftarrow x-\frac{\hat v_\theta(x,t,c)}{40}
|
| 650 |
+
\]
|
| 651 |
+
|
| 652 |
+
The initial noise uses a fixed seed of 0.
|
| 653 |
+
|
| 654 |
+
The trainer logs a latent-space MSE for each selected prompt.
|
| 655 |
+
|
| 656 |
+
The VAE checkpoint is loaded from:
|
| 657 |
|
| 658 |
```text
|
| 659 |
+
~/vae_run/last.pt
|
|
|
|
| 660 |
```
|
| 661 |
|
| 662 |
+
The checkpoint must contain the VAE state dictionary under the `model` key.
|
| 663 |
+
|
| 664 |
+
The decoder is obtained through:
|
| 665 |
+
|
| 666 |
+
```python
|
| 667 |
+
vae = VAE()
|
| 668 |
+
vae.load_state_dict(
|
| 669 |
+
torch.load(
|
| 670 |
+
"~/vae_run/last.pt",
|
| 671 |
+
map_location="cpu"
|
| 672 |
+
)["model"]
|
| 673 |
+
)
|
| 674 |
|
| 675 |
+
decoder = vae.dec
|
| 676 |
+
```
|
| 677 |
+
|
| 678 |
+
The final video montage is written to:
|
| 679 |
|
| 680 |
```text
|
| 681 |
+
~/wm_groups/v2/g0/gen10.mp4
|
| 682 |
+
~/wm_groups/v2/g1/gen10.mp4
|
| 683 |
+
~/wm_groups/v2/g2/gen10.mp4
|
| 684 |
+
~/wm_groups/v2/g3/gen10.mp4
|
| 685 |
```
|
| 686 |
|
| 687 |
+
Each montage contains 10 generated video sequences arranged in a 5-column, 2-row grid.
|
| 688 |
|
| 689 |
+
The montage resolution is 1280 × 512, encoded using H.264 at 24 FPS.
|
| 690 |
|
| 691 |
+
These are group-level preview montages, not individual MP4 files for every prompt.
|
| 692 |
|
| 693 |
+
## Monitoring
|
| 694 |
|
| 695 |
+
Each group has its own training log:
|
| 696 |
|
| 697 |
+
```text
|
| 698 |
+
~/wm_groups/v2/g0/log.txt
|
| 699 |
+
~/wm_groups/v2/g1/log.txt
|
| 700 |
+
~/wm_groups/v2/g2/log.txt
|
| 701 |
+
~/wm_groups/v2/g3/log.txt
|
| 702 |
+
```
|
| 703 |
|
| 704 |
+
Standard output and errors from the four processes are stored in:
|
| 705 |
|
| 706 |
+
```text
|
| 707 |
+
~/wm_groups/v2/stdout_g0.txt
|
| 708 |
+
~/wm_groups/v2/stdout_g1.txt
|
| 709 |
+
~/wm_groups/v2/stdout_g2.txt
|
| 710 |
+
~/wm_groups/v2/stdout_g3.txt
|
| 711 |
+
```
|
| 712 |
|
| 713 |
+
The launcher creates:
|
| 714 |
|
| 715 |
+
```text
|
| 716 |
+
~/wm_groups/v2/done.txt
|
| 717 |
+
```
|
| 718 |
|
| 719 |
+
when all four processes finish.
|
| 720 |
|
| 721 |
+
To inspect the output:
|
|
|
|
| 722 |
|
| 723 |
+
```bash
|
| 724 |
+
tail -f ~/wm_groups/v2/stdout_g0.txt
|
| 725 |
```
|
| 726 |
|
| 727 |
+
To inspect the training log:
|
| 728 |
|
| 729 |
+
```bash
|
| 730 |
+
tail -f ~/wm_groups/v2/g0/log.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
| 731 |
```
|
| 732 |
|
| 733 |
+
To check all groups:
|
| 734 |
|
| 735 |
+
```bash
|
| 736 |
+
for g in 0 1 2 3; do
|
| 737 |
+
echo "===== GROUP $g ====="
|
| 738 |
+
tail -n 10 ~/wm_groups/v2/g$g/log.txt
|
| 739 |
+
done
|
| 740 |
+
```
|
| 741 |
+
|
| 742 |
+
## Inference status
|
| 743 |
+
|
| 744 |
+
The current implementation includes a generation and validation stage at the end of each training run.
|
| 745 |
+
|
| 746 |
+
It does not currently provide a separate standalone inference script for loading a Hugging Face checkpoint and generating an arbitrary video from a new prompt.
|
| 747 |
+
|
| 748 |
+
The generated videos are produced using the prompts and embeddings prepared for the corresponding group.
|
| 749 |
+
|
| 750 |
+
A separate inference pipeline would need to load the selected group's EMA checkpoint, recreate the text embeddings, initialize latent noise, run flow-matching sampling, and decode the result with the compatible VAE.
|
| 751 |
+
|
| 752 |
+
## Current scope and limitations
|
| 753 |
|
| 754 |
+
WorldDiT is a text-conditioned latent video generation system trained using clustered egocentric video segments.
|
| 755 |
+
|
| 756 |
+
The v2 preparation stage uses hand-related features and temporal action context to build richer text prompts.
|
| 757 |
+
|
| 758 |
+
However, the current implementation does not provide:
|
| 759 |
+
|
| 760 |
+
- Explicit robot action conditioning.
|
| 761 |
+
- Direct robot control.
|
| 762 |
+
- A physics-based simulator.
|
| 763 |
+
- An interactive environment that reacts to agent actions.
|
| 764 |
+
- A standalone arbitrary-prompt inference interface.
|
| 765 |
+
- A standardized benchmark evaluation.
|
| 766 |
+
|
| 767 |
+
The models are trained independently for their respective data groups.
|
| 768 |
+
|
| 769 |
+
## Project summary
|
| 770 |
+
|
| 771 |
+
| Property | Description |
|
| 772 |
+
|---|---|
|
| 773 |
+
| Project | LiberalMind |
|
| 774 |
+
| Model family | WorldDiT |
|
| 775 |
+
| Training approach | Four independent group-specific models |
|
| 776 |
+
| Model size | Approximately 50M parameters per group |
|
| 777 |
+
| Number of groups | 4 |
|
| 778 |
+
| Selected clips | Up to 38 per group in v2 |
|
| 779 |
+
| Training hardware | Google Cloud TPU |
|
| 780 |
+
| TPU allocation | One TPU chip per group process |
|
| 781 |
+
| Framework | PyTorch / PyTorch-XLA |
|
| 782 |
+
| Video representation | VAE latent space |
|
| 783 |
+
| Latent shape | 128 × 13 × 8 × 8 |
|
| 784 |
+
| Text conditioning | 768-dimensional embeddings |
|
| 785 |
+
| Training objective | Flow matching |
|
| 786 |
+
| Optimization | AdamW with EMA |
|
| 787 |
+
| Video decoding | Separate pretrained VAE |
|
| 788 |
+
|
| 789 |
+
**WorldDiT is a research implementation of clustered, text-conditioned latent video world models.**
|