Upload README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Matrix-Game 2.0 Self-Consistency Reproduction
|
| 2 |
+
|
| 3 |
+
This repository reproduces the Matrix-Game 2.0 self-consistency (SC) row in
|
| 4 |
+
*Reasoning-Structured Videos: A Stratified Diagnostic Suite for Compositional
|
| 5 |
+
Consistency in World Models*.
|
| 6 |
+
|
| 7 |
+
It evaluates the released full-rollout model videos directly. Ground-truth videos
|
| 8 |
+
are not needed for SC.
|
| 9 |
+
|
| 10 |
+
## What is reproduced
|
| 11 |
+
|
| 12 |
+
The statistical unit is one relation graph:
|
| 13 |
+
|
| 14 |
+
- **Inverse-SC:** generated first frame versus generated final frame.
|
| 15 |
+
- **Loop-SC:** generated first frame versus generated final frame.
|
| 16 |
+
- **Equivalence-SC:** generated final frame of branch A versus generated final
|
| 17 |
+
frame of branch B.
|
| 18 |
+
|
| 19 |
+
The release contains 448 Inverse graphs, 445 Loop graphs, and 239 Equivalence A/B
|
| 20 |
+
pairs. The script checks these counts and pairing integrity before evaluation.
|
| 21 |
+
|
| 22 |
+
## Data
|
| 23 |
+
|
| 24 |
+
Reproduction bundle (videos, evaluator, and this README):
|
| 25 |
+
|
| 26 |
+
<https://huggingface.co/datasets/VideoWorldmodel/Evaluation>
|
| 27 |
+
|
| 28 |
+
The generated videos were originally released at:
|
| 29 |
+
|
| 30 |
+
<https://huggingface.co/datasets/WhynotGPT/Nips_WM_Eval_qzf>
|
| 31 |
+
|
| 32 |
+
The benchmark GT dataset is available separately, but is not required by this SC
|
| 33 |
+
reproduction:
|
| 34 |
+
|
| 35 |
+
<https://huggingface.co/datasets/VideoWorldmodel/ReasoningStructureTestset>
|
| 36 |
+
|
| 37 |
+
Download and extract the MP4-only reproduction archive:
|
| 38 |
+
|
| 39 |
+
```bash
|
| 40 |
+
python -m pip install -U huggingface_hub
|
| 41 |
+
hf download VideoWorldmodel/Evaluation \
|
| 42 |
+
--repo-type dataset \
|
| 43 |
+
--include "MatrixGame2_SC_videos.zip" \
|
| 44 |
+
--local-dir .
|
| 45 |
+
unzip MatrixGame2_SC_videos.zip -d data/Nips_WM_Eval_qzf
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
The expected layout is:
|
| 49 |
+
|
| 50 |
+
```text
|
| 51 |
+
data/Nips_WM_Eval_qzf/
|
| 52 |
+
|-- inverse_easy/ # 246 MP4s
|
| 53 |
+
|-- inverse_hard/ # 202 MP4s
|
| 54 |
+
|-- loop_easy/ # 247 MP4s
|
| 55 |
+
|-- loop_hard/ # 198 MP4s
|
| 56 |
+
`-- equivalence/ # 478 MP4s = 239 A/B pairs
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
If a Git LFS clone was used, ensure the files are real video objects rather than
|
| 60 |
+
small pointer files before evaluation.
|
| 61 |
+
|
| 62 |
+
## Environment
|
| 63 |
+
|
| 64 |
+
Python 3.10 or newer is recommended. For a standard CPU/default PyTorch install:
|
| 65 |
+
|
| 66 |
+
```bash
|
| 67 |
+
python -m venv .venv
|
| 68 |
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
| 69 |
+
python -m pip install --upgrade pip
|
| 70 |
+
python -m pip install "numpy>=1.26,<3" "opencv-python-headless>=4.8,<5" \
|
| 71 |
+
"torch>=2.2,<3" "torchvision>=0.17,<1" "lpips==0.1.4"
|
| 72 |
+
```
|
| 73 |
+
|
| 74 |
+
For a specific CUDA build, install the matching `torch` and `torchvision` wheels
|
| 75 |
+
from the official PyTorch instructions first, then install NumPy, OpenCV, and
|
| 76 |
+
`lpips==0.1.4` from the command above without reinstalling PyTorch.
|
| 77 |
+
|
| 78 |
+
The first LPIPS run downloads the official AlexNet weights.
|
| 79 |
+
|
| 80 |
+
## Reproduce the paper row
|
| 81 |
+
|
| 82 |
+
```bash
|
| 83 |
+
python evaluate_matrix_game_sc.py \
|
| 84 |
+
--data data/Nips_WM_Eval_qzf \
|
| 85 |
+
--output results/matrix_game_sc \
|
| 86 |
+
--lpips \
|
| 87 |
+
--device auto \
|
| 88 |
+
--check-paper
|
| 89 |
+
```
|
| 90 |
+
|
| 91 |
+
Use `--device cuda`, `--device cuda:0`, or `--device cpu` to select a device
|
| 92 |
+
explicitly. A fast PSNR-only audit can be run by omitting `--lpips` and
|
| 93 |
+
`--check-paper`.
|
| 94 |
+
|
| 95 |
+
Expected results:
|
| 96 |
+
|
| 97 |
+
| Relation | Graph N | Recomputed LPIPS / PSNR | Paper LPIPS / PSNR |
|
| 98 |
+
| --- | ---: | ---: | ---: |
|
| 99 |
+
| Inverse-SC | 448 | 0.7061 / 10.4476 | 0.71 / 10.45 |
|
| 100 |
+
| Loop-SC | 445 | 0.7173 / 10.6227 | 0.72 / 10.62 |
|
| 101 |
+
| Equivalence-SC | 239 | 0.5918 / 12.5732 | 0.59 / 12.57 |
|
| 102 |
+
|
| 103 |
+
`--check-paper` passes when all six values reproduce the precision reported in the
|
| 104 |
+
paper. Two Equivalence pairs are exact pixel matches. Their PSNR is infinite, so
|
| 105 |
+
they are reported in `psnr_exact_match_n` and excluded from the finite PSNR mean;
|
| 106 |
+
this produces the reported Equivalence PSNR.
|
| 107 |
+
|
| 108 |
+
## Outputs
|
| 109 |
+
|
| 110 |
+
The output directory contains:
|
| 111 |
+
|
| 112 |
+
```text
|
| 113 |
+
per_graph.csv # one row per Inverse/Loop graph or Equivalence A/B pair
|
| 114 |
+
summary.csv # means, standard deviations, and graph-bootstrap 95% CIs
|
| 115 |
+
paper_check.csv # computed values versus paper values at reported precision
|
| 116 |
+
audit.json # metric definitions, counts, versions, and bootstrap settings
|
| 117 |
+
report.md # compact Markdown result table
|
| 118 |
+
```
|
| 119 |
+
|
| 120 |
+
Confidence intervals use 10,000 graph-level bootstrap resamples with seed 2026.
|
| 121 |
+
LPIPS uses `lpips==0.1.4`, AlexNet, and RGB inputs scaled to `[-1, 1]`. PSNR is
|
| 122 |
+
computed on decoded RGB uint8 endpoints with `MAX=255`; no resizing is applied.
|
| 123 |
+
|
| 124 |
+
## Tests
|
| 125 |
+
|
| 126 |
+
```bash
|
| 127 |
+
python -m unittest discover -s tests -v
|
| 128 |
+
```
|
| 129 |
+
|
| 130 |
+
## Scope
|
| 131 |
+
|
| 132 |
+
This code reproduces the Matrix-Game 2.0 **SC endpoint metrics only**. It does not
|
| 133 |
+
claim to reproduce the paper's GT-anchored metrics or FVD, which require additional
|
| 134 |
+
generation-context and clip-sampling details.
|