kerzgrr commited on
Commit
60b665d
·
verified ·
1 Parent(s): d7461a0

Diffusion Pong EMA step 650 + live play card

Browse files
Files changed (4) hide show
  1. README.md +57 -3
  2. config.json +108 -0
  3. ema.safetensors +3 -0
  4. preview.png +0 -0
README.md CHANGED
@@ -1,3 +1,57 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ library_name: pytorch
4
+ pipeline_tag: other
5
+ tags:
6
+ - world-model
7
+ - diffusion
8
+ - pong
9
+ - video
10
+ - causal
11
+ - game
12
+ ---
13
+
14
+ # Diffusion Pong
15
+
16
+ A small action-conditioned world model that learned to keep a Pong match going. You hold **W** / **S**, it invents the next frame. That's the whole demo.
17
+
18
+ ![demo](demo.gif)
19
+
20
+ Weights are the EMA from training step **650** (~59M DiT params). Resolution is 128×128 at 6 FPS with a 12-frame latent history. Codec is a frozen SDXL VAE (`madebyollin/sdxl-vae-fp16-fix`). Sampling is 1-step instantaneous velocity — don't crank the step count expecting magic; this checkpoint is still in the teacher stage.
21
+
22
+ ## Play it
23
+
24
+ From the livediffusion source tree (after `pip install -e .`):
25
+
26
+ ```bash
27
+ python scripts/live_infer.py
28
+ ```
29
+
30
+ First run pulls this repo into the HF cache. Needs a CUDA GPU with BF16.
31
+
32
+ ```bash
33
+ # optional knobs
34
+ python scripts/live_infer.py --steps 1 --window-scale 7 --seed 42
35
+ ```
36
+
37
+ Controls: **W** up, **S** down. Click the window once so it has focus. Clicking the canvas drops a yellow ball into the latent history for a few frames if you want to poke it.
38
+
39
+ ## What's in the files
40
+
41
+ | file | what |
42
+ |---|---|
43
+ | `ema.safetensors` | playable weights |
44
+ | `config.json` | video / model / codec settings used at train time |
45
+ | `demo.gif` | live rollout clip |
46
+
47
+ Action vector is `[W, S]` as floats in `{0,1}`. Hold both and it treats that as neutral.
48
+
49
+ ## Notes / honesty
50
+
51
+ - The right paddle is baked into the learned dynamics (training used a noisy scripted opponent). You're only steering the left one.
52
+ - Autoregressive rollouts drift. Short play sessions look good; leave it running forever and the court starts inventing its own physics fanfic.
53
+ - Not a RL agent. No reward head in use. Just next-frame generation conditioned on your button state.
54
+
55
+ Trained with the Livediffusion prefix-transformer stack (schema v3): clean history prefix, noisy suffix, 3D RoPE, multiscale context tokens.
56
+
57
+ If something breaks, it's probably the VAE download or a GPU that can't do BF16.
config.json ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "codec": {
3
+ "enable_slicing": true,
4
+ "enable_tiling": false,
5
+ "frame_batch_size": 256,
6
+ "kind": "frame_vae",
7
+ "latent_channels": 4,
8
+ "model_id": "madebyollin/sdxl-vae-fp16-fix",
9
+ "revision": "main",
10
+ "sample_posterior": false,
11
+ "spatial_compression": 8,
12
+ "subfolder": "",
13
+ "temporal_compression": 1
14
+ },
15
+ "data": {
16
+ "batch_size": 128,
17
+ "data_path": "",
18
+ "dataset_kind": "pong",
19
+ "frame_stride": 1,
20
+ "hf_repo_id": "",
21
+ "hf_revision": "main",
22
+ "latent_cache_path": "",
23
+ "latent_prefetch_batches": 8,
24
+ "network_clip_prefetch": 2,
25
+ "num_workers": 8,
26
+ "persistent_workers": true,
27
+ "pin_memory": true,
28
+ "prefetch_batches": 2,
29
+ "sample_shuffle": 64,
30
+ "shard_shuffle": 256,
31
+ "train_samples": 50000,
32
+ "validation_samples": 1024,
33
+ "windows_per_video": 4
34
+ },
35
+ "inference": {
36
+ "frames": 120,
37
+ "steps": 1
38
+ },
39
+ "model": {
40
+ "action_dim": 2,
41
+ "context_dim": 0,
42
+ "depth": 12,
43
+ "fine_history_frames": 2,
44
+ "fine_memory_patch_size": 2,
45
+ "generation_frames": 1,
46
+ "hidden_size": 384,
47
+ "memory_depth": 3,
48
+ "memory_patch_size": 4,
49
+ "mlp_ratio": 4.0,
50
+ "num_heads": 8,
51
+ "qk_norm": true,
52
+ "target_patch_size": 2
53
+ },
54
+ "schema_version": 3,
55
+ "simulation": {
56
+ "max_shapes": 2,
57
+ "max_size": 6.0,
58
+ "max_speed": 20.0,
59
+ "min_shapes": 1,
60
+ "min_size": 3.0,
61
+ "min_speed": 8.0,
62
+ "supersample": 2,
63
+ "warmup_frames": 8
64
+ },
65
+ "training": {
66
+ "activation_checkpointing": true,
67
+ "critic_learning_rate": 0.0001,
68
+ "distribution_matching_start_step": 30000,
69
+ "distribution_matching_weight": 0.05,
70
+ "ema_decay": 0.9999,
71
+ "epochs": 100,
72
+ "flow_matching_ratio": 0.25,
73
+ "full_interval_ratio": 0.25,
74
+ "gradient_accumulation_steps": 1,
75
+ "history_noise_std": 0.01,
76
+ "keep_checkpoints": 5,
77
+ "learning_rate": 0.0003,
78
+ "log_every": 20,
79
+ "max_grad_norm": 1.0,
80
+ "min_learning_rate": 1e-05,
81
+ "on_policy_max_horizon": 4,
82
+ "on_policy_ratio": 0.15,
83
+ "on_policy_sampling_steps": 4,
84
+ "on_policy_start_step": 15000,
85
+ "output_dir": "runs/pong-action-world-model",
86
+ "reward_loss_weight": 0.0,
87
+ "save_every": 50,
88
+ "seed": 2026,
89
+ "teacher_endpoint_ratio": 0.1,
90
+ "teacher_integration_steps": 8,
91
+ "teacher_logit_mean": 1.0,
92
+ "teacher_logit_std": 1.0,
93
+ "teacher_steps": 10000,
94
+ "teacher_x0_weight": 0.25,
95
+ "terminal_loss_weight": 0.0,
96
+ "validate_every": 50,
97
+ "validation_batches": 1,
98
+ "warmup_steps": 500,
99
+ "weight_decay": 0.0
100
+ },
101
+ "video": {
102
+ "fps": 6.0,
103
+ "future_frames": 5,
104
+ "height": 128,
105
+ "history_frames": 12,
106
+ "width": 128
107
+ }
108
+ }
ema.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1f9210f3f6a2f9cebde3c1a89fae69665a51d81cc53b922e3c9fec1625446007
3
+ size 235185584
preview.png ADDED