Image-to-Video
Diffusion Single File
world-model
video-generation
game-ai
street-fighter
state-aware
Instructions to use YeyingLab/StatePlay with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Diffusion Single File
How to use YeyingLab/StatePlay with Diffusion Single File:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Streamline model card and update release links
Browse files
README.md
CHANGED
|
@@ -13,53 +13,35 @@ tags:
|
|
| 13 |
- state-aware
|
| 14 |
---
|
| 15 |
|
| 16 |
-
# StatePlay
|
| 17 |
|
| 18 |
[**Project Page**](https://jimntu.github.io/stateplay_page/) ·
|
| 19 |
[**Paper**](https://arxiv.org/abs/2607.26754) ·
|
| 20 |
[**Code**](https://github.com/Jimntu/StatePlay) ·
|
| 21 |
-
[**Dataset**](https://huggingface.co/datasets/onepiece1999/StatePlay-Dataset)
|
|
|
|
| 22 |
|
| 23 |
-
StatePlay is a state-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
## Checkpoint
|
| 28 |
-
|
| 29 |
-
`StatePlay.safetensors` is the complete StatePlay DiT state dictionary trained for 40,000 steps.
|
| 30 |
-
|
| 31 |
-
| Item | Value |
|
| 32 |
-
|---|---|
|
| 33 |
-
| Base architecture | Wan2.2 TI2V 5B with a StatePlay state branch |
|
| 34 |
-
| Game | Street Fighter III |
|
| 35 |
-
| Default output | 480 × 832, 101 frames at 20 FPS |
|
| 36 |
-
| Predicted states | timer, player/opponent HP, player/opponent skill meter |
|
| 37 |
-
| Checkpoint size | approximately 11.5 GB |
|
| 38 |
-
| SHA256 | `aba9747fcd3f0c0a3546941253cd99ecd5dbc2c69747d647b91de84ee41f722f` |
|
| 39 |
-
|
| 40 |
-
The checkpoint contains the complete DiT weights. The three Wan2.2 diffusion shards are not required for inference, but the Wan2.2 VAE and T5 encoder and the Wan2.1 UMT5 tokenizer are required.
|
| 41 |
|
| 42 |
## Installation
|
| 43 |
|
|
|
|
|
|
|
| 44 |
```bash
|
| 45 |
git clone https://github.com/Jimntu/StatePlay.git
|
| 46 |
cd StatePlay
|
| 47 |
-
|
| 48 |
python -m venv .venv
|
| 49 |
source .venv/bin/activate
|
| 50 |
pip install -U pip
|
| 51 |
pip install -e .
|
| 52 |
```
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
## Download
|
| 57 |
-
|
| 58 |
-
Run the following commands from the StatePlay code repository:
|
| 59 |
|
| 60 |
```bash
|
| 61 |
-
python -m pip install -U huggingface_hub
|
| 62 |
-
|
| 63 |
hf download onepiece1999/StatePlay \
|
| 64 |
StatePlay.safetensors \
|
| 65 |
--local-dir examples/checkpoint
|
|
@@ -74,7 +56,7 @@ hf download Wan-AI/Wan2.1-T2V-1.3B \
|
|
| 74 |
--local-dir base_model/Wan-AI/Wan2.1-T2V-1.3B
|
| 75 |
```
|
| 76 |
|
| 77 |
-
|
| 78 |
|
| 79 |
```text
|
| 80 |
StatePlay/
|
|
@@ -87,12 +69,67 @@ StatePlay/
|
|
| 87 |
└── ... tokenizer files ...
|
| 88 |
```
|
| 89 |
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
| 94 |
```bash
|
| 95 |
-
export STATEPLAY_BASE_MODEL=/path/to/StatePlay/base_model
|
| 96 |
export CUDA_VISIBLE_DEVICES=0
|
| 97 |
|
| 98 |
./scripts/inference.sh \
|
|
@@ -102,21 +139,60 @@ export CUDA_VISIBLE_DEVICES=0
|
|
| 102 |
--output output.mp4
|
| 103 |
```
|
| 104 |
|
| 105 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
| 107 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 108 |
|
| 109 |
-
|
|
|
|
| 110 |
|
| 111 |
-
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
-
|
| 114 |
|
| 115 |
-
```
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
|
|
|
| 122 |
```
|
|
|
|
| 13 |
- state-aware
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# StatePlay
|
| 17 |
|
| 18 |
[**Project Page**](https://jimntu.github.io/stateplay_page/) ·
|
| 19 |
[**Paper**](https://arxiv.org/abs/2607.26754) ·
|
| 20 |
[**Code**](https://github.com/Jimntu/StatePlay) ·
|
| 21 |
+
[**Dataset**](https://huggingface.co/datasets/onepiece1999/StatePlay-Dataset) ·
|
| 22 |
+
[**Model**](https://huggingface.co/onepiece1999/StatePlay)
|
| 23 |
|
| 24 |
+
StatePlay is a state- and action-conditioned world model for mechanics-consistent
|
| 25 |
+
generation in *Street Fighter III*. It jointly predicts video frames and five
|
| 26 |
+
game states: timer, both players' health, and both players' skill meters. The
|
| 27 |
+
released checkpoint was trained for **40,000 optimization steps**.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
## Installation
|
| 30 |
|
| 31 |
+
Requirements: Python 3.10+, CUDA, and a GPU with bfloat16 support.
|
| 32 |
+
|
| 33 |
```bash
|
| 34 |
git clone https://github.com/Jimntu/StatePlay.git
|
| 35 |
cd StatePlay
|
|
|
|
| 36 |
python -m venv .venv
|
| 37 |
source .venv/bin/activate
|
| 38 |
pip install -U pip
|
| 39 |
pip install -e .
|
| 40 |
```
|
| 41 |
|
| 42 |
+
Download the inference weights:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
```bash
|
|
|
|
|
|
|
| 45 |
hf download onepiece1999/StatePlay \
|
| 46 |
StatePlay.safetensors \
|
| 47 |
--local-dir examples/checkpoint
|
|
|
|
| 56 |
--local-dir base_model/Wan-AI/Wan2.1-T2V-1.3B
|
| 57 |
```
|
| 58 |
|
| 59 |
+
Expected inference layout:
|
| 60 |
|
| 61 |
```text
|
| 62 |
StatePlay/
|
|
|
|
| 69 |
└── ... tokenizer files ...
|
| 70 |
```
|
| 71 |
|
| 72 |
+
To keep weights elsewhere:
|
| 73 |
+
|
| 74 |
+
```bash
|
| 75 |
+
export STATEPLAY_BASE_MODEL=/absolute/path/to/base_model
|
| 76 |
+
export STATEPLAY_CHECKPOINT=/absolute/path/to/StatePlay.safetensors
|
| 77 |
+
```
|
| 78 |
+
|
| 79 |
+
`STATEPLAY_BASE_MODEL` must directly contain `Wan-AI/`.
|
| 80 |
+
|
| 81 |
+
## Code architecture
|
| 82 |
+
|
| 83 |
+
StatePlay uses separate visual and state transformer branches with shared joint
|
| 84 |
+
attention. The visual branch predicts video latents; the state branch predicts
|
| 85 |
+
the five normalized game states. Both branches are conditioned on the initial
|
| 86 |
+
frame, text prompt, and action sequence.
|
| 87 |
+
|
| 88 |
+
```text
|
| 89 |
+
StatePlay/
|
| 90 |
+
├── stateplay/
|
| 91 |
+
│ ├── pipeline.py # public inference pipeline
|
| 92 |
+
│ ├── cli.py # command-line inference
|
| 93 |
+
│ └── models/
|
| 94 |
+
│ ├── dit.py # StatePlay visual/state DiT
|
| 95 |
+
│ ├── vae.py # video VAE wrapper
|
| 96 |
+
│ └── text_encoder.py # text encoder wrapper
|
| 97 |
+
├── training/
|
| 98 |
+
│ ├── train.py # training entry point
|
| 99 |
+
│ ├── runner_with_state.py # optimization/checkpoint loop
|
| 100 |
+
│ └── data/ # SF3 action, state, and prompt loading
|
| 101 |
+
├── diffsynth/ # minimal Wan/StatePlay dependencies
|
| 102 |
+
├── scripts/
|
| 103 |
+
│ ├── inference.sh
|
| 104 |
+
│ ├── run_examples.sh
|
| 105 |
+
│ └── train.sh
|
| 106 |
+
└── examples/
|
| 107 |
+
├── inputs/ # eight bundled inputs
|
| 108 |
+
├── checkpoint/ # local checkpoint
|
| 109 |
+
└── generated/ # generated videos and state predictions
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
## Run examples
|
| 113 |
+
|
| 114 |
+
Generate all eight bundled examples:
|
| 115 |
+
|
| 116 |
+
```bash
|
| 117 |
+
export CUDA_VISIBLE_DEVICES=0
|
| 118 |
+
./scripts/run_examples.sh
|
| 119 |
+
```
|
| 120 |
+
|
| 121 |
+
Generate selected examples:
|
| 122 |
|
| 123 |
+
```bash
|
| 124 |
+
./scripts/run_examples.sh --only 01 03
|
| 125 |
+
```
|
| 126 |
+
|
| 127 |
+
Outputs are written to `examples/generated/`. Each example produces an MP4 and
|
| 128 |
+
a `_state.txt` file. The model is loaded once for the entire run.
|
| 129 |
+
|
| 130 |
+
## Inference
|
| 131 |
|
| 132 |
```bash
|
|
|
|
| 133 |
export CUDA_VISIBLE_DEVICES=0
|
| 134 |
|
| 135 |
./scripts/inference.sh \
|
|
|
|
| 139 |
--output output.mp4
|
| 140 |
```
|
| 141 |
|
| 142 |
+
This writes `output.mp4` and `output_state.txt`. Defaults are 101 frames,
|
| 143 |
+
30 denoising steps, text CFG 5.0, state/action CFG 1.0, and seed 2.
|
| 144 |
+
|
| 145 |
+
Use custom model paths through `STATEPLAY_BASE_MODEL` and
|
| 146 |
+
`STATEPLAY_CHECKPOINT`, or inspect all options with:
|
| 147 |
+
|
| 148 |
+
```bash
|
| 149 |
+
./scripts/inference.sh --help
|
| 150 |
+
```
|
| 151 |
+
|
| 152 |
+
## Training
|
| 153 |
+
|
| 154 |
+
Download the training dataset:
|
| 155 |
+
|
| 156 |
+
```bash
|
| 157 |
+
hf download onepiece1999/StatePlay-Dataset \
|
| 158 |
+
--repo-type dataset \
|
| 159 |
+
--local-dir data/StatePlay-Dataset
|
| 160 |
+
```
|
| 161 |
+
|
| 162 |
+
Download the three Wan2.2 DiT initialization shards:
|
| 163 |
+
|
| 164 |
+
```bash
|
| 165 |
+
hf download Wan-AI/Wan2.2-TI2V-5B \
|
| 166 |
+
diffusion_pytorch_model-00001-of-00003.safetensors \
|
| 167 |
+
diffusion_pytorch_model-00002-of-00003.safetensors \
|
| 168 |
+
diffusion_pytorch_model-00003-of-00003.safetensors \
|
| 169 |
+
--local-dir base_model/Wan-AI/Wan2.2-TI2V-5B
|
| 170 |
+
```
|
| 171 |
+
|
| 172 |
+
Run training:
|
| 173 |
|
| 174 |
+
```bash
|
| 175 |
+
export STATEPLAY_BASE_MODEL="$PWD/base_model"
|
| 176 |
+
export STATEPLAY_DATA_ROOT="$PWD/data/StatePlay-Dataset/SF3"
|
| 177 |
+
export STATEPLAY_OUTPUT="$PWD/outputs/StatePlay"
|
| 178 |
+
export CUDA_VISIBLE_DEVICES=0,1,2,3
|
| 179 |
|
| 180 |
+
./scripts/train.sh
|
| 181 |
+
```
|
| 182 |
|
| 183 |
+
The script derives the process count from `CUDA_VISIBLE_DEVICES`. It trains at
|
| 184 |
+
480×832 with 101 frames, learning rate `5e-5`, state sampling `end`, and saves
|
| 185 |
+
every 500 steps. The released model is the checkpoint at **step 40,000**; stop
|
| 186 |
+
training after that checkpoint is written.
|
| 187 |
|
| 188 |
+
For GPUs that do not need the original H200 memory reservation:
|
| 189 |
|
| 190 |
+
```bash
|
| 191 |
+
RESERVE_CUDA_MEMORY_GB=0 ./scripts/train.sh
|
| 192 |
+
```
|
| 193 |
+
|
| 194 |
+
Resume from a DiT checkpoint:
|
| 195 |
+
|
| 196 |
+
```bash
|
| 197 |
+
./scripts/train.sh --resume_from_ckpt /path/to/step-N.safetensors
|
| 198 |
```
|