Expand model card
Browse files
README.md
CHANGED
|
@@ -3,52 +3,109 @@ license: apache-2.0
|
|
| 3 |
library_name: diffsynth
|
| 4 |
pipeline_tag: image-to-video
|
| 5 |
base_model: Wan-AI/Wan2.2-TI2V-5B
|
|
|
|
|
|
|
| 6 |
tags:
|
| 7 |
- world-model
|
| 8 |
- game
|
| 9 |
- video-generation
|
| 10 |
- semantic-map
|
|
|
|
| 11 |
---
|
| 12 |
|
| 13 |
-
# MaLiang:
|
| 14 |
|
| 15 |
-
|
| 16 |
|
| 17 |
-
|
| 18 |
-
- Code: https://github.com/YeyingLab/MaLiang
|
| 19 |
-
- Training data: https://huggingface.co/datasets/15y6u87/MaLiang-Data
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
##
|
| 28 |
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
-
|
| 32 |
-
| --- | --- |
|
| 33 |
-
| `sft_fxcond_v1_step-10667.safetensors` | Bidirectional teacher (10,667 SFT steps) |
|
| 34 |
-
| `fxcond_v1_stage3_ema_step500.safetensors` | Deployed causal student, 4 steps (stage-3 DMD EMA 500) |
|
| 35 |
-
| `abl_color_vae_step-5000.safetensors` | Ablation ①: coloured video → Wan VAE |
|
| 36 |
-
| `abl_color_light_step-5000.safetensors` | Ablation ②: coloured video → light encoder |
|
| 37 |
-
| `abl_v3_ids_step-5000.safetensors` | Ablation ③/④: integer map (step-5000 snapshot of the teacher run) |
|
| 38 |
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
|
| 43 |
```bash
|
| 44 |
pip install -U huggingface_hub
|
| 45 |
hf download 15y6u87/MaLiang --local-dir models
|
| 46 |
-
cd models && sha256sum -c models.sha256
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
```
|
| 48 |
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
##
|
| 53 |
|
| 54 |
-
|
|
|
|
| 3 |
library_name: diffsynth
|
| 4 |
pipeline_tag: image-to-video
|
| 5 |
base_model: Wan-AI/Wan2.2-TI2V-5B
|
| 6 |
+
datasets:
|
| 7 |
+
- 15y6u87/MaLiang-Data
|
| 8 |
tags:
|
| 9 |
- world-model
|
| 10 |
- game
|
| 11 |
- video-generation
|
| 12 |
- semantic-map
|
| 13 |
+
- real-time
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# MaLiang: weights and data
|
| 17 |
|
| 18 |
+
**MaLiang: Painting Playable Game Worlds from Numbers**
|
| 19 |
|
| 20 |
+
[Project page](https://yeyinglab.github.io/MaLiang/) · [Code](https://github.com/YeyingLab/MaLiang) · [Training data](https://huggingface.co/datasets/15y6u87/MaLiang-Data)
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
A game hands a video model one integer per pixel, and the model paints the world, live. MaLiang renders a game
|
| 23 |
+
world directly from the game state: the state is rasterised into a per-pixel `uint8` **integer class map**
|
| 24 |
+
(terrain, buildings, vegetation, the player's and the boss's body parts, attack effects) and added to a
|
| 25 |
+
Wan2.2-TI2V-5B video diffusion transformer through a 9.4M-parameter class-pooling encoder. There is no rendered
|
| 26 |
+
proxy video and no visual encoder of the state, so game rules edit the map and the model paints the result.
|
| 27 |
+
A three-stage distillation (teacher forcing → consistency distillation → DMD) turns the bidirectional teacher
|
| 28 |
+
into a causal four-step student that streams at 22 frames per second on one GPU.
|
| 29 |
|
| 30 |
+
## What is here
|
| 31 |
|
| 32 |
+
| Repository | Content | Size |
|
| 33 |
+
|---|---|---:|
|
| 34 |
+
| [`15y6u87/MaLiang`](https://huggingface.co/15y6u87/MaLiang) (this repo) | the five checkpoints of the paper and `models.sha256` | 5 × 10 GB |
|
| 35 |
+
| [`15y6u87/MaLiang-Data`](https://huggingface.co/datasets/15y6u87/MaLiang-Data) | the raw game recordings the model is trained on: RGB, integer class map, whitebox, condition image, actions and per-frame metadata; 256 runs, 1,228,800 frames, 21.3 h | 482 GB |
|
| 36 |
+
| [`YeyingLab/MaLiang`](https://github.com/YeyingLab/MaLiang) | training, distillation, inference and evaluation code | |
|
| 37 |
|
| 38 |
+
## Checkpoints
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
+
All checkpoints are bf16 safetensors, `vocab=parts_fx`, 832×480.
|
| 41 |
|
| 42 |
+
| File | Role | Used by |
|
| 43 |
+
|---|---|---|
|
| 44 |
+
| `fxcond_v1_stage3_ema_step500.safetensors` | **Deployed causal student**, 4 steps (stage-3 DMD, EMA, step 500); the real-time model of the paper | `gcdistill/eval_rollout.py`, `sample_user.py` |
|
| 45 |
+
| `sft_fxcond_v1_step-10667.safetensors` | Bidirectional teacher, 10,667 SFT steps; the starting point and the DMD teacher of the distillation | `sample.py`, distillation stages 1 and 3 |
|
| 46 |
+
| `abl_color_vae_step-5000.safetensors` | Interface ablation ①: colour-coded video encoded by the Wan VAE | `experiments/abl/` |
|
| 47 |
+
| `abl_color_light_step-5000.safetensors` | Interface ablation ②: colour-coded video through a light encoder of the same cost as ours | `experiments/abl/` |
|
| 48 |
+
| `abl_v3_ids_step-5000.safetensors` | Interface ablation ③/④: integer map, step-5000 snapshot of the teacher run (same budget as ① and ②) | `experiments/abl/` |
|
| 49 |
+
|
| 50 |
+
### Integer map vocabulary (`parts_fx`)
|
| 51 |
+
|
| 52 |
+
Seven static scene classes (sky/background, terrain, paving, architecture, rock, vegetation, prop), the body
|
| 53 |
+
parts of the player and of the boss, four boss attack-effect classes (light and heavy attacks of two bosses), and
|
| 54 |
+
`255` for unknown. The exact table is in the code (`code/gc25d/model.py`).
|
| 55 |
+
|
| 56 |
+
## Quick start
|
| 57 |
|
| 58 |
```bash
|
| 59 |
pip install -U huggingface_hub
|
| 60 |
hf download 15y6u87/MaLiang --local-dir models
|
| 61 |
+
cd models && sha256sum -c models.sha256 && cd ..
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
Install the code as described in the [GitHub README](https://github.com/YeyingLab/MaLiang#installation), download
|
| 65 |
+
`Wan-AI/Wan2.2-TI2V-5B` into `models/Wan2.2-TI2V-5B`, then render your own first frame and integer maps with the
|
| 66 |
+
real-time student:
|
| 67 |
+
|
| 68 |
+
```bash
|
| 69 |
+
python code/gc25d/sample_user.py \
|
| 70 |
+
--ckpt models/fxcond_v1_stage3_ema_step500.safetensors \
|
| 71 |
+
--first_frame first.png --ids ids.npz --prompts prompts.json \
|
| 72 |
+
--out outputs/user_demo --name demo --steps 50
|
| 73 |
+
```
|
| 74 |
+
|
| 75 |
+
`ids.npz` holds a `uint8` array of shape `[81, 480, 832]` in the `parts_fx` vocabulary; `--export_clip <clip_id>`
|
| 76 |
+
exports a prepared clip's first frame, maps and prompts as a template. A long streaming rollout on held-out clips:
|
| 77 |
+
|
| 78 |
+
```bash
|
| 79 |
+
python code/gc25d/gcdistill/eval_rollout.py \
|
| 80 |
+
--ckpt models/fxcond_v1_stage3_ema_step500.safetensors \
|
| 81 |
+
--data_root data/gc25d_v10_fxcond --text_table assets/text_table_gc25d.pt \
|
| 82 |
+
--n_clips 10 --chain_cells 241 --vae tae --out outputs/deploy_eval
|
| 83 |
```
|
| 84 |
|
| 85 |
+
## Reproducing the model
|
| 86 |
+
|
| 87 |
+
1. **Data**: download [`15y6u87/MaLiang-Data`](https://huggingface.co/datasets/15y6u87/MaLiang-Data) to
|
| 88 |
+
`data/recordings`, then build the training cache with `code/gc25d/prep_v10.py` (VAE latents, integer maps and
|
| 89 |
+
metadata per 81-frame clip; see the code README → *Data*).
|
| 90 |
+
2. **Base model**: `Wan-AI/Wan2.2-TI2V-5B`.
|
| 91 |
+
3. **Teacher**: `scripts/train_sft.sh`, 10,667 steps, global batch 16, `lr=1e-5`, `cond_lr=1e-4`
|
| 92 |
+
→ `sft_fxcond_v1_step-10667`.
|
| 93 |
+
4. **Distillation**: `gcdistill/run_stage{1,2,3}.sh`: teacher forcing 8,000 steps → consistency distillation
|
| 94 |
+
8,000 steps → DMD 500 steps → `fxcond_v1_stage3_ema_step500`.
|
| 95 |
+
5. **Evaluation**: the 100-clip test manifest and the metric scripts are in `experiments/`.
|
| 96 |
+
|
| 97 |
+
## Hardware
|
| 98 |
+
|
| 99 |
+
The teacher is trained with DeepSpeed ZeRO-2 on 8 GPUs; distillation stage 3 uses FSDP. Inference runs on one
|
| 100 |
+
GPU with room for the 5B DiT in bf16. With the TAEHV decoder and a 17-cell KV window the four-step student streams
|
| 101 |
+
in real time on one GPU.
|
| 102 |
+
|
| 103 |
+
## Licence
|
| 104 |
+
|
| 105 |
+
Apache-2.0, the same as the code. The base model Wan2.2-TI2V-5B and the third-party components used by the code
|
| 106 |
+
keep their own licences. The training data has its own card and attribution in
|
| 107 |
+
[`15y6u87/MaLiang-Data`](https://huggingface.co/datasets/15y6u87/MaLiang-Data).
|
| 108 |
|
| 109 |
+
## Citation
|
| 110 |
|
| 111 |
+
A BibTeX entry will be added once the paper is public.
|