Upload Matrix-Game diagnostic results and images
Browse files- .gitattributes +7 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/case0_full_original.jpg +0 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/case0_full_original.json +81 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/case1_full_original.jpg +3 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/case1_full_original.json +81 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/complete.json +1 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/launcher.sh +35 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/manifest.json +59 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/node.json +7 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/probe.py +113 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/case0_full_weighted.jpg +0 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/case0_full_weighted.json +81 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/case1_full_weighted.jpg +3 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/case1_full_weighted.json +81 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/complete.json +1 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/launcher.sh +35 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/manifest.json +59 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/node.json +7 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/probe.py +113 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/case0_i2v_original.jpg +3 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/case0_i2v_original.json +81 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/case1_i2v_original.jpg +3 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/case1_i2v_original.json +81 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/complete.json +1 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/launcher.sh +35 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/manifest.json +59 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/node.json +7 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/probe.py +113 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/case0_i2v_weighted.jpg +3 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/case0_i2v_weighted.json +81 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/case1_i2v_weighted.jpg +3 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/case1_i2v_weighted.json +81 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/complete.json +1 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/launcher.sh +35 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/manifest.json +59 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/node.json +7 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/probe.py +113 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/case0_wan_oracle.jpg +0 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/case0_wan_oracle.json +81 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/case1_wan_oracle.jpg +3 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/case1_wan_oracle.json +81 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/complete.json +1 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/launcher.sh +35 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/manifest.json +59 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/node.json +7 -0
- results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/probe.py +113 -0
.gitattributes
CHANGED
|
@@ -14316,3 +14316,10 @@ slurm_logs/dememwm-final-noanchor-200k-81633.out filter=lfs diff=lfs merge=lfs -
|
|
| 14316 |
slurm_logs/dememwm-final-nocomp-200k-81634.out filter=lfs diff=lfs merge=lfs -text
|
| 14317 |
slurm_logs/dememwm-final-routeoff-200k-81632.out filter=lfs diff=lfs merge=lfs -text
|
| 14318 |
worldmem_long_horizon/oasis_minecraft_test300_ctx600_roll500_seed42_job78322/generated_videos/g000222_test__val_savanna__1__000045.mp4 filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14316 |
slurm_logs/dememwm-final-nocomp-200k-81634.out filter=lfs diff=lfs merge=lfs -text
|
| 14317 |
slurm_logs/dememwm-final-routeoff-200k-81632.out filter=lfs diff=lfs merge=lfs -text
|
| 14318 |
worldmem_long_horizon/oasis_minecraft_test300_ctx600_roll500_seed42_job78322/generated_videos/g000222_test__val_savanna__1__000045.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 14319 |
+
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/case1_full_original.jpg filter=lfs diff=lfs merge=lfs -text
|
| 14320 |
+
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/case1_full_weighted.jpg filter=lfs diff=lfs merge=lfs -text
|
| 14321 |
+
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/case0_i2v_original.jpg filter=lfs diff=lfs merge=lfs -text
|
| 14322 |
+
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/case1_i2v_original.jpg filter=lfs diff=lfs merge=lfs -text
|
| 14323 |
+
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/case0_i2v_weighted.jpg filter=lfs diff=lfs merge=lfs -text
|
| 14324 |
+
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/case1_i2v_weighted.jpg filter=lfs diff=lfs merge=lfs -text
|
| 14325 |
+
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/case1_wan_oracle.jpg filter=lfs diff=lfs merge=lfs -text
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/case0_full_original.jpg
ADDED
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/case0_full_original.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"case": "case0_full_original",
|
| 3 |
+
"raw_rgb_psnr": [
|
| 4 |
+
25.77519416809082,
|
| 5 |
+
4.8833327293396,
|
| 6 |
+
4.636667251586914,
|
| 7 |
+
5.688905715942383,
|
| 8 |
+
7.4164934158325195,
|
| 9 |
+
7.8217339515686035,
|
| 10 |
+
8.03274154663086,
|
| 11 |
+
8.007763862609863,
|
| 12 |
+
8.02673625946045,
|
| 13 |
+
8.09578800201416,
|
| 14 |
+
8.218385696411133,
|
| 15 |
+
8.326114654541016,
|
| 16 |
+
7.63754940032959,
|
| 17 |
+
7.489852428436279,
|
| 18 |
+
7.3153157234191895,
|
| 19 |
+
7.299378395080566,
|
| 20 |
+
7.418322563171387,
|
| 21 |
+
7.375185012817383,
|
| 22 |
+
7.256275177001953,
|
| 23 |
+
7.181506156921387,
|
| 24 |
+
7.253871917724609,
|
| 25 |
+
7.2649149894714355,
|
| 26 |
+
7.2623491287231445,
|
| 27 |
+
7.290315628051758
|
| 28 |
+
],
|
| 29 |
+
"raw_rgb_mse": [
|
| 30 |
+
0.002645334927365184,
|
| 31 |
+
0.32483792304992676,
|
| 32 |
+
0.3438216745853424,
|
| 33 |
+
0.2698419392108917,
|
| 34 |
+
0.18128031492233276,
|
| 35 |
+
0.16513024270534515,
|
| 36 |
+
0.1572989672422409,
|
| 37 |
+
0.1582062542438507,
|
| 38 |
+
0.15751661360263824,
|
| 39 |
+
0.1550319343805313,
|
| 40 |
+
0.15071670711040497,
|
| 41 |
+
0.14702408015727997,
|
| 42 |
+
0.17228403687477112,
|
| 43 |
+
0.178243950009346,
|
| 44 |
+
0.18555320799350739,
|
| 45 |
+
0.18623535335063934,
|
| 46 |
+
0.18120399117469788,
|
| 47 |
+
0.18301282823085785,
|
| 48 |
+
0.1880929172039032,
|
| 49 |
+
0.19135920703411102,
|
| 50 |
+
0.1881970316171646,
|
| 51 |
+
0.18771910667419434,
|
| 52 |
+
0.18783006072044373,
|
| 53 |
+
0.18662439286708832
|
| 54 |
+
],
|
| 55 |
+
"mean_rgb": [
|
| 56 |
+
0.6862332224845886,
|
| 57 |
+
0.1697441190481186,
|
| 58 |
+
0.156618133187294,
|
| 59 |
+
0.2281637042760849,
|
| 60 |
+
0.31492793560028076,
|
| 61 |
+
0.33408209681510925,
|
| 62 |
+
0.34403756260871887,
|
| 63 |
+
0.3432576060295105,
|
| 64 |
+
0.3432428538799286,
|
| 65 |
+
0.34543678164482117,
|
| 66 |
+
0.35083115100860596,
|
| 67 |
+
0.357102632522583,
|
| 68 |
+
0.3239423930644989,
|
| 69 |
+
0.3186531066894531,
|
| 70 |
+
0.3103964030742645,
|
| 71 |
+
0.3092810809612274,
|
| 72 |
+
0.3162357807159424,
|
| 73 |
+
0.31385642290115356,
|
| 74 |
+
0.30743733048439026,
|
| 75 |
+
0.3035033941268921,
|
| 76 |
+
0.3069319725036621,
|
| 77 |
+
0.3079564869403839,
|
| 78 |
+
0.30708178877830505,
|
| 79 |
+
0.30761298537254333
|
| 80 |
+
]
|
| 81 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/case1_full_original.jpg
ADDED
|
Git LFS Details
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/case1_full_original.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"case": "case1_full_original",
|
| 3 |
+
"raw_rgb_psnr": [
|
| 4 |
+
20.75506591796875,
|
| 5 |
+
5.314362525939941,
|
| 6 |
+
4.540973663330078,
|
| 7 |
+
5.3272600173950195,
|
| 8 |
+
5.330643653869629,
|
| 9 |
+
5.8266520500183105,
|
| 10 |
+
5.940614223480225,
|
| 11 |
+
6.0602803230285645,
|
| 12 |
+
6.2254180908203125,
|
| 13 |
+
6.322708606719971,
|
| 14 |
+
6.403367042541504,
|
| 15 |
+
6.356753826141357,
|
| 16 |
+
6.32526159286499,
|
| 17 |
+
6.268328666687012,
|
| 18 |
+
6.2384490966796875,
|
| 19 |
+
6.203701496124268,
|
| 20 |
+
6.242549896240234,
|
| 21 |
+
6.298856735229492,
|
| 22 |
+
6.294210433959961,
|
| 23 |
+
6.316972732543945,
|
| 24 |
+
6.402440547943115,
|
| 25 |
+
6.451478481292725,
|
| 26 |
+
6.471812725067139,
|
| 27 |
+
6.447417736053467
|
| 28 |
+
],
|
| 29 |
+
"raw_rgb_mse": [
|
| 30 |
+
0.00840414222329855,
|
| 31 |
+
0.2941465377807617,
|
| 32 |
+
0.3514816462993622,
|
| 33 |
+
0.29327428340911865,
|
| 34 |
+
0.29304590821266174,
|
| 35 |
+
0.26141756772994995,
|
| 36 |
+
0.25464698672294617,
|
| 37 |
+
0.2477262318134308,
|
| 38 |
+
0.23848342895507812,
|
| 39 |
+
0.2332003265619278,
|
| 40 |
+
0.22890923917293549,
|
| 41 |
+
0.23137935996055603,
|
| 42 |
+
0.23306328058242798,
|
| 43 |
+
0.23613868653774261,
|
| 44 |
+
0.23776891827583313,
|
| 45 |
+
0.23967893421649933,
|
| 46 |
+
0.23754450678825378,
|
| 47 |
+
0.23448461294174194,
|
| 48 |
+
0.23473559319972992,
|
| 49 |
+
0.23350851237773895,
|
| 50 |
+
0.22895805537700653,
|
| 51 |
+
0.22638735175132751,
|
| 52 |
+
0.22532984614372253,
|
| 53 |
+
0.22659912705421448
|
| 54 |
+
],
|
| 55 |
+
"mean_rgb": [
|
| 56 |
+
0.6869287490844727,
|
| 57 |
+
0.22597603499889374,
|
| 58 |
+
0.16900615394115448,
|
| 59 |
+
0.21825699508190155,
|
| 60 |
+
0.21941502392292023,
|
| 61 |
+
0.248577281832695,
|
| 62 |
+
0.2554280757904053,
|
| 63 |
+
0.26183179020881653,
|
| 64 |
+
0.27177396416664124,
|
| 65 |
+
0.27722224593162537,
|
| 66 |
+
0.281747430562973,
|
| 67 |
+
0.27876004576683044,
|
| 68 |
+
0.27639126777648926,
|
| 69 |
+
0.2728942036628723,
|
| 70 |
+
0.2711937129497528,
|
| 71 |
+
0.2694670855998993,
|
| 72 |
+
0.2724168300628662,
|
| 73 |
+
0.27583178877830505,
|
| 74 |
+
0.2756144106388092,
|
| 75 |
+
0.27678048610687256,
|
| 76 |
+
0.2816024720668793,
|
| 77 |
+
0.284187912940979,
|
| 78 |
+
0.2853650152683258,
|
| 79 |
+
0.283825546503067
|
| 80 |
+
]
|
| 81 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/complete.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"mode": "full_original", "cases": 2, "frames": 24}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/launcher.sh
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
#SBATCH --job-name=matrix-game2-diagnostic
|
| 3 |
+
#SBATCH --array=0-4
|
| 4 |
+
#SBATCH --nodes=1
|
| 5 |
+
#SBATCH --ntasks=1
|
| 6 |
+
#SBATCH --cpus-per-task=14
|
| 7 |
+
#SBATCH --gres=gpu:1
|
| 8 |
+
#SBATCH --time=01:00:00
|
| 9 |
+
#SBATCH --account=berzelius-2026-196
|
| 10 |
+
#SBATCH --chdir=/proj/cvl/users/x_fahkh2/worldmem-baseline-evals
|
| 11 |
+
#SBATCH --output=slurm_logs/%x-%A_%a.out
|
| 12 |
+
#SBATCH --error=slurm_logs/%x-%A_%a.out
|
| 13 |
+
set -euo pipefail
|
| 14 |
+
module load buildenv-gcccuda/12.9.1-gcc11
|
| 15 |
+
ROOT=/proj/cvl/users/x_fahkh2/worldmem-baseline-evals
|
| 16 |
+
PYTHON=/proj/cvl/users/x_fahkh2/envs/matrix-game2-eval/bin/python
|
| 17 |
+
DATA_ROOT=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft
|
| 18 |
+
MODES=(wan_oracle full_original full_weighted i2v_original i2v_weighted)
|
| 19 |
+
MODE=${MODES[$SLURM_ARRAY_TASK_ID]}
|
| 20 |
+
OUTPUT=$ROOT/Matrix-Game/Matrix-Game-2/outputs/diagnostic_${MODE}_job${SLURM_ARRAY_JOB_ID}_task${SLURM_ARRAY_TASK_ID}
|
| 21 |
+
export TMPDIR=$ROOT/cache
|
| 22 |
+
export TRITON_CACHE_DIR=$ROOT/cache
|
| 23 |
+
export HF_HOME=$ROOT/cache/huggingface
|
| 24 |
+
export TORCH_HOME=$ROOT/cache/torch
|
| 25 |
+
export XDG_CACHE_HOME=$ROOT/cache
|
| 26 |
+
export MPLCONFIGDIR=$ROOT/cache/matplotlib
|
| 27 |
+
export PYTHONNOUSERSITE=1 PYTHONUNBUFFERED=1 OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
|
| 28 |
+
export WANDB_MODE=disabled HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1
|
| 29 |
+
mkdir -p "$TMPDIR" "$OUTPUT"
|
| 30 |
+
"$PYTHON" "$ROOT/deployment/verify_node.py" --expected-gpus 1 --output "$OUTPUT"
|
| 31 |
+
cp "$0" "$OUTPUT/launcher.sh"
|
| 32 |
+
cp "$ROOT/deployment/diagnose_matrix_game2.py" "$OUTPUT/probe.py"
|
| 33 |
+
srun --ntasks=1 --gpus-per-task=1 --cpus-per-task=14 --cpu-bind=cores \
|
| 34 |
+
"$PYTHON" "$ROOT/deployment/diagnose_matrix_game2.py" \
|
| 35 |
+
--mode "$MODE" --data-root "$DATA_ROOT" --output "$OUTPUT"
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/manifest.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"diagnostic_only": true,
|
| 3 |
+
"mode": "full_original",
|
| 4 |
+
"checkpoint": "/proj/cvl/users/x_fahkh2/worldmem-baseline-evals/checkpoints/matrix-game2",
|
| 5 |
+
"weight_source": "released raw distilled",
|
| 6 |
+
"optimizer": null,
|
| 7 |
+
"lr": null,
|
| 8 |
+
"lora": null,
|
| 9 |
+
"activation_checkpointing": false,
|
| 10 |
+
"batch_size": 1,
|
| 11 |
+
"trainable_parameters": 0,
|
| 12 |
+
"denoising_steps": 3,
|
| 13 |
+
"shift": 5,
|
| 14 |
+
"local_attention_latents": 6,
|
| 15 |
+
"selector": "native sliding cache",
|
| 16 |
+
"reference": "raw RGB resized352x640, not benchmark Oasis references",
|
| 17 |
+
"targets": [
|
| 18 |
+
700,
|
| 19 |
+
724
|
| 20 |
+
],
|
| 21 |
+
"full_history": [
|
| 22 |
+
100,
|
| 23 |
+
700
|
| 24 |
+
],
|
| 25 |
+
"full_prefix_latents": 153,
|
| 26 |
+
"oracle": "9copies+RGB100:724 encodedonce;159latents; discard153latent prefix",
|
| 27 |
+
"i2v": {
|
| 28 |
+
"anchor": 699,
|
| 29 |
+
"decoded_slice": [
|
| 30 |
+
1,
|
| 31 |
+
25
|
| 32 |
+
],
|
| 33 |
+
"controls": [
|
| 34 |
+
700,
|
| 35 |
+
724
|
| 36 |
+
],
|
| 37 |
+
"right_noops": 9
|
| 38 |
+
},
|
| 39 |
+
"normalization_change": "weighted modes apply scales and accumulate RMS in fp32",
|
| 40 |
+
"cases": [
|
| 41 |
+
{
|
| 42 |
+
"index": "0",
|
| 43 |
+
"path": "test/val_plains/2/000034.mp4",
|
| 44 |
+
"seed": 42000000
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"index": "1",
|
| 48 |
+
"path": "test/val_desert/1/000029.mp4",
|
| 49 |
+
"seed": 42000001
|
| 50 |
+
}
|
| 51 |
+
],
|
| 52 |
+
"parameter_counts": {
|
| 53 |
+
"generator_total": 1619242304,
|
| 54 |
+
"generator_trainable": 0,
|
| 55 |
+
"vae_total": 126892531,
|
| 56 |
+
"clip_total": 1193014785
|
| 57 |
+
},
|
| 58 |
+
"action_norm_instances": 60
|
| 59 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/node.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"devices": [
|
| 3 |
+
"NVIDIA H200"
|
| 4 |
+
],
|
| 5 |
+
"torch": "2.7.0+cu126",
|
| 6 |
+
"slurm_job_id": "85090"
|
| 7 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_original_job85088_task1/probe.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Frozen Matrix diagnostics; raw-RGB PSNR is separate from benchmark scoring."""
|
| 2 |
+
import argparse
|
| 3 |
+
import json
|
| 4 |
+
import sys
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import torch
|
| 7 |
+
import torch.nn.functional as F
|
| 8 |
+
from PIL import Image
|
| 9 |
+
|
| 10 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 11 |
+
sys.path[:0] = [str(ROOT / 'shared'), str(ROOT / 'Matrix-Game/Matrix-Game-2')]
|
| 12 |
+
from protocol import load_minecraft_case, select_cases
|
| 13 |
+
from worldmem_adapter import MatrixGameAdapter, map_actions
|
| 14 |
+
from demo_utils.constant import ZERO_VAE_CACHE
|
| 15 |
+
|
| 16 |
+
MODES = ['wan_oracle', 'full_original', 'full_weighted', 'i2v_original', 'i2v_weighted']
|
| 17 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 18 |
+
parser.add_argument('--mode', choices=MODES, required=True)
|
| 19 |
+
parser.add_argument('--data-root', type=Path, required=True)
|
| 20 |
+
parser.add_argument('--output', type=Path, required=True)
|
| 21 |
+
parser.add_argument('--dry-run', action='store_true')
|
| 22 |
+
|
| 23 |
+
def weighted_norm(self, x):
|
| 24 |
+
y = x.float()
|
| 25 |
+
return (y * torch.rsqrt(y.square().mean(-1, keepdim=True) + self.eps)).to(x.dtype) * self.weight
|
| 26 |
+
|
| 27 |
+
def save_result(output, name, prediction, reference):
|
| 28 |
+
prediction = prediction.float().cpu()
|
| 29 |
+
if prediction.shape != reference.shape or not torch.isfinite(prediction).all():
|
| 30 |
+
raise ValueError(f'Invalid Matrix prediction: {name}, shape={tuple(prediction.shape)}')
|
| 31 |
+
prediction = prediction.clamp(0, 1)
|
| 32 |
+
mse = (prediction - reference).square().mean((1, 2, 3))
|
| 33 |
+
report = {'case': name, 'raw_rgb_psnr': (-10 * mse.clamp_min(1e-12).log10()).tolist(),
|
| 34 |
+
'raw_rgb_mse': mse.tolist(), 'mean_rgb': prediction.mean((1, 2, 3)).tolist()}
|
| 35 |
+
(output / f'{name}.json').write_text(json.dumps(report, indent=2))
|
| 36 |
+
grid = torch.cat([torch.cat([v[t] for t in [0, 1, 2, 5, 11, 23]], dim=2)
|
| 37 |
+
for v in (reference, prediction)], dim=1)
|
| 38 |
+
Image.fromarray(grid.mul(255).byte().permute(1, 2, 0).numpy()).save(output / f'{name}.jpg')
|
| 39 |
+
print(json.dumps({'case': name, 'mean_psnr': sum(report['raw_rgb_psnr']) / 24,
|
| 40 |
+
'first_psnr': report['raw_rgb_psnr'][:3]}), flush=True)
|
| 41 |
+
|
| 42 |
+
@torch.inference_mode()
|
| 43 |
+
def main():
|
| 44 |
+
args = parser.parse_args()
|
| 45 |
+
rows = select_cases(ROOT / 'deployment/manifests/minecraft_test_300.csv', limit=2)
|
| 46 |
+
checkpoint = ROOT / 'checkpoints/matrix-game2'
|
| 47 |
+
manifest = {'diagnostic_only': True, 'mode': args.mode, 'checkpoint': str(checkpoint),
|
| 48 |
+
'weight_source': 'released raw distilled', 'optimizer': None, 'lr': None, 'lora': None,
|
| 49 |
+
'activation_checkpointing': False, 'batch_size': 1, 'trainable_parameters': 0,
|
| 50 |
+
'denoising_steps': 3, 'shift': 5, 'local_attention_latents': 6,
|
| 51 |
+
'selector': 'native sliding cache', 'reference': 'raw RGB resized352x640, not benchmark Oasis references',
|
| 52 |
+
'targets': [700, 724], 'full_history': [100, 700], 'full_prefix_latents': 153,
|
| 53 |
+
'oracle': '9copies+RGB100:724 encodedonce;159latents; discard153latent prefix',
|
| 54 |
+
'i2v': {'anchor': 699, 'decoded_slice': [1, 25], 'controls': [700, 724], 'right_noops': 9},
|
| 55 |
+
'normalization_change': 'weighted modes apply scales and accumulate RMS in fp32',
|
| 56 |
+
'cases': [{'index': r['global_test_index'], 'path': r['relative_path'],
|
| 57 |
+
'seed': 42000000 + int(r['global_test_index'])} for r in rows]}
|
| 58 |
+
if args.dry_run:
|
| 59 |
+
print(json.dumps(manifest, indent=2))
|
| 60 |
+
return
|
| 61 |
+
args.output.mkdir(parents=True, exist_ok=True)
|
| 62 |
+
(args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
|
| 63 |
+
from wan.modules.action_module import WanRMSNorm
|
| 64 |
+
adapter = MatrixGameAdapter(checkpoint)
|
| 65 |
+
manifest['parameter_counts'] = adapter.parameter_counts
|
| 66 |
+
manifest['action_norm_instances'] = sum(isinstance(m, WanRMSNorm) for m in adapter.pipeline.modules())
|
| 67 |
+
(args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
|
| 68 |
+
if args.mode.endswith('weighted'):
|
| 69 |
+
WanRMSNorm.forward = weighted_norm
|
| 70 |
+
for row in rows:
|
| 71 |
+
row.update(target_end='724', target_frames='24')
|
| 72 |
+
case = load_minecraft_case(row, args.data_root)
|
| 73 |
+
reference = F.interpolate(case['rgb'][600:624], (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 74 |
+
seed = 42000000 + int(row['global_test_index'])
|
| 75 |
+
if args.mode == 'wan_oracle':
|
| 76 |
+
rgb = F.interpolate(case['rgb'].cuda(), (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 77 |
+
rgb = torch.cat([rgb[:1].expand(9, -1, -1, -1), rgb])
|
| 78 |
+
latent = adapter.vae.encode(rgb.transpose(0, 1)[None].mul(2).sub(1).bfloat16(), device=adapter.device, tiled=False)
|
| 79 |
+
cache, chunks = [None] * len(ZERO_VAE_CACHE), []
|
| 80 |
+
for start in range(0, latent.shape[2], 3):
|
| 81 |
+
decoded, cache = adapter.pipeline.vae_decoder(latent[:, :, start:start + 3].transpose(1, 2).half(), *cache)
|
| 82 |
+
if start >= 153:
|
| 83 |
+
chunks.append(decoded.cpu())
|
| 84 |
+
prediction = torch.cat(chunks, dim=1)[0].float().add(1).div(2)
|
| 85 |
+
del latent, rgb, cache, decoded, chunks
|
| 86 |
+
elif args.mode.startswith('full'):
|
| 87 |
+
prediction, _ = adapter.generate(case, target_frames=24, seed=seed)
|
| 88 |
+
else:
|
| 89 |
+
torch.manual_seed(seed)
|
| 90 |
+
torch.cuda.manual_seed_all(seed)
|
| 91 |
+
anchor = F.interpolate(case['rgb'][599:600].cuda(), (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 92 |
+
anchor = anchor.transpose(0, 1)[None].mul(2).sub(1).bfloat16()
|
| 93 |
+
image = anchor.new_zeros((1, 3, 33, 352, 640))
|
| 94 |
+
image[:, :, :1] = anchor
|
| 95 |
+
image_latents = adapter.vae.encode(image, device=adapter.device, tiled=False)
|
| 96 |
+
mask = torch.zeros_like(image_latents[:, :4])
|
| 97 |
+
mask[:, :, :1] = 1
|
| 98 |
+
actions = torch.cat([case['actions'][600:624], torch.zeros(9, 25)]).cuda().bfloat16()
|
| 99 |
+
keyboard, mouse = map_actions(actions, 1.0)
|
| 100 |
+
condition = {'cond_concat': torch.cat([mask, image_latents], dim=1),
|
| 101 |
+
'visual_context': adapter.vae.clip.encode_video(anchor).bfloat16(),
|
| 102 |
+
'keyboard_cond': keyboard[None], 'mouse_cond': mouse[None]}
|
| 103 |
+
noise = torch.randn((1, 16, 9, 44, 80), device='cuda', dtype=torch.bfloat16)
|
| 104 |
+
videos = adapter.pipeline.inference(noise, condition, initial_latent=None, mode='universal')
|
| 105 |
+
prediction = torch.cat(videos, dim=1)[0, 1:25].float().add(1).div(2)
|
| 106 |
+
del image, anchor, image_latents, condition, videos, noise
|
| 107 |
+
save_result(args.output, f"case{row['global_test_index']}_{args.mode}", prediction, reference)
|
| 108 |
+
del prediction, reference, case
|
| 109 |
+
(args.output / 'complete.json').write_text(json.dumps({'mode': args.mode, 'cases': 2, 'frames': 24}))
|
| 110 |
+
print('DIAGNOSTICS_COMPLETE', flush=True)
|
| 111 |
+
|
| 112 |
+
if __name__ == '__main__':
|
| 113 |
+
main()
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/case0_full_weighted.jpg
ADDED
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/case0_full_weighted.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"case": "case0_full_weighted",
|
| 3 |
+
"raw_rgb_psnr": [
|
| 4 |
+
25.945024490356445,
|
| 5 |
+
4.916481018066406,
|
| 6 |
+
4.617745876312256,
|
| 7 |
+
5.818724632263184,
|
| 8 |
+
7.579941272735596,
|
| 9 |
+
7.90878963470459,
|
| 10 |
+
8.117096900939941,
|
| 11 |
+
8.039791107177734,
|
| 12 |
+
8.028121948242188,
|
| 13 |
+
8.168718338012695,
|
| 14 |
+
8.279888153076172,
|
| 15 |
+
8.406937599182129,
|
| 16 |
+
7.733737945556641,
|
| 17 |
+
7.428074359893799,
|
| 18 |
+
7.25970983505249,
|
| 19 |
+
7.244600296020508,
|
| 20 |
+
7.345211505889893,
|
| 21 |
+
7.292293548583984,
|
| 22 |
+
7.148654937744141,
|
| 23 |
+
7.099469184875488,
|
| 24 |
+
7.157524108886719,
|
| 25 |
+
7.194796085357666,
|
| 26 |
+
7.167351245880127,
|
| 27 |
+
7.1892571449279785
|
| 28 |
+
],
|
| 29 |
+
"raw_rgb_mse": [
|
| 30 |
+
0.0025438847951591015,
|
| 31 |
+
0.32236796617507935,
|
| 32 |
+
0.34532293677330017,
|
| 33 |
+
0.26189520955085754,
|
| 34 |
+
0.17458458244800568,
|
| 35 |
+
0.1618531197309494,
|
| 36 |
+
0.1542731374502182,
|
| 37 |
+
0.15704382956027985,
|
| 38 |
+
0.1574663519859314,
|
| 39 |
+
0.15245023369789124,
|
| 40 |
+
0.14859738945960999,
|
| 41 |
+
0.1443132609128952,
|
| 42 |
+
0.16851019859313965,
|
| 43 |
+
0.1807975471019745,
|
| 44 |
+
0.187944233417511,
|
| 45 |
+
0.18859927356243134,
|
| 46 |
+
0.18428027629852295,
|
| 47 |
+
0.1865394413471222,
|
| 48 |
+
0.19281220436096191,
|
| 49 |
+
0.1950082778930664,
|
| 50 |
+
0.19241884350776672,
|
| 51 |
+
0.19077451527118683,
|
| 52 |
+
0.19198393821716309,
|
| 53 |
+
0.1910180002450943
|
| 54 |
+
],
|
| 55 |
+
"mean_rgb": [
|
| 56 |
+
0.6870425343513489,
|
| 57 |
+
0.1719239205121994,
|
| 58 |
+
0.1551111340522766,
|
| 59 |
+
0.23643054068088531,
|
| 60 |
+
0.32379114627838135,
|
| 61 |
+
0.3390358090400696,
|
| 62 |
+
0.3493805527687073,
|
| 63 |
+
0.3448195159435272,
|
| 64 |
+
0.3432111144065857,
|
| 65 |
+
0.349094033241272,
|
| 66 |
+
0.3539511561393738,
|
| 67 |
+
0.360940158367157,
|
| 68 |
+
0.32845252752304077,
|
| 69 |
+
0.3160686194896698,
|
| 70 |
+
0.3070259988307953,
|
| 71 |
+
0.30618816614151,
|
| 72 |
+
0.3123764097690582,
|
| 73 |
+
0.3096041679382324,
|
| 74 |
+
0.30161795020103455,
|
| 75 |
+
0.29898521304130554,
|
| 76 |
+
0.30154550075531006,
|
| 77 |
+
0.3034396171569824,
|
| 78 |
+
0.3025643229484558,
|
| 79 |
+
0.302489310503006
|
| 80 |
+
]
|
| 81 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/case1_full_weighted.jpg
ADDED
|
Git LFS Details
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/case1_full_weighted.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"case": "case1_full_weighted",
|
| 3 |
+
"raw_rgb_psnr": [
|
| 4 |
+
20.358261108398438,
|
| 5 |
+
5.021709442138672,
|
| 6 |
+
4.7442827224731445,
|
| 7 |
+
5.203425407409668,
|
| 8 |
+
5.046121597290039,
|
| 9 |
+
5.245299339294434,
|
| 10 |
+
5.384633541107178,
|
| 11 |
+
5.533613681793213,
|
| 12 |
+
5.719480514526367,
|
| 13 |
+
5.826648712158203,
|
| 14 |
+
5.863295078277588,
|
| 15 |
+
5.830295085906982,
|
| 16 |
+
5.900106906890869,
|
| 17 |
+
5.944562911987305,
|
| 18 |
+
6.028284072875977,
|
| 19 |
+
5.974111080169678,
|
| 20 |
+
6.014407157897949,
|
| 21 |
+
6.091710090637207,
|
| 22 |
+
6.0647077560424805,
|
| 23 |
+
6.101002216339111,
|
| 24 |
+
6.22338342666626,
|
| 25 |
+
6.275542259216309,
|
| 26 |
+
6.29188346862793,
|
| 27 |
+
6.269043922424316
|
| 28 |
+
],
|
| 29 |
+
"raw_rgb_mse": [
|
| 30 |
+
0.009208180010318756,
|
| 31 |
+
0.3146509528160095,
|
| 32 |
+
0.33540669083595276,
|
| 33 |
+
0.3017570674419403,
|
| 34 |
+
0.3128872513771057,
|
| 35 |
+
0.298861563205719,
|
| 36 |
+
0.28942540287971497,
|
| 37 |
+
0.27966535091400146,
|
| 38 |
+
0.2679488956928253,
|
| 39 |
+
0.26141780614852905,
|
| 40 |
+
0.2592211663722992,
|
| 41 |
+
0.26119837164878845,
|
| 42 |
+
0.25703325867652893,
|
| 43 |
+
0.2544155716896057,
|
| 44 |
+
0.24955807626247406,
|
| 45 |
+
0.25269049406051636,
|
| 46 |
+
0.2503567337989807,
|
| 47 |
+
0.24593989551067352,
|
| 48 |
+
0.2474737912416458,
|
| 49 |
+
0.24541424214839935,
|
| 50 |
+
0.2385951578617096,
|
| 51 |
+
0.23574677109718323,
|
| 52 |
+
0.23486140370368958,
|
| 53 |
+
0.23609979450702667
|
| 54 |
+
],
|
| 55 |
+
"mean_rgb": [
|
| 56 |
+
0.6835651397705078,
|
| 57 |
+
0.20514607429504395,
|
| 58 |
+
0.18633019924163818,
|
| 59 |
+
0.21573315560817719,
|
| 60 |
+
0.20562198758125305,
|
| 61 |
+
0.21696747839450836,
|
| 62 |
+
0.2257290482521057,
|
| 63 |
+
0.23421454429626465,
|
| 64 |
+
0.24657680094242096,
|
| 65 |
+
0.2528727352619171,
|
| 66 |
+
0.25491902232170105,
|
| 67 |
+
0.25266510248184204,
|
| 68 |
+
0.25558704137802124,
|
| 69 |
+
0.25767818093299866,
|
| 70 |
+
0.26240184903144836,
|
| 71 |
+
0.25888851284980774,
|
| 72 |
+
0.2621479630470276,
|
| 73 |
+
0.26704472303390503,
|
| 74 |
+
0.2655029892921448,
|
| 75 |
+
0.267596572637558,
|
| 76 |
+
0.2748774290084839,
|
| 77 |
+
0.27775564789772034,
|
| 78 |
+
0.2788831293582916,
|
| 79 |
+
0.2775684595108032
|
| 80 |
+
]
|
| 81 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/complete.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"mode": "full_weighted", "cases": 2, "frames": 24}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/launcher.sh
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
#SBATCH --job-name=matrix-game2-diagnostic
|
| 3 |
+
#SBATCH --array=0-4
|
| 4 |
+
#SBATCH --nodes=1
|
| 5 |
+
#SBATCH --ntasks=1
|
| 6 |
+
#SBATCH --cpus-per-task=14
|
| 7 |
+
#SBATCH --gres=gpu:1
|
| 8 |
+
#SBATCH --time=01:00:00
|
| 9 |
+
#SBATCH --account=berzelius-2026-196
|
| 10 |
+
#SBATCH --chdir=/proj/cvl/users/x_fahkh2/worldmem-baseline-evals
|
| 11 |
+
#SBATCH --output=slurm_logs/%x-%A_%a.out
|
| 12 |
+
#SBATCH --error=slurm_logs/%x-%A_%a.out
|
| 13 |
+
set -euo pipefail
|
| 14 |
+
module load buildenv-gcccuda/12.9.1-gcc11
|
| 15 |
+
ROOT=/proj/cvl/users/x_fahkh2/worldmem-baseline-evals
|
| 16 |
+
PYTHON=/proj/cvl/users/x_fahkh2/envs/matrix-game2-eval/bin/python
|
| 17 |
+
DATA_ROOT=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft
|
| 18 |
+
MODES=(wan_oracle full_original full_weighted i2v_original i2v_weighted)
|
| 19 |
+
MODE=${MODES[$SLURM_ARRAY_TASK_ID]}
|
| 20 |
+
OUTPUT=$ROOT/Matrix-Game/Matrix-Game-2/outputs/diagnostic_${MODE}_job${SLURM_ARRAY_JOB_ID}_task${SLURM_ARRAY_TASK_ID}
|
| 21 |
+
export TMPDIR=$ROOT/cache
|
| 22 |
+
export TRITON_CACHE_DIR=$ROOT/cache
|
| 23 |
+
export HF_HOME=$ROOT/cache/huggingface
|
| 24 |
+
export TORCH_HOME=$ROOT/cache/torch
|
| 25 |
+
export XDG_CACHE_HOME=$ROOT/cache
|
| 26 |
+
export MPLCONFIGDIR=$ROOT/cache/matplotlib
|
| 27 |
+
export PYTHONNOUSERSITE=1 PYTHONUNBUFFERED=1 OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
|
| 28 |
+
export WANDB_MODE=disabled HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1
|
| 29 |
+
mkdir -p "$TMPDIR" "$OUTPUT"
|
| 30 |
+
"$PYTHON" "$ROOT/deployment/verify_node.py" --expected-gpus 1 --output "$OUTPUT"
|
| 31 |
+
cp "$0" "$OUTPUT/launcher.sh"
|
| 32 |
+
cp "$ROOT/deployment/diagnose_matrix_game2.py" "$OUTPUT/probe.py"
|
| 33 |
+
srun --ntasks=1 --gpus-per-task=1 --cpus-per-task=14 --cpu-bind=cores \
|
| 34 |
+
"$PYTHON" "$ROOT/deployment/diagnose_matrix_game2.py" \
|
| 35 |
+
--mode "$MODE" --data-root "$DATA_ROOT" --output "$OUTPUT"
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/manifest.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"diagnostic_only": true,
|
| 3 |
+
"mode": "full_weighted",
|
| 4 |
+
"checkpoint": "/proj/cvl/users/x_fahkh2/worldmem-baseline-evals/checkpoints/matrix-game2",
|
| 5 |
+
"weight_source": "released raw distilled",
|
| 6 |
+
"optimizer": null,
|
| 7 |
+
"lr": null,
|
| 8 |
+
"lora": null,
|
| 9 |
+
"activation_checkpointing": false,
|
| 10 |
+
"batch_size": 1,
|
| 11 |
+
"trainable_parameters": 0,
|
| 12 |
+
"denoising_steps": 3,
|
| 13 |
+
"shift": 5,
|
| 14 |
+
"local_attention_latents": 6,
|
| 15 |
+
"selector": "native sliding cache",
|
| 16 |
+
"reference": "raw RGB resized352x640, not benchmark Oasis references",
|
| 17 |
+
"targets": [
|
| 18 |
+
700,
|
| 19 |
+
724
|
| 20 |
+
],
|
| 21 |
+
"full_history": [
|
| 22 |
+
100,
|
| 23 |
+
700
|
| 24 |
+
],
|
| 25 |
+
"full_prefix_latents": 153,
|
| 26 |
+
"oracle": "9copies+RGB100:724 encodedonce;159latents; discard153latent prefix",
|
| 27 |
+
"i2v": {
|
| 28 |
+
"anchor": 699,
|
| 29 |
+
"decoded_slice": [
|
| 30 |
+
1,
|
| 31 |
+
25
|
| 32 |
+
],
|
| 33 |
+
"controls": [
|
| 34 |
+
700,
|
| 35 |
+
724
|
| 36 |
+
],
|
| 37 |
+
"right_noops": 9
|
| 38 |
+
},
|
| 39 |
+
"normalization_change": "weighted modes apply scales and accumulate RMS in fp32",
|
| 40 |
+
"cases": [
|
| 41 |
+
{
|
| 42 |
+
"index": "0",
|
| 43 |
+
"path": "test/val_plains/2/000034.mp4",
|
| 44 |
+
"seed": 42000000
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"index": "1",
|
| 48 |
+
"path": "test/val_desert/1/000029.mp4",
|
| 49 |
+
"seed": 42000001
|
| 50 |
+
}
|
| 51 |
+
],
|
| 52 |
+
"parameter_counts": {
|
| 53 |
+
"generator_total": 1619242304,
|
| 54 |
+
"generator_trainable": 0,
|
| 55 |
+
"vae_total": 126892531,
|
| 56 |
+
"clip_total": 1193014785
|
| 57 |
+
},
|
| 58 |
+
"action_norm_instances": 60
|
| 59 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/node.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"devices": [
|
| 3 |
+
"NVIDIA H200"
|
| 4 |
+
],
|
| 5 |
+
"torch": "2.7.0+cu126",
|
| 6 |
+
"slurm_job_id": "85091"
|
| 7 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_full_weighted_job85088_task2/probe.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Frozen Matrix diagnostics; raw-RGB PSNR is separate from benchmark scoring."""
|
| 2 |
+
import argparse
|
| 3 |
+
import json
|
| 4 |
+
import sys
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import torch
|
| 7 |
+
import torch.nn.functional as F
|
| 8 |
+
from PIL import Image
|
| 9 |
+
|
| 10 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 11 |
+
sys.path[:0] = [str(ROOT / 'shared'), str(ROOT / 'Matrix-Game/Matrix-Game-2')]
|
| 12 |
+
from protocol import load_minecraft_case, select_cases
|
| 13 |
+
from worldmem_adapter import MatrixGameAdapter, map_actions
|
| 14 |
+
from demo_utils.constant import ZERO_VAE_CACHE
|
| 15 |
+
|
| 16 |
+
MODES = ['wan_oracle', 'full_original', 'full_weighted', 'i2v_original', 'i2v_weighted']
|
| 17 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 18 |
+
parser.add_argument('--mode', choices=MODES, required=True)
|
| 19 |
+
parser.add_argument('--data-root', type=Path, required=True)
|
| 20 |
+
parser.add_argument('--output', type=Path, required=True)
|
| 21 |
+
parser.add_argument('--dry-run', action='store_true')
|
| 22 |
+
|
| 23 |
+
def weighted_norm(self, x):
|
| 24 |
+
y = x.float()
|
| 25 |
+
return (y * torch.rsqrt(y.square().mean(-1, keepdim=True) + self.eps)).to(x.dtype) * self.weight
|
| 26 |
+
|
| 27 |
+
def save_result(output, name, prediction, reference):
|
| 28 |
+
prediction = prediction.float().cpu()
|
| 29 |
+
if prediction.shape != reference.shape or not torch.isfinite(prediction).all():
|
| 30 |
+
raise ValueError(f'Invalid Matrix prediction: {name}, shape={tuple(prediction.shape)}')
|
| 31 |
+
prediction = prediction.clamp(0, 1)
|
| 32 |
+
mse = (prediction - reference).square().mean((1, 2, 3))
|
| 33 |
+
report = {'case': name, 'raw_rgb_psnr': (-10 * mse.clamp_min(1e-12).log10()).tolist(),
|
| 34 |
+
'raw_rgb_mse': mse.tolist(), 'mean_rgb': prediction.mean((1, 2, 3)).tolist()}
|
| 35 |
+
(output / f'{name}.json').write_text(json.dumps(report, indent=2))
|
| 36 |
+
grid = torch.cat([torch.cat([v[t] for t in [0, 1, 2, 5, 11, 23]], dim=2)
|
| 37 |
+
for v in (reference, prediction)], dim=1)
|
| 38 |
+
Image.fromarray(grid.mul(255).byte().permute(1, 2, 0).numpy()).save(output / f'{name}.jpg')
|
| 39 |
+
print(json.dumps({'case': name, 'mean_psnr': sum(report['raw_rgb_psnr']) / 24,
|
| 40 |
+
'first_psnr': report['raw_rgb_psnr'][:3]}), flush=True)
|
| 41 |
+
|
| 42 |
+
@torch.inference_mode()
|
| 43 |
+
def main():
|
| 44 |
+
args = parser.parse_args()
|
| 45 |
+
rows = select_cases(ROOT / 'deployment/manifests/minecraft_test_300.csv', limit=2)
|
| 46 |
+
checkpoint = ROOT / 'checkpoints/matrix-game2'
|
| 47 |
+
manifest = {'diagnostic_only': True, 'mode': args.mode, 'checkpoint': str(checkpoint),
|
| 48 |
+
'weight_source': 'released raw distilled', 'optimizer': None, 'lr': None, 'lora': None,
|
| 49 |
+
'activation_checkpointing': False, 'batch_size': 1, 'trainable_parameters': 0,
|
| 50 |
+
'denoising_steps': 3, 'shift': 5, 'local_attention_latents': 6,
|
| 51 |
+
'selector': 'native sliding cache', 'reference': 'raw RGB resized352x640, not benchmark Oasis references',
|
| 52 |
+
'targets': [700, 724], 'full_history': [100, 700], 'full_prefix_latents': 153,
|
| 53 |
+
'oracle': '9copies+RGB100:724 encodedonce;159latents; discard153latent prefix',
|
| 54 |
+
'i2v': {'anchor': 699, 'decoded_slice': [1, 25], 'controls': [700, 724], 'right_noops': 9},
|
| 55 |
+
'normalization_change': 'weighted modes apply scales and accumulate RMS in fp32',
|
| 56 |
+
'cases': [{'index': r['global_test_index'], 'path': r['relative_path'],
|
| 57 |
+
'seed': 42000000 + int(r['global_test_index'])} for r in rows]}
|
| 58 |
+
if args.dry_run:
|
| 59 |
+
print(json.dumps(manifest, indent=2))
|
| 60 |
+
return
|
| 61 |
+
args.output.mkdir(parents=True, exist_ok=True)
|
| 62 |
+
(args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
|
| 63 |
+
from wan.modules.action_module import WanRMSNorm
|
| 64 |
+
adapter = MatrixGameAdapter(checkpoint)
|
| 65 |
+
manifest['parameter_counts'] = adapter.parameter_counts
|
| 66 |
+
manifest['action_norm_instances'] = sum(isinstance(m, WanRMSNorm) for m in adapter.pipeline.modules())
|
| 67 |
+
(args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
|
| 68 |
+
if args.mode.endswith('weighted'):
|
| 69 |
+
WanRMSNorm.forward = weighted_norm
|
| 70 |
+
for row in rows:
|
| 71 |
+
row.update(target_end='724', target_frames='24')
|
| 72 |
+
case = load_minecraft_case(row, args.data_root)
|
| 73 |
+
reference = F.interpolate(case['rgb'][600:624], (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 74 |
+
seed = 42000000 + int(row['global_test_index'])
|
| 75 |
+
if args.mode == 'wan_oracle':
|
| 76 |
+
rgb = F.interpolate(case['rgb'].cuda(), (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 77 |
+
rgb = torch.cat([rgb[:1].expand(9, -1, -1, -1), rgb])
|
| 78 |
+
latent = adapter.vae.encode(rgb.transpose(0, 1)[None].mul(2).sub(1).bfloat16(), device=adapter.device, tiled=False)
|
| 79 |
+
cache, chunks = [None] * len(ZERO_VAE_CACHE), []
|
| 80 |
+
for start in range(0, latent.shape[2], 3):
|
| 81 |
+
decoded, cache = adapter.pipeline.vae_decoder(latent[:, :, start:start + 3].transpose(1, 2).half(), *cache)
|
| 82 |
+
if start >= 153:
|
| 83 |
+
chunks.append(decoded.cpu())
|
| 84 |
+
prediction = torch.cat(chunks, dim=1)[0].float().add(1).div(2)
|
| 85 |
+
del latent, rgb, cache, decoded, chunks
|
| 86 |
+
elif args.mode.startswith('full'):
|
| 87 |
+
prediction, _ = adapter.generate(case, target_frames=24, seed=seed)
|
| 88 |
+
else:
|
| 89 |
+
torch.manual_seed(seed)
|
| 90 |
+
torch.cuda.manual_seed_all(seed)
|
| 91 |
+
anchor = F.interpolate(case['rgb'][599:600].cuda(), (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 92 |
+
anchor = anchor.transpose(0, 1)[None].mul(2).sub(1).bfloat16()
|
| 93 |
+
image = anchor.new_zeros((1, 3, 33, 352, 640))
|
| 94 |
+
image[:, :, :1] = anchor
|
| 95 |
+
image_latents = adapter.vae.encode(image, device=adapter.device, tiled=False)
|
| 96 |
+
mask = torch.zeros_like(image_latents[:, :4])
|
| 97 |
+
mask[:, :, :1] = 1
|
| 98 |
+
actions = torch.cat([case['actions'][600:624], torch.zeros(9, 25)]).cuda().bfloat16()
|
| 99 |
+
keyboard, mouse = map_actions(actions, 1.0)
|
| 100 |
+
condition = {'cond_concat': torch.cat([mask, image_latents], dim=1),
|
| 101 |
+
'visual_context': adapter.vae.clip.encode_video(anchor).bfloat16(),
|
| 102 |
+
'keyboard_cond': keyboard[None], 'mouse_cond': mouse[None]}
|
| 103 |
+
noise = torch.randn((1, 16, 9, 44, 80), device='cuda', dtype=torch.bfloat16)
|
| 104 |
+
videos = adapter.pipeline.inference(noise, condition, initial_latent=None, mode='universal')
|
| 105 |
+
prediction = torch.cat(videos, dim=1)[0, 1:25].float().add(1).div(2)
|
| 106 |
+
del image, anchor, image_latents, condition, videos, noise
|
| 107 |
+
save_result(args.output, f"case{row['global_test_index']}_{args.mode}", prediction, reference)
|
| 108 |
+
del prediction, reference, case
|
| 109 |
+
(args.output / 'complete.json').write_text(json.dumps({'mode': args.mode, 'cases': 2, 'frames': 24}))
|
| 110 |
+
print('DIAGNOSTICS_COMPLETE', flush=True)
|
| 111 |
+
|
| 112 |
+
if __name__ == '__main__':
|
| 113 |
+
main()
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/case0_i2v_original.jpg
ADDED
|
Git LFS Details
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/case0_i2v_original.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"case": "case0_i2v_original",
|
| 3 |
+
"raw_rgb_psnr": [
|
| 4 |
+
28.51933479309082,
|
| 5 |
+
5.62062931060791,
|
| 6 |
+
6.261198997497559,
|
| 7 |
+
7.325035095214844,
|
| 8 |
+
7.525331497192383,
|
| 9 |
+
7.780514240264893,
|
| 10 |
+
7.777151107788086,
|
| 11 |
+
7.821002006530762,
|
| 12 |
+
7.603299617767334,
|
| 13 |
+
7.544827461242676,
|
| 14 |
+
7.494100570678711,
|
| 15 |
+
7.490266799926758,
|
| 16 |
+
7.607268810272217,
|
| 17 |
+
7.717894554138184,
|
| 18 |
+
7.877525329589844,
|
| 19 |
+
7.909063816070557,
|
| 20 |
+
7.8667497634887695,
|
| 21 |
+
7.888334274291992,
|
| 22 |
+
7.912131309509277,
|
| 23 |
+
7.934691905975342,
|
| 24 |
+
7.701882839202881,
|
| 25 |
+
6.664777755737305,
|
| 26 |
+
7.160373687744141,
|
| 27 |
+
7.919079780578613
|
| 28 |
+
],
|
| 29 |
+
"raw_rgb_mse": [
|
| 30 |
+
0.001406263094395399,
|
| 31 |
+
0.27411770820617676,
|
| 32 |
+
0.23652665317058563,
|
| 33 |
+
0.18513838946819305,
|
| 34 |
+
0.17679372429847717,
|
| 35 |
+
0.16670498251914978,
|
| 36 |
+
0.16683414578437805,
|
| 37 |
+
0.16515807807445526,
|
| 38 |
+
0.17364810407161713,
|
| 39 |
+
0.17600186169147491,
|
| 40 |
+
0.17806968092918396,
|
| 41 |
+
0.17822694778442383,
|
| 42 |
+
0.17348946630954742,
|
| 43 |
+
0.16912606358528137,
|
| 44 |
+
0.1630224734544754,
|
| 45 |
+
0.16184288263320923,
|
| 46 |
+
0.1634274572134018,
|
| 47 |
+
0.16261722147464752,
|
| 48 |
+
0.1617286056280136,
|
| 49 |
+
0.16089065372943878,
|
| 50 |
+
0.16975075006484985,
|
| 51 |
+
0.2155371904373169,
|
| 52 |
+
0.19229261577129364,
|
| 53 |
+
0.16147007048130035
|
| 54 |
+
],
|
| 55 |
+
"mean_rgb": [
|
| 56 |
+
0.7052807807922363,
|
| 57 |
+
0.22267355024814606,
|
| 58 |
+
0.26383358240127563,
|
| 59 |
+
0.31955206394195557,
|
| 60 |
+
0.3294263184070587,
|
| 61 |
+
0.3413337469100952,
|
| 62 |
+
0.34034264087677,
|
| 63 |
+
0.3422088921070099,
|
| 64 |
+
0.3322543799877167,
|
| 65 |
+
0.3306882083415985,
|
| 66 |
+
0.32795271277427673,
|
| 67 |
+
0.32645344734191895,
|
| 68 |
+
0.32989341020584106,
|
| 69 |
+
0.33399924635887146,
|
| 70 |
+
0.34038686752319336,
|
| 71 |
+
0.34092986583709717,
|
| 72 |
+
0.33980700373649597,
|
| 73 |
+
0.3406497836112976,
|
| 74 |
+
0.3414357602596283,
|
| 75 |
+
0.3423357307910919,
|
| 76 |
+
0.3307926654815674,
|
| 77 |
+
0.2806178331375122,
|
| 78 |
+
0.30535194277763367,
|
| 79 |
+
0.34129393100738525
|
| 80 |
+
]
|
| 81 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/case1_i2v_original.jpg
ADDED
|
Git LFS Details
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/case1_i2v_original.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"case": "case1_i2v_original",
|
| 3 |
+
"raw_rgb_psnr": [
|
| 4 |
+
15.054824829101562,
|
| 5 |
+
11.44872760772705,
|
| 6 |
+
9.014760971069336,
|
| 7 |
+
7.8256916999816895,
|
| 8 |
+
6.933335781097412,
|
| 9 |
+
6.524610996246338,
|
| 10 |
+
6.566136360168457,
|
| 11 |
+
6.591427803039551,
|
| 12 |
+
6.48160982131958,
|
| 13 |
+
6.368434906005859,
|
| 14 |
+
4.373075008392334,
|
| 15 |
+
5.369548320770264,
|
| 16 |
+
5.37614631652832,
|
| 17 |
+
5.41501522064209,
|
| 18 |
+
5.501518726348877,
|
| 19 |
+
5.463625907897949,
|
| 20 |
+
5.47122859954834,
|
| 21 |
+
5.503015041351318,
|
| 22 |
+
5.575506210327148,
|
| 23 |
+
5.547548294067383,
|
| 24 |
+
5.560653209686279,
|
| 25 |
+
5.55626106262207,
|
| 26 |
+
5.5676751136779785,
|
| 27 |
+
5.580542087554932
|
| 28 |
+
],
|
| 29 |
+
"raw_rgb_mse": [
|
| 30 |
+
0.031226083636283875,
|
| 31 |
+
0.07163531333208084,
|
| 32 |
+
0.12546537816524506,
|
| 33 |
+
0.16497983038425446,
|
| 34 |
+
0.20261257886886597,
|
| 35 |
+
0.22260703146457672,
|
| 36 |
+
0.22048871219158173,
|
| 37 |
+
0.21920840442180634,
|
| 38 |
+
0.22482208907604218,
|
| 39 |
+
0.23075786232948303,
|
| 40 |
+
0.36533603072166443,
|
| 41 |
+
0.29043248295783997,
|
| 42 |
+
0.289991557598114,
|
| 43 |
+
0.2874077558517456,
|
| 44 |
+
0.281739741563797,
|
| 45 |
+
0.284208744764328,
|
| 46 |
+
0.28371164202690125,
|
| 47 |
+
0.28164270520210266,
|
| 48 |
+
0.27698060870170593,
|
| 49 |
+
0.27876943349838257,
|
| 50 |
+
0.27792951464653015,
|
| 51 |
+
0.27821075916290283,
|
| 52 |
+
0.27748051285743713,
|
| 53 |
+
0.27665963768959045
|
| 54 |
+
],
|
| 55 |
+
"mean_rgb": [
|
| 56 |
+
0.6844472289085388,
|
| 57 |
+
0.6284617781639099,
|
| 58 |
+
0.5540845394134521,
|
| 59 |
+
0.49505874514579773,
|
| 60 |
+
0.4436206817626953,
|
| 61 |
+
0.41198185086250305,
|
| 62 |
+
0.4130478501319885,
|
| 63 |
+
0.41542676091194153,
|
| 64 |
+
0.406199187040329,
|
| 65 |
+
0.39254048466682434,
|
| 66 |
+
0.16926062107086182,
|
| 67 |
+
0.22599884867668152,
|
| 68 |
+
0.22546076774597168,
|
| 69 |
+
0.22791211307048798,
|
| 70 |
+
0.23338943719863892,
|
| 71 |
+
0.23143425583839417,
|
| 72 |
+
0.23280683159828186,
|
| 73 |
+
0.23524777591228485,
|
| 74 |
+
0.23973938822746277,
|
| 75 |
+
0.23811960220336914,
|
| 76 |
+
0.23764897882938385,
|
| 77 |
+
0.2369965761899948,
|
| 78 |
+
0.23754198849201202,
|
| 79 |
+
0.23855453729629517
|
| 80 |
+
]
|
| 81 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/complete.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"mode": "i2v_original", "cases": 2, "frames": 24}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/launcher.sh
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
#SBATCH --job-name=matrix-game2-diagnostic
|
| 3 |
+
#SBATCH --array=0-4
|
| 4 |
+
#SBATCH --nodes=1
|
| 5 |
+
#SBATCH --ntasks=1
|
| 6 |
+
#SBATCH --cpus-per-task=14
|
| 7 |
+
#SBATCH --gres=gpu:1
|
| 8 |
+
#SBATCH --time=01:00:00
|
| 9 |
+
#SBATCH --account=berzelius-2026-196
|
| 10 |
+
#SBATCH --chdir=/proj/cvl/users/x_fahkh2/worldmem-baseline-evals
|
| 11 |
+
#SBATCH --output=slurm_logs/%x-%A_%a.out
|
| 12 |
+
#SBATCH --error=slurm_logs/%x-%A_%a.out
|
| 13 |
+
set -euo pipefail
|
| 14 |
+
module load buildenv-gcccuda/12.9.1-gcc11
|
| 15 |
+
ROOT=/proj/cvl/users/x_fahkh2/worldmem-baseline-evals
|
| 16 |
+
PYTHON=/proj/cvl/users/x_fahkh2/envs/matrix-game2-eval/bin/python
|
| 17 |
+
DATA_ROOT=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft
|
| 18 |
+
MODES=(wan_oracle full_original full_weighted i2v_original i2v_weighted)
|
| 19 |
+
MODE=${MODES[$SLURM_ARRAY_TASK_ID]}
|
| 20 |
+
OUTPUT=$ROOT/Matrix-Game/Matrix-Game-2/outputs/diagnostic_${MODE}_job${SLURM_ARRAY_JOB_ID}_task${SLURM_ARRAY_TASK_ID}
|
| 21 |
+
export TMPDIR=$ROOT/cache
|
| 22 |
+
export TRITON_CACHE_DIR=$ROOT/cache
|
| 23 |
+
export HF_HOME=$ROOT/cache/huggingface
|
| 24 |
+
export TORCH_HOME=$ROOT/cache/torch
|
| 25 |
+
export XDG_CACHE_HOME=$ROOT/cache
|
| 26 |
+
export MPLCONFIGDIR=$ROOT/cache/matplotlib
|
| 27 |
+
export PYTHONNOUSERSITE=1 PYTHONUNBUFFERED=1 OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
|
| 28 |
+
export WANDB_MODE=disabled HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1
|
| 29 |
+
mkdir -p "$TMPDIR" "$OUTPUT"
|
| 30 |
+
"$PYTHON" "$ROOT/deployment/verify_node.py" --expected-gpus 1 --output "$OUTPUT"
|
| 31 |
+
cp "$0" "$OUTPUT/launcher.sh"
|
| 32 |
+
cp "$ROOT/deployment/diagnose_matrix_game2.py" "$OUTPUT/probe.py"
|
| 33 |
+
srun --ntasks=1 --gpus-per-task=1 --cpus-per-task=14 --cpu-bind=cores \
|
| 34 |
+
"$PYTHON" "$ROOT/deployment/diagnose_matrix_game2.py" \
|
| 35 |
+
--mode "$MODE" --data-root "$DATA_ROOT" --output "$OUTPUT"
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/manifest.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"diagnostic_only": true,
|
| 3 |
+
"mode": "i2v_original",
|
| 4 |
+
"checkpoint": "/proj/cvl/users/x_fahkh2/worldmem-baseline-evals/checkpoints/matrix-game2",
|
| 5 |
+
"weight_source": "released raw distilled",
|
| 6 |
+
"optimizer": null,
|
| 7 |
+
"lr": null,
|
| 8 |
+
"lora": null,
|
| 9 |
+
"activation_checkpointing": false,
|
| 10 |
+
"batch_size": 1,
|
| 11 |
+
"trainable_parameters": 0,
|
| 12 |
+
"denoising_steps": 3,
|
| 13 |
+
"shift": 5,
|
| 14 |
+
"local_attention_latents": 6,
|
| 15 |
+
"selector": "native sliding cache",
|
| 16 |
+
"reference": "raw RGB resized352x640, not benchmark Oasis references",
|
| 17 |
+
"targets": [
|
| 18 |
+
700,
|
| 19 |
+
724
|
| 20 |
+
],
|
| 21 |
+
"full_history": [
|
| 22 |
+
100,
|
| 23 |
+
700
|
| 24 |
+
],
|
| 25 |
+
"full_prefix_latents": 153,
|
| 26 |
+
"oracle": "9copies+RGB100:724 encodedonce;159latents; discard153latent prefix",
|
| 27 |
+
"i2v": {
|
| 28 |
+
"anchor": 699,
|
| 29 |
+
"decoded_slice": [
|
| 30 |
+
1,
|
| 31 |
+
25
|
| 32 |
+
],
|
| 33 |
+
"controls": [
|
| 34 |
+
700,
|
| 35 |
+
724
|
| 36 |
+
],
|
| 37 |
+
"right_noops": 9
|
| 38 |
+
},
|
| 39 |
+
"normalization_change": "weighted modes apply scales and accumulate RMS in fp32",
|
| 40 |
+
"cases": [
|
| 41 |
+
{
|
| 42 |
+
"index": "0",
|
| 43 |
+
"path": "test/val_plains/2/000034.mp4",
|
| 44 |
+
"seed": 42000000
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"index": "1",
|
| 48 |
+
"path": "test/val_desert/1/000029.mp4",
|
| 49 |
+
"seed": 42000001
|
| 50 |
+
}
|
| 51 |
+
],
|
| 52 |
+
"parameter_counts": {
|
| 53 |
+
"generator_total": 1619242304,
|
| 54 |
+
"generator_trainable": 0,
|
| 55 |
+
"vae_total": 126892531,
|
| 56 |
+
"clip_total": 1193014785
|
| 57 |
+
},
|
| 58 |
+
"action_norm_instances": 60
|
| 59 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/node.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"devices": [
|
| 3 |
+
"NVIDIA H200"
|
| 4 |
+
],
|
| 5 |
+
"torch": "2.7.0+cu126",
|
| 6 |
+
"slurm_job_id": "85092"
|
| 7 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original_job85088_task3/probe.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Frozen Matrix diagnostics; raw-RGB PSNR is separate from benchmark scoring."""
|
| 2 |
+
import argparse
|
| 3 |
+
import json
|
| 4 |
+
import sys
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import torch
|
| 7 |
+
import torch.nn.functional as F
|
| 8 |
+
from PIL import Image
|
| 9 |
+
|
| 10 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 11 |
+
sys.path[:0] = [str(ROOT / 'shared'), str(ROOT / 'Matrix-Game/Matrix-Game-2')]
|
| 12 |
+
from protocol import load_minecraft_case, select_cases
|
| 13 |
+
from worldmem_adapter import MatrixGameAdapter, map_actions
|
| 14 |
+
from demo_utils.constant import ZERO_VAE_CACHE
|
| 15 |
+
|
| 16 |
+
MODES = ['wan_oracle', 'full_original', 'full_weighted', 'i2v_original', 'i2v_weighted']
|
| 17 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 18 |
+
parser.add_argument('--mode', choices=MODES, required=True)
|
| 19 |
+
parser.add_argument('--data-root', type=Path, required=True)
|
| 20 |
+
parser.add_argument('--output', type=Path, required=True)
|
| 21 |
+
parser.add_argument('--dry-run', action='store_true')
|
| 22 |
+
|
| 23 |
+
def weighted_norm(self, x):
|
| 24 |
+
y = x.float()
|
| 25 |
+
return (y * torch.rsqrt(y.square().mean(-1, keepdim=True) + self.eps)).to(x.dtype) * self.weight
|
| 26 |
+
|
| 27 |
+
def save_result(output, name, prediction, reference):
|
| 28 |
+
prediction = prediction.float().cpu()
|
| 29 |
+
if prediction.shape != reference.shape or not torch.isfinite(prediction).all():
|
| 30 |
+
raise ValueError(f'Invalid Matrix prediction: {name}, shape={tuple(prediction.shape)}')
|
| 31 |
+
prediction = prediction.clamp(0, 1)
|
| 32 |
+
mse = (prediction - reference).square().mean((1, 2, 3))
|
| 33 |
+
report = {'case': name, 'raw_rgb_psnr': (-10 * mse.clamp_min(1e-12).log10()).tolist(),
|
| 34 |
+
'raw_rgb_mse': mse.tolist(), 'mean_rgb': prediction.mean((1, 2, 3)).tolist()}
|
| 35 |
+
(output / f'{name}.json').write_text(json.dumps(report, indent=2))
|
| 36 |
+
grid = torch.cat([torch.cat([v[t] for t in [0, 1, 2, 5, 11, 23]], dim=2)
|
| 37 |
+
for v in (reference, prediction)], dim=1)
|
| 38 |
+
Image.fromarray(grid.mul(255).byte().permute(1, 2, 0).numpy()).save(output / f'{name}.jpg')
|
| 39 |
+
print(json.dumps({'case': name, 'mean_psnr': sum(report['raw_rgb_psnr']) / 24,
|
| 40 |
+
'first_psnr': report['raw_rgb_psnr'][:3]}), flush=True)
|
| 41 |
+
|
| 42 |
+
@torch.inference_mode()
|
| 43 |
+
def main():
|
| 44 |
+
args = parser.parse_args()
|
| 45 |
+
rows = select_cases(ROOT / 'deployment/manifests/minecraft_test_300.csv', limit=2)
|
| 46 |
+
checkpoint = ROOT / 'checkpoints/matrix-game2'
|
| 47 |
+
manifest = {'diagnostic_only': True, 'mode': args.mode, 'checkpoint': str(checkpoint),
|
| 48 |
+
'weight_source': 'released raw distilled', 'optimizer': None, 'lr': None, 'lora': None,
|
| 49 |
+
'activation_checkpointing': False, 'batch_size': 1, 'trainable_parameters': 0,
|
| 50 |
+
'denoising_steps': 3, 'shift': 5, 'local_attention_latents': 6,
|
| 51 |
+
'selector': 'native sliding cache', 'reference': 'raw RGB resized352x640, not benchmark Oasis references',
|
| 52 |
+
'targets': [700, 724], 'full_history': [100, 700], 'full_prefix_latents': 153,
|
| 53 |
+
'oracle': '9copies+RGB100:724 encodedonce;159latents; discard153latent prefix',
|
| 54 |
+
'i2v': {'anchor': 699, 'decoded_slice': [1, 25], 'controls': [700, 724], 'right_noops': 9},
|
| 55 |
+
'normalization_change': 'weighted modes apply scales and accumulate RMS in fp32',
|
| 56 |
+
'cases': [{'index': r['global_test_index'], 'path': r['relative_path'],
|
| 57 |
+
'seed': 42000000 + int(r['global_test_index'])} for r in rows]}
|
| 58 |
+
if args.dry_run:
|
| 59 |
+
print(json.dumps(manifest, indent=2))
|
| 60 |
+
return
|
| 61 |
+
args.output.mkdir(parents=True, exist_ok=True)
|
| 62 |
+
(args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
|
| 63 |
+
from wan.modules.action_module import WanRMSNorm
|
| 64 |
+
adapter = MatrixGameAdapter(checkpoint)
|
| 65 |
+
manifest['parameter_counts'] = adapter.parameter_counts
|
| 66 |
+
manifest['action_norm_instances'] = sum(isinstance(m, WanRMSNorm) for m in adapter.pipeline.modules())
|
| 67 |
+
(args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
|
| 68 |
+
if args.mode.endswith('weighted'):
|
| 69 |
+
WanRMSNorm.forward = weighted_norm
|
| 70 |
+
for row in rows:
|
| 71 |
+
row.update(target_end='724', target_frames='24')
|
| 72 |
+
case = load_minecraft_case(row, args.data_root)
|
| 73 |
+
reference = F.interpolate(case['rgb'][600:624], (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 74 |
+
seed = 42000000 + int(row['global_test_index'])
|
| 75 |
+
if args.mode == 'wan_oracle':
|
| 76 |
+
rgb = F.interpolate(case['rgb'].cuda(), (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 77 |
+
rgb = torch.cat([rgb[:1].expand(9, -1, -1, -1), rgb])
|
| 78 |
+
latent = adapter.vae.encode(rgb.transpose(0, 1)[None].mul(2).sub(1).bfloat16(), device=adapter.device, tiled=False)
|
| 79 |
+
cache, chunks = [None] * len(ZERO_VAE_CACHE), []
|
| 80 |
+
for start in range(0, latent.shape[2], 3):
|
| 81 |
+
decoded, cache = adapter.pipeline.vae_decoder(latent[:, :, start:start + 3].transpose(1, 2).half(), *cache)
|
| 82 |
+
if start >= 153:
|
| 83 |
+
chunks.append(decoded.cpu())
|
| 84 |
+
prediction = torch.cat(chunks, dim=1)[0].float().add(1).div(2)
|
| 85 |
+
del latent, rgb, cache, decoded, chunks
|
| 86 |
+
elif args.mode.startswith('full'):
|
| 87 |
+
prediction, _ = adapter.generate(case, target_frames=24, seed=seed)
|
| 88 |
+
else:
|
| 89 |
+
torch.manual_seed(seed)
|
| 90 |
+
torch.cuda.manual_seed_all(seed)
|
| 91 |
+
anchor = F.interpolate(case['rgb'][599:600].cuda(), (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 92 |
+
anchor = anchor.transpose(0, 1)[None].mul(2).sub(1).bfloat16()
|
| 93 |
+
image = anchor.new_zeros((1, 3, 33, 352, 640))
|
| 94 |
+
image[:, :, :1] = anchor
|
| 95 |
+
image_latents = adapter.vae.encode(image, device=adapter.device, tiled=False)
|
| 96 |
+
mask = torch.zeros_like(image_latents[:, :4])
|
| 97 |
+
mask[:, :, :1] = 1
|
| 98 |
+
actions = torch.cat([case['actions'][600:624], torch.zeros(9, 25)]).cuda().bfloat16()
|
| 99 |
+
keyboard, mouse = map_actions(actions, 1.0)
|
| 100 |
+
condition = {'cond_concat': torch.cat([mask, image_latents], dim=1),
|
| 101 |
+
'visual_context': adapter.vae.clip.encode_video(anchor).bfloat16(),
|
| 102 |
+
'keyboard_cond': keyboard[None], 'mouse_cond': mouse[None]}
|
| 103 |
+
noise = torch.randn((1, 16, 9, 44, 80), device='cuda', dtype=torch.bfloat16)
|
| 104 |
+
videos = adapter.pipeline.inference(noise, condition, initial_latent=None, mode='universal')
|
| 105 |
+
prediction = torch.cat(videos, dim=1)[0, 1:25].float().add(1).div(2)
|
| 106 |
+
del image, anchor, image_latents, condition, videos, noise
|
| 107 |
+
save_result(args.output, f"case{row['global_test_index']}_{args.mode}", prediction, reference)
|
| 108 |
+
del prediction, reference, case
|
| 109 |
+
(args.output / 'complete.json').write_text(json.dumps({'mode': args.mode, 'cases': 2, 'frames': 24}))
|
| 110 |
+
print('DIAGNOSTICS_COMPLETE', flush=True)
|
| 111 |
+
|
| 112 |
+
if __name__ == '__main__':
|
| 113 |
+
main()
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/case0_i2v_weighted.jpg
ADDED
|
Git LFS Details
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/case0_i2v_weighted.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"case": "case0_i2v_weighted",
|
| 3 |
+
"raw_rgb_psnr": [
|
| 4 |
+
28.400230407714844,
|
| 5 |
+
5.406888008117676,
|
| 6 |
+
6.059108257293701,
|
| 7 |
+
7.271352767944336,
|
| 8 |
+
7.498164653778076,
|
| 9 |
+
7.74724006652832,
|
| 10 |
+
7.7596211433410645,
|
| 11 |
+
7.7729315757751465,
|
| 12 |
+
7.52515983581543,
|
| 13 |
+
7.486701488494873,
|
| 14 |
+
7.524697303771973,
|
| 15 |
+
7.638741493225098,
|
| 16 |
+
7.781850814819336,
|
| 17 |
+
7.818033695220947,
|
| 18 |
+
7.900123119354248,
|
| 19 |
+
7.916782379150391,
|
| 20 |
+
7.866796493530273,
|
| 21 |
+
7.875070095062256,
|
| 22 |
+
7.894111633300781,
|
| 23 |
+
7.932208061218262,
|
| 24 |
+
7.702528953552246,
|
| 25 |
+
7.582130432128906,
|
| 26 |
+
7.766695976257324,
|
| 27 |
+
7.993913650512695
|
| 28 |
+
],
|
| 29 |
+
"raw_rgb_mse": [
|
| 30 |
+
0.0014453631592914462,
|
| 31 |
+
0.28794607520103455,
|
| 32 |
+
0.2477930635213852,
|
| 33 |
+
0.18744103610515594,
|
| 34 |
+
0.17790310084819794,
|
| 35 |
+
0.16798712313175201,
|
| 36 |
+
0.16750890016555786,
|
| 37 |
+
0.1669963002204895,
|
| 38 |
+
0.17680072784423828,
|
| 39 |
+
0.1783733069896698,
|
| 40 |
+
0.1768195480108261,
|
| 41 |
+
0.17223675549030304,
|
| 42 |
+
0.16665369272232056,
|
| 43 |
+
0.16527098417282104,
|
| 44 |
+
0.16217641532421112,
|
| 45 |
+
0.16155549883842468,
|
| 46 |
+
0.16342569887638092,
|
| 47 |
+
0.16311465203762054,
|
| 48 |
+
0.16240103542804718,
|
| 49 |
+
0.16098269820213318,
|
| 50 |
+
0.16972550749778748,
|
| 51 |
+
0.1744966059923172,
|
| 52 |
+
0.16723622381687164,
|
| 53 |
+
0.15871158242225647
|
| 54 |
+
],
|
| 55 |
+
"mean_rgb": [
|
| 56 |
+
0.7053292989730835,
|
| 57 |
+
0.20904700458049774,
|
| 58 |
+
0.2530539929866791,
|
| 59 |
+
0.3162554204463959,
|
| 60 |
+
0.3277013599872589,
|
| 61 |
+
0.33897286653518677,
|
| 62 |
+
0.3385704457759857,
|
| 63 |
+
0.3386596143245697,
|
| 64 |
+
0.32705172896385193,
|
| 65 |
+
0.3246579170227051,
|
| 66 |
+
0.32665011286735535,
|
| 67 |
+
0.33084917068481445,
|
| 68 |
+
0.33509644865989685,
|
| 69 |
+
0.335825651884079,
|
| 70 |
+
0.34004831314086914,
|
| 71 |
+
0.34061479568481445,
|
| 72 |
+
0.338895708322525,
|
| 73 |
+
0.339072585105896,
|
| 74 |
+
0.33963221311569214,
|
| 75 |
+
0.3410741984844208,
|
| 76 |
+
0.3300783038139343,
|
| 77 |
+
0.32414621114730835,
|
| 78 |
+
0.33280378580093384,
|
| 79 |
+
0.3427526652812958
|
| 80 |
+
]
|
| 81 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/case1_i2v_weighted.jpg
ADDED
|
Git LFS Details
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/case1_i2v_weighted.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"case": "case1_i2v_weighted",
|
| 3 |
+
"raw_rgb_psnr": [
|
| 4 |
+
15.572078704833984,
|
| 5 |
+
11.67737865447998,
|
| 6 |
+
9.182900428771973,
|
| 7 |
+
7.9456071853637695,
|
| 8 |
+
6.916970729827881,
|
| 9 |
+
6.555791854858398,
|
| 10 |
+
6.522993564605713,
|
| 11 |
+
6.507280349731445,
|
| 12 |
+
6.314092636108398,
|
| 13 |
+
6.2913408279418945,
|
| 14 |
+
6.392267227172852,
|
| 15 |
+
6.423827171325684,
|
| 16 |
+
6.575774669647217,
|
| 17 |
+
4.436397075653076,
|
| 18 |
+
4.66413688659668,
|
| 19 |
+
4.843669414520264,
|
| 20 |
+
4.8888068199157715,
|
| 21 |
+
4.991722106933594,
|
| 22 |
+
5.058438301086426,
|
| 23 |
+
5.032224178314209,
|
| 24 |
+
5.076114654541016,
|
| 25 |
+
5.092604637145996,
|
| 26 |
+
5.115626335144043,
|
| 27 |
+
5.137517929077148
|
| 28 |
+
],
|
| 29 |
+
"raw_rgb_mse": [
|
| 30 |
+
0.027719931676983833,
|
| 31 |
+
0.06796137243509293,
|
| 32 |
+
0.12070075422525406,
|
| 33 |
+
0.16048678755760193,
|
| 34 |
+
0.20337752997875214,
|
| 35 |
+
0.22101451456546783,
|
| 36 |
+
0.22268995642662048,
|
| 37 |
+
0.22349712252616882,
|
| 38 |
+
0.2336634248495102,
|
| 39 |
+
0.23489077389240265,
|
| 40 |
+
0.22949503362178802,
|
| 41 |
+
0.2278333306312561,
|
| 42 |
+
0.21999992430210114,
|
| 43 |
+
0.3600479066371918,
|
| 44 |
+
0.34165385365486145,
|
| 45 |
+
0.32781821489334106,
|
| 46 |
+
0.3244287371635437,
|
| 47 |
+
0.3168310821056366,
|
| 48 |
+
0.31200113892555237,
|
| 49 |
+
0.31389009952545166,
|
| 50 |
+
0.3107338547706604,
|
| 51 |
+
0.3095562160015106,
|
| 52 |
+
0.30791962146759033,
|
| 53 |
+
0.3063713610172272
|
| 54 |
+
],
|
| 55 |
+
"mean_rgb": [
|
| 56 |
+
0.6906836032867432,
|
| 57 |
+
0.6348850727081299,
|
| 58 |
+
0.5620357394218445,
|
| 59 |
+
0.5025600790977478,
|
| 60 |
+
0.4471380114555359,
|
| 61 |
+
0.41820263862609863,
|
| 62 |
+
0.4126875400543213,
|
| 63 |
+
0.41116610169410706,
|
| 64 |
+
0.3962208926677704,
|
| 65 |
+
0.3935016095638275,
|
| 66 |
+
0.3975541591644287,
|
| 67 |
+
0.39638906717300415,
|
| 68 |
+
0.40340858697891235,
|
| 69 |
+
0.16516827046871185,
|
| 70 |
+
0.18019184470176697,
|
| 71 |
+
0.19274631142616272,
|
| 72 |
+
0.1964321732521057,
|
| 73 |
+
0.20392490923404694,
|
| 74 |
+
0.20804454386234283,
|
| 75 |
+
0.2059834748506546,
|
| 76 |
+
0.20835448801517487,
|
| 77 |
+
0.20949353277683258,
|
| 78 |
+
0.21102812886238098,
|
| 79 |
+
0.2126505970954895
|
| 80 |
+
]
|
| 81 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/complete.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"mode": "i2v_weighted", "cases": 2, "frames": 24}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/launcher.sh
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
#SBATCH --job-name=matrix-game2-diagnostic
|
| 3 |
+
#SBATCH --array=0-4
|
| 4 |
+
#SBATCH --nodes=1
|
| 5 |
+
#SBATCH --ntasks=1
|
| 6 |
+
#SBATCH --cpus-per-task=14
|
| 7 |
+
#SBATCH --gres=gpu:1
|
| 8 |
+
#SBATCH --time=01:00:00
|
| 9 |
+
#SBATCH --account=berzelius-2026-196
|
| 10 |
+
#SBATCH --chdir=/proj/cvl/users/x_fahkh2/worldmem-baseline-evals
|
| 11 |
+
#SBATCH --output=slurm_logs/%x-%A_%a.out
|
| 12 |
+
#SBATCH --error=slurm_logs/%x-%A_%a.out
|
| 13 |
+
set -euo pipefail
|
| 14 |
+
module load buildenv-gcccuda/12.9.1-gcc11
|
| 15 |
+
ROOT=/proj/cvl/users/x_fahkh2/worldmem-baseline-evals
|
| 16 |
+
PYTHON=/proj/cvl/users/x_fahkh2/envs/matrix-game2-eval/bin/python
|
| 17 |
+
DATA_ROOT=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft
|
| 18 |
+
MODES=(wan_oracle full_original full_weighted i2v_original i2v_weighted)
|
| 19 |
+
MODE=${MODES[$SLURM_ARRAY_TASK_ID]}
|
| 20 |
+
OUTPUT=$ROOT/Matrix-Game/Matrix-Game-2/outputs/diagnostic_${MODE}_job${SLURM_ARRAY_JOB_ID}_task${SLURM_ARRAY_TASK_ID}
|
| 21 |
+
export TMPDIR=$ROOT/cache
|
| 22 |
+
export TRITON_CACHE_DIR=$ROOT/cache
|
| 23 |
+
export HF_HOME=$ROOT/cache/huggingface
|
| 24 |
+
export TORCH_HOME=$ROOT/cache/torch
|
| 25 |
+
export XDG_CACHE_HOME=$ROOT/cache
|
| 26 |
+
export MPLCONFIGDIR=$ROOT/cache/matplotlib
|
| 27 |
+
export PYTHONNOUSERSITE=1 PYTHONUNBUFFERED=1 OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
|
| 28 |
+
export WANDB_MODE=disabled HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1
|
| 29 |
+
mkdir -p "$TMPDIR" "$OUTPUT"
|
| 30 |
+
"$PYTHON" "$ROOT/deployment/verify_node.py" --expected-gpus 1 --output "$OUTPUT"
|
| 31 |
+
cp "$0" "$OUTPUT/launcher.sh"
|
| 32 |
+
cp "$ROOT/deployment/diagnose_matrix_game2.py" "$OUTPUT/probe.py"
|
| 33 |
+
srun --ntasks=1 --gpus-per-task=1 --cpus-per-task=14 --cpu-bind=cores \
|
| 34 |
+
"$PYTHON" "$ROOT/deployment/diagnose_matrix_game2.py" \
|
| 35 |
+
--mode "$MODE" --data-root "$DATA_ROOT" --output "$OUTPUT"
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/manifest.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"diagnostic_only": true,
|
| 3 |
+
"mode": "i2v_weighted",
|
| 4 |
+
"checkpoint": "/proj/cvl/users/x_fahkh2/worldmem-baseline-evals/checkpoints/matrix-game2",
|
| 5 |
+
"weight_source": "released raw distilled",
|
| 6 |
+
"optimizer": null,
|
| 7 |
+
"lr": null,
|
| 8 |
+
"lora": null,
|
| 9 |
+
"activation_checkpointing": false,
|
| 10 |
+
"batch_size": 1,
|
| 11 |
+
"trainable_parameters": 0,
|
| 12 |
+
"denoising_steps": 3,
|
| 13 |
+
"shift": 5,
|
| 14 |
+
"local_attention_latents": 6,
|
| 15 |
+
"selector": "native sliding cache",
|
| 16 |
+
"reference": "raw RGB resized352x640, not benchmark Oasis references",
|
| 17 |
+
"targets": [
|
| 18 |
+
700,
|
| 19 |
+
724
|
| 20 |
+
],
|
| 21 |
+
"full_history": [
|
| 22 |
+
100,
|
| 23 |
+
700
|
| 24 |
+
],
|
| 25 |
+
"full_prefix_latents": 153,
|
| 26 |
+
"oracle": "9copies+RGB100:724 encodedonce;159latents; discard153latent prefix",
|
| 27 |
+
"i2v": {
|
| 28 |
+
"anchor": 699,
|
| 29 |
+
"decoded_slice": [
|
| 30 |
+
1,
|
| 31 |
+
25
|
| 32 |
+
],
|
| 33 |
+
"controls": [
|
| 34 |
+
700,
|
| 35 |
+
724
|
| 36 |
+
],
|
| 37 |
+
"right_noops": 9
|
| 38 |
+
},
|
| 39 |
+
"normalization_change": "weighted modes apply scales and accumulate RMS in fp32",
|
| 40 |
+
"cases": [
|
| 41 |
+
{
|
| 42 |
+
"index": "0",
|
| 43 |
+
"path": "test/val_plains/2/000034.mp4",
|
| 44 |
+
"seed": 42000000
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"index": "1",
|
| 48 |
+
"path": "test/val_desert/1/000029.mp4",
|
| 49 |
+
"seed": 42000001
|
| 50 |
+
}
|
| 51 |
+
],
|
| 52 |
+
"parameter_counts": {
|
| 53 |
+
"generator_total": 1619242304,
|
| 54 |
+
"generator_trainable": 0,
|
| 55 |
+
"vae_total": 126892531,
|
| 56 |
+
"clip_total": 1193014785
|
| 57 |
+
},
|
| 58 |
+
"action_norm_instances": 60
|
| 59 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/node.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"devices": [
|
| 3 |
+
"NVIDIA H200"
|
| 4 |
+
],
|
| 5 |
+
"torch": "2.7.0+cu126",
|
| 6 |
+
"slurm_job_id": "85088"
|
| 7 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_weighted_job85088_task4/probe.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Frozen Matrix diagnostics; raw-RGB PSNR is separate from benchmark scoring."""
|
| 2 |
+
import argparse
|
| 3 |
+
import json
|
| 4 |
+
import sys
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import torch
|
| 7 |
+
import torch.nn.functional as F
|
| 8 |
+
from PIL import Image
|
| 9 |
+
|
| 10 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 11 |
+
sys.path[:0] = [str(ROOT / 'shared'), str(ROOT / 'Matrix-Game/Matrix-Game-2')]
|
| 12 |
+
from protocol import load_minecraft_case, select_cases
|
| 13 |
+
from worldmem_adapter import MatrixGameAdapter, map_actions
|
| 14 |
+
from demo_utils.constant import ZERO_VAE_CACHE
|
| 15 |
+
|
| 16 |
+
MODES = ['wan_oracle', 'full_original', 'full_weighted', 'i2v_original', 'i2v_weighted']
|
| 17 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 18 |
+
parser.add_argument('--mode', choices=MODES, required=True)
|
| 19 |
+
parser.add_argument('--data-root', type=Path, required=True)
|
| 20 |
+
parser.add_argument('--output', type=Path, required=True)
|
| 21 |
+
parser.add_argument('--dry-run', action='store_true')
|
| 22 |
+
|
| 23 |
+
def weighted_norm(self, x):
|
| 24 |
+
y = x.float()
|
| 25 |
+
return (y * torch.rsqrt(y.square().mean(-1, keepdim=True) + self.eps)).to(x.dtype) * self.weight
|
| 26 |
+
|
| 27 |
+
def save_result(output, name, prediction, reference):
|
| 28 |
+
prediction = prediction.float().cpu()
|
| 29 |
+
if prediction.shape != reference.shape or not torch.isfinite(prediction).all():
|
| 30 |
+
raise ValueError(f'Invalid Matrix prediction: {name}, shape={tuple(prediction.shape)}')
|
| 31 |
+
prediction = prediction.clamp(0, 1)
|
| 32 |
+
mse = (prediction - reference).square().mean((1, 2, 3))
|
| 33 |
+
report = {'case': name, 'raw_rgb_psnr': (-10 * mse.clamp_min(1e-12).log10()).tolist(),
|
| 34 |
+
'raw_rgb_mse': mse.tolist(), 'mean_rgb': prediction.mean((1, 2, 3)).tolist()}
|
| 35 |
+
(output / f'{name}.json').write_text(json.dumps(report, indent=2))
|
| 36 |
+
grid = torch.cat([torch.cat([v[t] for t in [0, 1, 2, 5, 11, 23]], dim=2)
|
| 37 |
+
for v in (reference, prediction)], dim=1)
|
| 38 |
+
Image.fromarray(grid.mul(255).byte().permute(1, 2, 0).numpy()).save(output / f'{name}.jpg')
|
| 39 |
+
print(json.dumps({'case': name, 'mean_psnr': sum(report['raw_rgb_psnr']) / 24,
|
| 40 |
+
'first_psnr': report['raw_rgb_psnr'][:3]}), flush=True)
|
| 41 |
+
|
| 42 |
+
@torch.inference_mode()
|
| 43 |
+
def main():
|
| 44 |
+
args = parser.parse_args()
|
| 45 |
+
rows = select_cases(ROOT / 'deployment/manifests/minecraft_test_300.csv', limit=2)
|
| 46 |
+
checkpoint = ROOT / 'checkpoints/matrix-game2'
|
| 47 |
+
manifest = {'diagnostic_only': True, 'mode': args.mode, 'checkpoint': str(checkpoint),
|
| 48 |
+
'weight_source': 'released raw distilled', 'optimizer': None, 'lr': None, 'lora': None,
|
| 49 |
+
'activation_checkpointing': False, 'batch_size': 1, 'trainable_parameters': 0,
|
| 50 |
+
'denoising_steps': 3, 'shift': 5, 'local_attention_latents': 6,
|
| 51 |
+
'selector': 'native sliding cache', 'reference': 'raw RGB resized352x640, not benchmark Oasis references',
|
| 52 |
+
'targets': [700, 724], 'full_history': [100, 700], 'full_prefix_latents': 153,
|
| 53 |
+
'oracle': '9copies+RGB100:724 encodedonce;159latents; discard153latent prefix',
|
| 54 |
+
'i2v': {'anchor': 699, 'decoded_slice': [1, 25], 'controls': [700, 724], 'right_noops': 9},
|
| 55 |
+
'normalization_change': 'weighted modes apply scales and accumulate RMS in fp32',
|
| 56 |
+
'cases': [{'index': r['global_test_index'], 'path': r['relative_path'],
|
| 57 |
+
'seed': 42000000 + int(r['global_test_index'])} for r in rows]}
|
| 58 |
+
if args.dry_run:
|
| 59 |
+
print(json.dumps(manifest, indent=2))
|
| 60 |
+
return
|
| 61 |
+
args.output.mkdir(parents=True, exist_ok=True)
|
| 62 |
+
(args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
|
| 63 |
+
from wan.modules.action_module import WanRMSNorm
|
| 64 |
+
adapter = MatrixGameAdapter(checkpoint)
|
| 65 |
+
manifest['parameter_counts'] = adapter.parameter_counts
|
| 66 |
+
manifest['action_norm_instances'] = sum(isinstance(m, WanRMSNorm) for m in adapter.pipeline.modules())
|
| 67 |
+
(args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
|
| 68 |
+
if args.mode.endswith('weighted'):
|
| 69 |
+
WanRMSNorm.forward = weighted_norm
|
| 70 |
+
for row in rows:
|
| 71 |
+
row.update(target_end='724', target_frames='24')
|
| 72 |
+
case = load_minecraft_case(row, args.data_root)
|
| 73 |
+
reference = F.interpolate(case['rgb'][600:624], (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 74 |
+
seed = 42000000 + int(row['global_test_index'])
|
| 75 |
+
if args.mode == 'wan_oracle':
|
| 76 |
+
rgb = F.interpolate(case['rgb'].cuda(), (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 77 |
+
rgb = torch.cat([rgb[:1].expand(9, -1, -1, -1), rgb])
|
| 78 |
+
latent = adapter.vae.encode(rgb.transpose(0, 1)[None].mul(2).sub(1).bfloat16(), device=adapter.device, tiled=False)
|
| 79 |
+
cache, chunks = [None] * len(ZERO_VAE_CACHE), []
|
| 80 |
+
for start in range(0, latent.shape[2], 3):
|
| 81 |
+
decoded, cache = adapter.pipeline.vae_decoder(latent[:, :, start:start + 3].transpose(1, 2).half(), *cache)
|
| 82 |
+
if start >= 153:
|
| 83 |
+
chunks.append(decoded.cpu())
|
| 84 |
+
prediction = torch.cat(chunks, dim=1)[0].float().add(1).div(2)
|
| 85 |
+
del latent, rgb, cache, decoded, chunks
|
| 86 |
+
elif args.mode.startswith('full'):
|
| 87 |
+
prediction, _ = adapter.generate(case, target_frames=24, seed=seed)
|
| 88 |
+
else:
|
| 89 |
+
torch.manual_seed(seed)
|
| 90 |
+
torch.cuda.manual_seed_all(seed)
|
| 91 |
+
anchor = F.interpolate(case['rgb'][599:600].cuda(), (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 92 |
+
anchor = anchor.transpose(0, 1)[None].mul(2).sub(1).bfloat16()
|
| 93 |
+
image = anchor.new_zeros((1, 3, 33, 352, 640))
|
| 94 |
+
image[:, :, :1] = anchor
|
| 95 |
+
image_latents = adapter.vae.encode(image, device=adapter.device, tiled=False)
|
| 96 |
+
mask = torch.zeros_like(image_latents[:, :4])
|
| 97 |
+
mask[:, :, :1] = 1
|
| 98 |
+
actions = torch.cat([case['actions'][600:624], torch.zeros(9, 25)]).cuda().bfloat16()
|
| 99 |
+
keyboard, mouse = map_actions(actions, 1.0)
|
| 100 |
+
condition = {'cond_concat': torch.cat([mask, image_latents], dim=1),
|
| 101 |
+
'visual_context': adapter.vae.clip.encode_video(anchor).bfloat16(),
|
| 102 |
+
'keyboard_cond': keyboard[None], 'mouse_cond': mouse[None]}
|
| 103 |
+
noise = torch.randn((1, 16, 9, 44, 80), device='cuda', dtype=torch.bfloat16)
|
| 104 |
+
videos = adapter.pipeline.inference(noise, condition, initial_latent=None, mode='universal')
|
| 105 |
+
prediction = torch.cat(videos, dim=1)[0, 1:25].float().add(1).div(2)
|
| 106 |
+
del image, anchor, image_latents, condition, videos, noise
|
| 107 |
+
save_result(args.output, f"case{row['global_test_index']}_{args.mode}", prediction, reference)
|
| 108 |
+
del prediction, reference, case
|
| 109 |
+
(args.output / 'complete.json').write_text(json.dumps({'mode': args.mode, 'cases': 2, 'frames': 24}))
|
| 110 |
+
print('DIAGNOSTICS_COMPLETE', flush=True)
|
| 111 |
+
|
| 112 |
+
if __name__ == '__main__':
|
| 113 |
+
main()
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/case0_wan_oracle.jpg
ADDED
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/case0_wan_oracle.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"case": "case0_wan_oracle",
|
| 3 |
+
"raw_rgb_psnr": [
|
| 4 |
+
34.50311279296875,
|
| 5 |
+
34.654510498046875,
|
| 6 |
+
34.57817459106445,
|
| 7 |
+
34.601837158203125,
|
| 8 |
+
34.46246337890625,
|
| 9 |
+
34.741241455078125,
|
| 10 |
+
34.625450134277344,
|
| 11 |
+
34.658409118652344,
|
| 12 |
+
34.566619873046875,
|
| 13 |
+
34.880271911621094,
|
| 14 |
+
34.68211364746094,
|
| 15 |
+
34.755611419677734,
|
| 16 |
+
34.450016021728516,
|
| 17 |
+
34.66584777832031,
|
| 18 |
+
34.53730773925781,
|
| 19 |
+
34.55168533325195,
|
| 20 |
+
34.38592529296875,
|
| 21 |
+
34.73810577392578,
|
| 22 |
+
34.56845474243164,
|
| 23 |
+
34.62205123901367,
|
| 24 |
+
34.4306755065918,
|
| 25 |
+
34.77874755859375,
|
| 26 |
+
34.602718353271484,
|
| 27 |
+
34.67219924926758
|
| 28 |
+
],
|
| 29 |
+
"raw_rgb_mse": [
|
| 30 |
+
0.00035455895704217255,
|
| 31 |
+
0.00034241206594742835,
|
| 32 |
+
0.00034848388168029487,
|
| 33 |
+
0.0003465902991592884,
|
| 34 |
+
0.00035789355752058327,
|
| 35 |
+
0.00033564178738743067,
|
| 36 |
+
0.00034471091930754483,
|
| 37 |
+
0.000342104904120788,
|
| 38 |
+
0.00034941223566420376,
|
| 39 |
+
0.0003250669687986374,
|
| 40 |
+
0.00034024243359453976,
|
| 41 |
+
0.00033453290234319866,
|
| 42 |
+
0.00035892060259357095,
|
| 43 |
+
0.00034151942236348987,
|
| 44 |
+
0.0003517784643918276,
|
| 45 |
+
0.00035061591188423336,
|
| 46 |
+
0.0003642567025963217,
|
| 47 |
+
0.0003358841931913048,
|
| 48 |
+
0.00034926453372463584,
|
| 49 |
+
0.0003449807409197092,
|
| 50 |
+
0.0003605225356295705,
|
| 51 |
+
0.0003327555605210364,
|
| 52 |
+
0.00034651983878575265,
|
| 53 |
+
0.00034102011704817414
|
| 54 |
+
],
|
| 55 |
+
"mean_rgb": [
|
| 56 |
+
0.7217753529548645,
|
| 57 |
+
0.7219029068946838,
|
| 58 |
+
0.7213197946548462,
|
| 59 |
+
0.7208141684532166,
|
| 60 |
+
0.7212034463882446,
|
| 61 |
+
0.7211069464683533,
|
| 62 |
+
0.7204988598823547,
|
| 63 |
+
0.7204425930976868,
|
| 64 |
+
0.7205440998077393,
|
| 65 |
+
0.7204944491386414,
|
| 66 |
+
0.7203000783920288,
|
| 67 |
+
0.7199990153312683,
|
| 68 |
+
0.7209401726722717,
|
| 69 |
+
0.7213990092277527,
|
| 70 |
+
0.7206678986549377,
|
| 71 |
+
0.7205467820167542,
|
| 72 |
+
0.7213102579116821,
|
| 73 |
+
0.7215085625648499,
|
| 74 |
+
0.7212632894515991,
|
| 75 |
+
0.7209525108337402,
|
| 76 |
+
0.7212324142456055,
|
| 77 |
+
0.7212611436843872,
|
| 78 |
+
0.7209208607673645,
|
| 79 |
+
0.7207081317901611
|
| 80 |
+
]
|
| 81 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/case1_wan_oracle.jpg
ADDED
|
Git LFS Details
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/case1_wan_oracle.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"case": "case1_wan_oracle",
|
| 3 |
+
"raw_rgb_psnr": [
|
| 4 |
+
31.08868408203125,
|
| 5 |
+
30.543432235717773,
|
| 6 |
+
31.288101196289062,
|
| 7 |
+
30.8697509765625,
|
| 8 |
+
30.309547424316406,
|
| 9 |
+
31.53420639038086,
|
| 10 |
+
32.109039306640625,
|
| 11 |
+
31.969955444335938,
|
| 12 |
+
32.03971862792969,
|
| 13 |
+
32.365684509277344,
|
| 14 |
+
33.04118347167969,
|
| 15 |
+
32.62156677246094,
|
| 16 |
+
32.28874588012695,
|
| 17 |
+
32.467716217041016,
|
| 18 |
+
33.07372283935547,
|
| 19 |
+
32.700599670410156,
|
| 20 |
+
32.59062194824219,
|
| 21 |
+
32.697750091552734,
|
| 22 |
+
33.1352653503418,
|
| 23 |
+
32.91297912597656,
|
| 24 |
+
32.108211517333984,
|
| 25 |
+
32.93695068359375,
|
| 26 |
+
32.958858489990234,
|
| 27 |
+
32.73663330078125
|
| 28 |
+
],
|
| 29 |
+
"raw_rgb_mse": [
|
| 30 |
+
0.0007782725733704865,
|
| 31 |
+
0.0008823824464343488,
|
| 32 |
+
0.0007433437858708203,
|
| 33 |
+
0.0008185115875676274,
|
| 34 |
+
0.0009312047041021287,
|
| 35 |
+
0.0007023914949968457,
|
| 36 |
+
0.0006153129506856203,
|
| 37 |
+
0.0006353375501930714,
|
| 38 |
+
0.0006252131424844265,
|
| 39 |
+
0.000580004823859781,
|
| 40 |
+
0.0004964572144672275,
|
| 41 |
+
0.0005468189483508468,
|
| 42 |
+
0.000590371317230165,
|
| 43 |
+
0.0005665370845235884,
|
| 44 |
+
0.0004927514819428325,
|
| 45 |
+
0.0005369579303078353,
|
| 46 |
+
0.0005507288151420653,
|
| 47 |
+
0.0005373102030716836,
|
| 48 |
+
0.0004858178144786507,
|
| 49 |
+
0.0005113309598527849,
|
| 50 |
+
0.0006154304137453437,
|
| 51 |
+
0.0005085160955786705,
|
| 52 |
+
0.0005059578106738627,
|
| 53 |
+
0.000532520585693419
|
| 54 |
+
],
|
| 55 |
+
"mean_rgb": [
|
| 56 |
+
0.7130449414253235,
|
| 57 |
+
0.7113716006278992,
|
| 58 |
+
0.7166961431503296,
|
| 59 |
+
0.7147504687309265,
|
| 60 |
+
0.722019374370575,
|
| 61 |
+
0.7232353687286377,
|
| 62 |
+
0.7230417132377625,
|
| 63 |
+
0.722819983959198,
|
| 64 |
+
0.7228452563285828,
|
| 65 |
+
0.7228851914405823,
|
| 66 |
+
0.7225772738456726,
|
| 67 |
+
0.7221559286117554,
|
| 68 |
+
0.7226071953773499,
|
| 69 |
+
0.7228122353553772,
|
| 70 |
+
0.7235471606254578,
|
| 71 |
+
0.723677396774292,
|
| 72 |
+
0.7240967750549316,
|
| 73 |
+
0.7239828109741211,
|
| 74 |
+
0.7240568399429321,
|
| 75 |
+
0.7238571047782898,
|
| 76 |
+
0.7236796021461487,
|
| 77 |
+
0.7233341336250305,
|
| 78 |
+
0.7234703302383423,
|
| 79 |
+
0.7233763933181763
|
| 80 |
+
]
|
| 81 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/complete.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"mode": "wan_oracle", "cases": 2, "frames": 24}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/launcher.sh
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env bash
|
| 2 |
+
#SBATCH --job-name=matrix-game2-diagnostic
|
| 3 |
+
#SBATCH --array=0-4
|
| 4 |
+
#SBATCH --nodes=1
|
| 5 |
+
#SBATCH --ntasks=1
|
| 6 |
+
#SBATCH --cpus-per-task=14
|
| 7 |
+
#SBATCH --gres=gpu:1
|
| 8 |
+
#SBATCH --time=01:00:00
|
| 9 |
+
#SBATCH --account=berzelius-2026-196
|
| 10 |
+
#SBATCH --chdir=/proj/cvl/users/x_fahkh2/worldmem-baseline-evals
|
| 11 |
+
#SBATCH --output=slurm_logs/%x-%A_%a.out
|
| 12 |
+
#SBATCH --error=slurm_logs/%x-%A_%a.out
|
| 13 |
+
set -euo pipefail
|
| 14 |
+
module load buildenv-gcccuda/12.9.1-gcc11
|
| 15 |
+
ROOT=/proj/cvl/users/x_fahkh2/worldmem-baseline-evals
|
| 16 |
+
PYTHON=/proj/cvl/users/x_fahkh2/envs/matrix-game2-eval/bin/python
|
| 17 |
+
DATA_ROOT=/proj/cvl/users/x_fahkh2/WorldMem_Repro/datasets/minecraft
|
| 18 |
+
MODES=(wan_oracle full_original full_weighted i2v_original i2v_weighted)
|
| 19 |
+
MODE=${MODES[$SLURM_ARRAY_TASK_ID]}
|
| 20 |
+
OUTPUT=$ROOT/Matrix-Game/Matrix-Game-2/outputs/diagnostic_${MODE}_job${SLURM_ARRAY_JOB_ID}_task${SLURM_ARRAY_TASK_ID}
|
| 21 |
+
export TMPDIR=$ROOT/cache
|
| 22 |
+
export TRITON_CACHE_DIR=$ROOT/cache
|
| 23 |
+
export HF_HOME=$ROOT/cache/huggingface
|
| 24 |
+
export TORCH_HOME=$ROOT/cache/torch
|
| 25 |
+
export XDG_CACHE_HOME=$ROOT/cache
|
| 26 |
+
export MPLCONFIGDIR=$ROOT/cache/matplotlib
|
| 27 |
+
export PYTHONNOUSERSITE=1 PYTHONUNBUFFERED=1 OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
|
| 28 |
+
export WANDB_MODE=disabled HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1
|
| 29 |
+
mkdir -p "$TMPDIR" "$OUTPUT"
|
| 30 |
+
"$PYTHON" "$ROOT/deployment/verify_node.py" --expected-gpus 1 --output "$OUTPUT"
|
| 31 |
+
cp "$0" "$OUTPUT/launcher.sh"
|
| 32 |
+
cp "$ROOT/deployment/diagnose_matrix_game2.py" "$OUTPUT/probe.py"
|
| 33 |
+
srun --ntasks=1 --gpus-per-task=1 --cpus-per-task=14 --cpu-bind=cores \
|
| 34 |
+
"$PYTHON" "$ROOT/deployment/diagnose_matrix_game2.py" \
|
| 35 |
+
--mode "$MODE" --data-root "$DATA_ROOT" --output "$OUTPUT"
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/manifest.json
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"diagnostic_only": true,
|
| 3 |
+
"mode": "wan_oracle",
|
| 4 |
+
"checkpoint": "/proj/cvl/users/x_fahkh2/worldmem-baseline-evals/checkpoints/matrix-game2",
|
| 5 |
+
"weight_source": "released raw distilled",
|
| 6 |
+
"optimizer": null,
|
| 7 |
+
"lr": null,
|
| 8 |
+
"lora": null,
|
| 9 |
+
"activation_checkpointing": false,
|
| 10 |
+
"batch_size": 1,
|
| 11 |
+
"trainable_parameters": 0,
|
| 12 |
+
"denoising_steps": 3,
|
| 13 |
+
"shift": 5,
|
| 14 |
+
"local_attention_latents": 6,
|
| 15 |
+
"selector": "native sliding cache",
|
| 16 |
+
"reference": "raw RGB resized352x640, not benchmark Oasis references",
|
| 17 |
+
"targets": [
|
| 18 |
+
700,
|
| 19 |
+
724
|
| 20 |
+
],
|
| 21 |
+
"full_history": [
|
| 22 |
+
100,
|
| 23 |
+
700
|
| 24 |
+
],
|
| 25 |
+
"full_prefix_latents": 153,
|
| 26 |
+
"oracle": "9copies+RGB100:724 encodedonce;159latents; discard153latent prefix",
|
| 27 |
+
"i2v": {
|
| 28 |
+
"anchor": 699,
|
| 29 |
+
"decoded_slice": [
|
| 30 |
+
1,
|
| 31 |
+
25
|
| 32 |
+
],
|
| 33 |
+
"controls": [
|
| 34 |
+
700,
|
| 35 |
+
724
|
| 36 |
+
],
|
| 37 |
+
"right_noops": 9
|
| 38 |
+
},
|
| 39 |
+
"normalization_change": "weighted modes apply scales and accumulate RMS in fp32",
|
| 40 |
+
"cases": [
|
| 41 |
+
{
|
| 42 |
+
"index": "0",
|
| 43 |
+
"path": "test/val_plains/2/000034.mp4",
|
| 44 |
+
"seed": 42000000
|
| 45 |
+
},
|
| 46 |
+
{
|
| 47 |
+
"index": "1",
|
| 48 |
+
"path": "test/val_desert/1/000029.mp4",
|
| 49 |
+
"seed": 42000001
|
| 50 |
+
}
|
| 51 |
+
],
|
| 52 |
+
"parameter_counts": {
|
| 53 |
+
"generator_total": 1619242304,
|
| 54 |
+
"generator_trainable": 0,
|
| 55 |
+
"vae_total": 126892531,
|
| 56 |
+
"clip_total": 1193014785
|
| 57 |
+
},
|
| 58 |
+
"action_norm_instances": 60
|
| 59 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/node.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"devices": [
|
| 3 |
+
"NVIDIA H200"
|
| 4 |
+
],
|
| 5 |
+
"torch": "2.7.0+cu126",
|
| 6 |
+
"slurm_job_id": "85089"
|
| 7 |
+
}
|
results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_wan_oracle_job85088_task0/probe.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Frozen Matrix diagnostics; raw-RGB PSNR is separate from benchmark scoring."""
|
| 2 |
+
import argparse
|
| 3 |
+
import json
|
| 4 |
+
import sys
|
| 5 |
+
from pathlib import Path
|
| 6 |
+
import torch
|
| 7 |
+
import torch.nn.functional as F
|
| 8 |
+
from PIL import Image
|
| 9 |
+
|
| 10 |
+
ROOT = Path(__file__).resolve().parents[1]
|
| 11 |
+
sys.path[:0] = [str(ROOT / 'shared'), str(ROOT / 'Matrix-Game/Matrix-Game-2')]
|
| 12 |
+
from protocol import load_minecraft_case, select_cases
|
| 13 |
+
from worldmem_adapter import MatrixGameAdapter, map_actions
|
| 14 |
+
from demo_utils.constant import ZERO_VAE_CACHE
|
| 15 |
+
|
| 16 |
+
MODES = ['wan_oracle', 'full_original', 'full_weighted', 'i2v_original', 'i2v_weighted']
|
| 17 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 18 |
+
parser.add_argument('--mode', choices=MODES, required=True)
|
| 19 |
+
parser.add_argument('--data-root', type=Path, required=True)
|
| 20 |
+
parser.add_argument('--output', type=Path, required=True)
|
| 21 |
+
parser.add_argument('--dry-run', action='store_true')
|
| 22 |
+
|
| 23 |
+
def weighted_norm(self, x):
|
| 24 |
+
y = x.float()
|
| 25 |
+
return (y * torch.rsqrt(y.square().mean(-1, keepdim=True) + self.eps)).to(x.dtype) * self.weight
|
| 26 |
+
|
| 27 |
+
def save_result(output, name, prediction, reference):
|
| 28 |
+
prediction = prediction.float().cpu()
|
| 29 |
+
if prediction.shape != reference.shape or not torch.isfinite(prediction).all():
|
| 30 |
+
raise ValueError(f'Invalid Matrix prediction: {name}, shape={tuple(prediction.shape)}')
|
| 31 |
+
prediction = prediction.clamp(0, 1)
|
| 32 |
+
mse = (prediction - reference).square().mean((1, 2, 3))
|
| 33 |
+
report = {'case': name, 'raw_rgb_psnr': (-10 * mse.clamp_min(1e-12).log10()).tolist(),
|
| 34 |
+
'raw_rgb_mse': mse.tolist(), 'mean_rgb': prediction.mean((1, 2, 3)).tolist()}
|
| 35 |
+
(output / f'{name}.json').write_text(json.dumps(report, indent=2))
|
| 36 |
+
grid = torch.cat([torch.cat([v[t] for t in [0, 1, 2, 5, 11, 23]], dim=2)
|
| 37 |
+
for v in (reference, prediction)], dim=1)
|
| 38 |
+
Image.fromarray(grid.mul(255).byte().permute(1, 2, 0).numpy()).save(output / f'{name}.jpg')
|
| 39 |
+
print(json.dumps({'case': name, 'mean_psnr': sum(report['raw_rgb_psnr']) / 24,
|
| 40 |
+
'first_psnr': report['raw_rgb_psnr'][:3]}), flush=True)
|
| 41 |
+
|
| 42 |
+
@torch.inference_mode()
|
| 43 |
+
def main():
|
| 44 |
+
args = parser.parse_args()
|
| 45 |
+
rows = select_cases(ROOT / 'deployment/manifests/minecraft_test_300.csv', limit=2)
|
| 46 |
+
checkpoint = ROOT / 'checkpoints/matrix-game2'
|
| 47 |
+
manifest = {'diagnostic_only': True, 'mode': args.mode, 'checkpoint': str(checkpoint),
|
| 48 |
+
'weight_source': 'released raw distilled', 'optimizer': None, 'lr': None, 'lora': None,
|
| 49 |
+
'activation_checkpointing': False, 'batch_size': 1, 'trainable_parameters': 0,
|
| 50 |
+
'denoising_steps': 3, 'shift': 5, 'local_attention_latents': 6,
|
| 51 |
+
'selector': 'native sliding cache', 'reference': 'raw RGB resized352x640, not benchmark Oasis references',
|
| 52 |
+
'targets': [700, 724], 'full_history': [100, 700], 'full_prefix_latents': 153,
|
| 53 |
+
'oracle': '9copies+RGB100:724 encodedonce;159latents; discard153latent prefix',
|
| 54 |
+
'i2v': {'anchor': 699, 'decoded_slice': [1, 25], 'controls': [700, 724], 'right_noops': 9},
|
| 55 |
+
'normalization_change': 'weighted modes apply scales and accumulate RMS in fp32',
|
| 56 |
+
'cases': [{'index': r['global_test_index'], 'path': r['relative_path'],
|
| 57 |
+
'seed': 42000000 + int(r['global_test_index'])} for r in rows]}
|
| 58 |
+
if args.dry_run:
|
| 59 |
+
print(json.dumps(manifest, indent=2))
|
| 60 |
+
return
|
| 61 |
+
args.output.mkdir(parents=True, exist_ok=True)
|
| 62 |
+
(args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
|
| 63 |
+
from wan.modules.action_module import WanRMSNorm
|
| 64 |
+
adapter = MatrixGameAdapter(checkpoint)
|
| 65 |
+
manifest['parameter_counts'] = adapter.parameter_counts
|
| 66 |
+
manifest['action_norm_instances'] = sum(isinstance(m, WanRMSNorm) for m in adapter.pipeline.modules())
|
| 67 |
+
(args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
|
| 68 |
+
if args.mode.endswith('weighted'):
|
| 69 |
+
WanRMSNorm.forward = weighted_norm
|
| 70 |
+
for row in rows:
|
| 71 |
+
row.update(target_end='724', target_frames='24')
|
| 72 |
+
case = load_minecraft_case(row, args.data_root)
|
| 73 |
+
reference = F.interpolate(case['rgb'][600:624], (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 74 |
+
seed = 42000000 + int(row['global_test_index'])
|
| 75 |
+
if args.mode == 'wan_oracle':
|
| 76 |
+
rgb = F.interpolate(case['rgb'].cuda(), (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 77 |
+
rgb = torch.cat([rgb[:1].expand(9, -1, -1, -1), rgb])
|
| 78 |
+
latent = adapter.vae.encode(rgb.transpose(0, 1)[None].mul(2).sub(1).bfloat16(), device=adapter.device, tiled=False)
|
| 79 |
+
cache, chunks = [None] * len(ZERO_VAE_CACHE), []
|
| 80 |
+
for start in range(0, latent.shape[2], 3):
|
| 81 |
+
decoded, cache = adapter.pipeline.vae_decoder(latent[:, :, start:start + 3].transpose(1, 2).half(), *cache)
|
| 82 |
+
if start >= 153:
|
| 83 |
+
chunks.append(decoded.cpu())
|
| 84 |
+
prediction = torch.cat(chunks, dim=1)[0].float().add(1).div(2)
|
| 85 |
+
del latent, rgb, cache, decoded, chunks
|
| 86 |
+
elif args.mode.startswith('full'):
|
| 87 |
+
prediction, _ = adapter.generate(case, target_frames=24, seed=seed)
|
| 88 |
+
else:
|
| 89 |
+
torch.manual_seed(seed)
|
| 90 |
+
torch.cuda.manual_seed_all(seed)
|
| 91 |
+
anchor = F.interpolate(case['rgb'][599:600].cuda(), (352, 640), mode='bilinear', align_corners=False, antialias=True)
|
| 92 |
+
anchor = anchor.transpose(0, 1)[None].mul(2).sub(1).bfloat16()
|
| 93 |
+
image = anchor.new_zeros((1, 3, 33, 352, 640))
|
| 94 |
+
image[:, :, :1] = anchor
|
| 95 |
+
image_latents = adapter.vae.encode(image, device=adapter.device, tiled=False)
|
| 96 |
+
mask = torch.zeros_like(image_latents[:, :4])
|
| 97 |
+
mask[:, :, :1] = 1
|
| 98 |
+
actions = torch.cat([case['actions'][600:624], torch.zeros(9, 25)]).cuda().bfloat16()
|
| 99 |
+
keyboard, mouse = map_actions(actions, 1.0)
|
| 100 |
+
condition = {'cond_concat': torch.cat([mask, image_latents], dim=1),
|
| 101 |
+
'visual_context': adapter.vae.clip.encode_video(anchor).bfloat16(),
|
| 102 |
+
'keyboard_cond': keyboard[None], 'mouse_cond': mouse[None]}
|
| 103 |
+
noise = torch.randn((1, 16, 9, 44, 80), device='cuda', dtype=torch.bfloat16)
|
| 104 |
+
videos = adapter.pipeline.inference(noise, condition, initial_latent=None, mode='universal')
|
| 105 |
+
prediction = torch.cat(videos, dim=1)[0, 1:25].float().add(1).div(2)
|
| 106 |
+
del image, anchor, image_latents, condition, videos, noise
|
| 107 |
+
save_result(args.output, f"case{row['global_test_index']}_{args.mode}", prediction, reference)
|
| 108 |
+
del prediction, reference, case
|
| 109 |
+
(args.output / 'complete.json').write_text(json.dumps({'mode': args.mode, 'cases': 2, 'frames': 24}))
|
| 110 |
+
print('DIAGNOSTICS_COMPLETE', flush=True)
|
| 111 |
+
|
| 112 |
+
if __name__ == '__main__':
|
| 113 |
+
main()
|