Amshaker commited on
Commit
7fd6578
·
1 Parent(s): 3c44a2a

Upload Matrix native-control results

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +16 -0
  2. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/comparison.jpg +0 -0
  3. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/comparison.json +81 -0
  4. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/demo.mp4 +3 -0
  5. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/demo_icon.mp4 +3 -0
  6. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/input.png +0 -0
  7. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/inputs.npz +3 -0
  8. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/comparison.jpg +3 -0
  9. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/comparison.json +81 -0
  10. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/demo.mp4 +3 -0
  11. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/demo_icon.mp4 +3 -0
  12. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/input.png +0 -0
  13. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/inputs.npz +3 -0
  14. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/complete.json +1 -0
  15. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/inference.py +169 -0
  16. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/inference_universal.yaml +21 -0
  17. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/launcher.sh +38 -0
  18. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/manifest.json +50 -0
  19. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/node.json +7 -0
  20. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/probe.py +106 -0
  21. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/comparison.jpg +0 -0
  22. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/comparison.json +81 -0
  23. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/demo.mp4 +0 -0
  24. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/demo_icon.mp4 +0 -0
  25. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/input.png +0 -0
  26. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/inputs.npz +3 -0
  27. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/comparison.jpg +3 -0
  28. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/comparison.json +81 -0
  29. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/demo.mp4 +0 -0
  30. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/demo_icon.mp4 +0 -0
  31. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/input.png +0 -0
  32. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/inputs.npz +3 -0
  33. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/complete.json +1 -0
  34. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/inference.py +169 -0
  35. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/inference_universal.yaml +21 -0
  36. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/launcher.sh +38 -0
  37. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/manifest.json +50 -0
  38. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/node.json +7 -0
  39. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/probe.py +106 -0
  40. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/complete.json +1 -0
  41. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/demo.mp4 +3 -0
  42. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/demo_icon.mp4 +3 -0
  43. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/inference.py +169 -0
  44. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/inference_universal.yaml +21 -0
  45. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/launcher.sh +38 -0
  46. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/manifest.json +42 -0
  47. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/node.json +7 -0
  48. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/probe.py +106 -0
  49. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/samples.jpg +3 -0
  50. results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_recorded_job85112_task3/case0/comparison.jpg +3 -0
.gitattributes CHANGED
@@ -14323,3 +14323,19 @@ results/worldmem-baseline-evals/matrix-game2-diagnostics/diagnostic_i2v_original
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
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
14326
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/demo.mp4 filter=lfs diff=lfs merge=lfs -text
14327
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/demo_icon.mp4 filter=lfs diff=lfs merge=lfs -text
14328
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/comparison.jpg filter=lfs diff=lfs merge=lfs -text
14329
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/demo.mp4 filter=lfs diff=lfs merge=lfs -text
14330
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/demo_icon.mp4 filter=lfs diff=lfs merge=lfs -text
14331
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/comparison.jpg filter=lfs diff=lfs merge=lfs -text
14332
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/demo.mp4 filter=lfs diff=lfs merge=lfs -text
14333
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/demo_icon.mp4 filter=lfs diff=lfs merge=lfs -text
14334
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/samples.jpg filter=lfs diff=lfs merge=lfs -text
14335
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_recorded_job85112_task3/case0/comparison.jpg filter=lfs diff=lfs merge=lfs -text
14336
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_recorded_job85112_task3/case1/comparison.jpg filter=lfs diff=lfs merge=lfs -text
14337
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_recorded_job85112_task3/case1/demo.mp4 filter=lfs diff=lfs merge=lfs -text
14338
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_recorded_job85112_task3/case1/demo_icon.mp4 filter=lfs diff=lfs merge=lfs -text
14339
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_small_mouse_job85112_task4/case1/comparison.jpg filter=lfs diff=lfs merge=lfs -text
14340
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_small_mouse_job85112_task4/case1/demo.mp4 filter=lfs diff=lfs merge=lfs -text
14341
+ results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_small_mouse_job85112_task4/case1/demo_icon.mp4 filter=lfs diff=lfs merge=lfs -text
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/comparison.jpg ADDED
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/comparison.json ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case": "comparison",
3
+ "raw_rgb_psnr": [
4
+ 28.761943817138672,
5
+ 24.894990921020508,
6
+ 5.066094875335693,
7
+ 6.884883880615234,
8
+ 7.142206192016602,
9
+ 7.228761196136475,
10
+ 7.280294895172119,
11
+ 7.196128845214844,
12
+ 7.207036972045898,
13
+ 7.207610130310059,
14
+ 7.2647624015808105,
15
+ 7.177729606628418,
16
+ 7.162692546844482,
17
+ 7.2452826499938965,
18
+ 7.280104637145996,
19
+ 7.2675628662109375,
20
+ 7.268505096435547,
21
+ 7.322355270385742,
22
+ 7.28434944152832,
23
+ 7.270142555236816,
24
+ 7.088680267333984,
25
+ 6.997251510620117,
26
+ 6.956180572509766,
27
+ 7.0359296798706055
28
+ ],
29
+ "raw_rgb_mse": [
30
+ 0.0013298585545271635,
31
+ 0.0032396710012108088,
32
+ 0.3114515542984009,
33
+ 0.20488570630550385,
34
+ 0.19309870898723602,
35
+ 0.18928833305835724,
36
+ 0.18705551326274872,
37
+ 0.1907159984111786,
38
+ 0.19023756682872772,
39
+ 0.19021247327327728,
40
+ 0.1877257078886032,
41
+ 0.1915256828069687,
42
+ 0.1921899914741516,
43
+ 0.18856962025165558,
44
+ 0.18706370890140533,
45
+ 0.18760469555854797,
46
+ 0.18756400048732758,
47
+ 0.18525265157222748,
48
+ 0.186880961060524,
49
+ 0.18749330937862396,
50
+ 0.19549334049224854,
51
+ 0.1996525377035141,
52
+ 0.20154961943626404,
53
+ 0.19788235425949097
54
+ ],
55
+ "mean_rgb": [
56
+ 0.7190113663673401,
57
+ 0.7229689359664917,
58
+ 0.19768567383289337,
59
+ 0.296479195356369,
60
+ 0.30714768171310425,
61
+ 0.31132906675338745,
62
+ 0.31336742639541626,
63
+ 0.3084028661251068,
64
+ 0.3105626106262207,
65
+ 0.3106946647167206,
66
+ 0.3127269446849823,
67
+ 0.3085455596446991,
68
+ 0.30667993426322937,
69
+ 0.3099704384803772,
70
+ 0.31143423914909363,
71
+ 0.31037086248397827,
72
+ 0.31108224391937256,
73
+ 0.3149312436580658,
74
+ 0.3144523501396179,
75
+ 0.31461331248283386,
76
+ 0.30496296286582947,
77
+ 0.3001496493816376,
78
+ 0.2973284423351288,
79
+ 0.30110853910446167
80
+ ]
81
+ }
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/demo.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6660c7b9630cb1ee296a5def8c1279f56450658d5ebe93c0efe8e9180d495932
3
+ size 105287
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/demo_icon.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:acd8d7516b9a9a9ef6382b590ef3979b2d462592a112869f6a5d1a1043cf9f70
3
+ size 109197
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/input.png ADDED
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case0/inputs.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:493fc4dd35246cc265ebffe2892af27a49cb3021a298008755a8cf455b536125
3
+ size 952269
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/comparison.jpg ADDED

Git LFS Details

  • SHA256: 37a2ea71f84babf1a4cca4c50eb05aa85e71830125f024081fd17f39675529ae
  • Pointer size: 131 Bytes
  • Size of remote file: 165 kB
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/comparison.json ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case": "comparison",
3
+ "raw_rgb_psnr": [
4
+ 19.81435775756836,
5
+ 18.266035079956055,
6
+ 17.720809936523438,
7
+ 17.051300048828125,
8
+ 17.8521785736084,
9
+ 17.96320152282715,
10
+ 17.770442962646484,
11
+ 17.66672706604004,
12
+ 17.461271286010742,
13
+ 17.219820022583008,
14
+ 17.17270851135254,
15
+ 17.01397132873535,
16
+ 16.4091739654541,
17
+ 16.703092575073242,
18
+ 17.036758422851562,
19
+ 16.95575523376465,
20
+ 16.949073791503906,
21
+ 16.948787689208984,
22
+ 16.964191436767578,
23
+ 17.009931564331055,
24
+ 16.958953857421875,
25
+ 16.964096069335938,
26
+ 16.84088134765625,
27
+ 16.837522506713867
28
+ ],
29
+ "raw_rgb_mse": [
30
+ 0.010436725802719593,
31
+ 0.014907212927937508,
32
+ 0.01690126210451126,
33
+ 0.019718321040272713,
34
+ 0.016397668048739433,
35
+ 0.01598379760980606,
36
+ 0.016709202900528908,
37
+ 0.01711304485797882,
38
+ 0.01794208399951458,
39
+ 0.018967844545841217,
40
+ 0.01917472667992115,
41
+ 0.019888538867235184,
42
+ 0.02286033146083355,
43
+ 0.021364402025938034,
44
+ 0.019784456118941307,
45
+ 0.02015693485736847,
46
+ 0.020187973976135254,
47
+ 0.020189296454191208,
48
+ 0.02011781372129917,
49
+ 0.019907046109437943,
50
+ 0.020142091438174248,
51
+ 0.020118258893489838,
52
+ 0.0206972137093544,
53
+ 0.02071322314441204
54
+ ],
55
+ "mean_rgb": [
56
+ 0.7137359976768494,
57
+ 0.7148902416229248,
58
+ 0.7157489061355591,
59
+ 0.7161552906036377,
60
+ 0.713788628578186,
61
+ 0.7127888202667236,
62
+ 0.7122524976730347,
63
+ 0.7112450003623962,
64
+ 0.7104371786117554,
65
+ 0.7100856900215149,
66
+ 0.7079524397850037,
67
+ 0.7049611210823059,
68
+ 0.700785756111145,
69
+ 0.7041963934898376,
70
+ 0.7078825831413269,
71
+ 0.7077915668487549,
72
+ 0.7052977085113525,
73
+ 0.7040800452232361,
74
+ 0.7037867903709412,
75
+ 0.7034406065940857,
76
+ 0.7064051628112793,
77
+ 0.7068390846252441,
78
+ 0.7078206539154053,
79
+ 0.7080984115600586
80
+ ]
81
+ }
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/demo.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c36d9d54461a4f2cfde284402e002e69b0f680afde385beeb28e13bf8663f9a3
3
+ size 123910
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/demo_icon.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bbf31f6a1796c834d4122b2c99469c92c9cc5dc129dd1659f03727fe4e4e3b74
3
+ size 127119
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/input.png ADDED
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/case1/inputs.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:000846f182a7383bde76fede303b37ca054efd047e17d6f941aeb95bd24cb7e5
3
+ size 951982
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/complete.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"mode": "demo_actions", "complete": true}
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/inference.py ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import argparse
3
+ import torch
4
+ import numpy as np
5
+
6
+ from omegaconf import OmegaConf
7
+ from torchvision.transforms import v2
8
+ from diffusers.utils import load_image
9
+ from einops import rearrange
10
+ from pipeline import CausalInferencePipeline
11
+ from wan.vae.wanx_vae import get_wanx_vae_wrapper
12
+ from demo_utils.vae_block3 import VAEDecoderWrapper
13
+ from utils.visualize import process_video
14
+ from utils.misc import set_seed
15
+ from utils.conditions import *
16
+ from utils.wan_wrapper import WanDiffusionWrapper
17
+ from safetensors.torch import load_file
18
+
19
+ def parse_args():
20
+ parser = argparse.ArgumentParser()
21
+ parser.add_argument("--config_path", type=str, default="configs/inference_yaml/inference_universal.yaml", help="Path to the config file")
22
+ parser.add_argument("--checkpoint_path", type=str, default="", help="Path to the checkpoint")
23
+ parser.add_argument("--img_path", type=str, default="demo_images/universal/0000.png", help="Path to the image")
24
+ parser.add_argument("--output_folder", type=str, default="outputs/", help="Output folder")
25
+ parser.add_argument("--num_output_frames", type=int, default=150,
26
+ help="Number of output latent frames")
27
+ parser.add_argument("--seed", type=int, default=0, help="Random seed")
28
+ parser.add_argument("--pretrained_model_path", type=str, default="Matrix-Game-2.0", help="Path to the VAE model folder")
29
+ args = parser.parse_args()
30
+ return args
31
+
32
+ class InteractiveGameInference:
33
+ def __init__(self, args):
34
+ self.args = args
35
+ self.device = torch.device("cuda")
36
+ self.weight_dtype = torch.bfloat16
37
+
38
+ self._init_config()
39
+ self._init_models()
40
+
41
+ self.frame_process = v2.Compose([
42
+ v2.Resize(size=(352, 640), antialias=True),
43
+ v2.ToTensor(),
44
+ v2.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]),
45
+ ])
46
+
47
+ def _init_config(self):
48
+ self.config = OmegaConf.load(self.args.config_path)
49
+
50
+ def _init_models(self):
51
+ # Initialize pipeline
52
+ generator = WanDiffusionWrapper(
53
+ **getattr(self.config, "model_kwargs", {}), is_causal=True)
54
+ current_vae_decoder = VAEDecoderWrapper()
55
+ vae_state_dict = torch.load(os.path.join(self.args.pretrained_model_path, "Wan2.1_VAE.pth"), map_location="cpu")
56
+ decoder_state_dict = {}
57
+ for key, value in vae_state_dict.items():
58
+ if 'decoder.' in key or 'conv2' in key:
59
+ decoder_state_dict[key] = value
60
+ current_vae_decoder.load_state_dict(decoder_state_dict)
61
+ current_vae_decoder.to(self.device, torch.float16)
62
+ current_vae_decoder.requires_grad_(False)
63
+ current_vae_decoder.eval()
64
+ current_vae_decoder.compile(mode="max-autotune-no-cudagraphs")
65
+ pipeline = CausalInferencePipeline(self.config, generator=generator, vae_decoder=current_vae_decoder)
66
+ if self.args.checkpoint_path:
67
+ print("Loading Pretrained Model...")
68
+ state_dict = load_file(self.args.checkpoint_path)
69
+ pipeline.generator.load_state_dict(state_dict)
70
+
71
+ self.pipeline = pipeline.to(device=self.device, dtype=self.weight_dtype)
72
+ self.pipeline.vae_decoder.to(torch.float16)
73
+
74
+ vae = get_wanx_vae_wrapper(self.args.pretrained_model_path, torch.float16)
75
+ vae.requires_grad_(False)
76
+ vae.eval()
77
+ self.vae = vae.to(self.device, self.weight_dtype)
78
+
79
+ def _resizecrop(self, image, th, tw):
80
+ w, h = image.size
81
+ if h / w > th / tw:
82
+ new_w = int(w)
83
+ new_h = int(new_w * th / tw)
84
+ else:
85
+ new_h = int(h)
86
+ new_w = int(new_h * tw / th)
87
+ left = (w - new_w) / 2
88
+ top = (h - new_h) / 2
89
+ right = (w + new_w) / 2
90
+ bottom = (h + new_h) / 2
91
+ image = image.crop((left, top, right, bottom))
92
+ return image
93
+
94
+ def generate_videos(self):
95
+ mode = self.config.pop('mode')
96
+ assert mode in ['universal', 'gta_drive', 'templerun']
97
+
98
+ image = load_image(self.args.img_path)
99
+ image = self._resizecrop(image, 352, 640)
100
+ image = self.frame_process(image)[None, :, None, :, :].to(dtype=self.weight_dtype, device=self.device)
101
+ # Encode the input image as the first latent
102
+ padding_video = torch.zeros_like(image).repeat(1, 1, 4 * (self.args.num_output_frames - 1), 1, 1)
103
+ img_cond = torch.concat([image, padding_video], dim=2)
104
+ tiler_kwargs={"tiled": True, "tile_size": [44, 80], "tile_stride": [23, 38]}
105
+ img_cond = self.vae.encode(img_cond, device=self.device, **tiler_kwargs).to(self.device)
106
+ mask_cond = torch.ones_like(img_cond)
107
+ mask_cond[:, :, 1:] = 0
108
+ cond_concat = torch.cat([mask_cond[:, :4], img_cond], dim=1)
109
+ visual_context = self.vae.clip.encode_video(image)
110
+ sampled_noise = torch.randn(
111
+ [1, 16,self.args.num_output_frames, 44, 80], device=self.device, dtype=self.weight_dtype
112
+ )
113
+ num_frames = (self.args.num_output_frames - 1) * 4 + 1
114
+
115
+ conditional_dict = {
116
+ "cond_concat": cond_concat.to(device=self.device, dtype=self.weight_dtype),
117
+ "visual_context": visual_context.to(device=self.device, dtype=self.weight_dtype)
118
+ }
119
+
120
+ if mode == 'universal':
121
+ cond_data = Bench_actions_universal(num_frames)
122
+ mouse_condition = cond_data['mouse_condition'].unsqueeze(0).to(device=self.device, dtype=self.weight_dtype)
123
+ conditional_dict['mouse_cond'] = mouse_condition
124
+ elif mode == 'gta_drive':
125
+ cond_data = Bench_actions_gta_drive(num_frames)
126
+ mouse_condition = cond_data['mouse_condition'].unsqueeze(0).to(device=self.device, dtype=self.weight_dtype)
127
+ conditional_dict['mouse_cond'] = mouse_condition
128
+ else:
129
+ cond_data = Bench_actions_templerun(num_frames)
130
+ keyboard_condition = cond_data['keyboard_condition'].unsqueeze(0).to(device=self.device, dtype=self.weight_dtype)
131
+ conditional_dict['keyboard_cond'] = keyboard_condition
132
+
133
+ with torch.no_grad():
134
+ videos = self.pipeline.inference(
135
+ noise=sampled_noise,
136
+ conditional_dict=conditional_dict,
137
+ return_latents=False,
138
+ mode=mode,
139
+ profile=False
140
+ )
141
+
142
+ videos_tensor = torch.cat(videos, dim=1)
143
+ videos = rearrange(videos_tensor, "B T C H W -> B T H W C")
144
+ videos = ((videos.float() + 1) * 127.5).clip(0, 255).cpu().numpy().astype(np.uint8)[0]
145
+ video = np.ascontiguousarray(videos)
146
+ mouse_icon = 'assets/images/mouse.png'
147
+ if mode != 'templerun':
148
+ config = (
149
+ keyboard_condition[0].float().cpu().numpy(),
150
+ mouse_condition[0].float().cpu().numpy()
151
+ )
152
+ else:
153
+ config = (
154
+ keyboard_condition[0].float().cpu().numpy()
155
+ )
156
+ process_video(video.astype(np.uint8), self.args.output_folder+f'/demo.mp4', config, mouse_icon, mouse_scale=0.1, process_icon=False, mode=mode)
157
+ process_video(video.astype(np.uint8), self.args.output_folder+f'/demo_icon.mp4', config, mouse_icon, mouse_scale=0.1, process_icon=True, mode=mode)
158
+ print("Done")
159
+
160
+ def main():
161
+ """Main entry point for video generation."""
162
+ args = parse_args()
163
+ set_seed(args.seed)
164
+ os.makedirs(args.output_folder, exist_ok=True)
165
+ pipeline = InteractiveGameInference(args)
166
+ pipeline.generate_videos()
167
+
168
+ if __name__ == "__main__":
169
+ main()
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/inference_universal.yaml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ denoising_step_list:
2
+ - 1000
3
+ - 666
4
+ - 333
5
+ warp_denoising_step: true
6
+ ts_schedule: false
7
+ mixed_precision: true
8
+ seed: 42
9
+ image_or_video_shape:
10
+ - 1
11
+ - 16
12
+ - 15
13
+ - 44
14
+ - 80
15
+ num_frame_per_block: 3
16
+ context_noise: 0
17
+ mode: universal
18
+ causal: true
19
+ model_kwargs:
20
+ timestep_shift: 5.0
21
+ model_config: configs/distilled_model/universal
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/launcher.sh ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ #SBATCH --job-name=matrix-game2-native-control
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=02: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=(official_demo demo_actions neutral recorded small_mouse)
19
+ MODE=${MODES[$SLURM_ARRAY_TASK_ID]}
20
+ OUTPUT=$ROOT/Matrix-Game/Matrix-Game-2/outputs/diagnostic_native_${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 TORCHINDUCTOR_CACHE_DIR=$ROOT/cache/torchinductor
24
+ export HF_HOME=$ROOT/cache/huggingface
25
+ export TORCH_HOME=$ROOT/cache/torch
26
+ export XDG_CACHE_HOME=$ROOT/cache
27
+ export MPLCONFIGDIR=$ROOT/cache/matplotlib
28
+ export PYTHONPATH=$ROOT/Matrix-Game/Matrix-Game-2
29
+ export PYTHONNOUSERSITE=1 PYTHONUNBUFFERED=1 OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
30
+ export WANDB_MODE=disabled HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1
31
+ mkdir -p "$TMPDIR" "$TORCHINDUCTOR_CACHE_DIR" "$OUTPUT"
32
+ "$PYTHON" "$ROOT/deployment/verify_node.py" --expected-gpus 1 --output "$OUTPUT"
33
+ cp "$0" "$OUTPUT/launcher.sh"
34
+ cp "$ROOT/deployment/matrix_native_controls.py" "$OUTPUT/probe.py"
35
+ cp "$ROOT/Matrix-Game/Matrix-Game-2/inference.py" "$ROOT/Matrix-Game/Matrix-Game-2/configs/inference_yaml/inference_universal.yaml" "$OUTPUT/"
36
+ srun --ntasks=1 --gpus-per-task=1 --cpus-per-task=14 --cpu-bind=cores \
37
+ "$PYTHON" "$ROOT/deployment/matrix_native_controls.py" \
38
+ --mode "$MODE" --data-root "$DATA_ROOT" --output "$OUTPUT"
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/manifest.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mode": "demo_actions",
3
+ "diagnostic_only": true,
4
+ "checkpoint": "/proj/cvl/users/x_fahkh2/worldmem-baseline-evals/checkpoints/matrix-game2",
5
+ "upstream_revision": "71c3cd7f741311f8100f6cf9cde942b6c1378d11",
6
+ "weight_policy": "released raw distilled; original normalization; no optimizer or updates",
7
+ "expected_generator_parameters": 1619242304,
8
+ "expected_vae_parameters": 126892531,
9
+ "expected_clip_parameters": 1193014785,
10
+ "batch_size": 1,
11
+ "lora": null,
12
+ "lr": null,
13
+ "activation_checkpointing": false,
14
+ "steps": 3,
15
+ "shift": 5,
16
+ "cache_latents": 6,
17
+ "decoder": "official compiled max-autotune-no-cudagraphs",
18
+ "official_demo": "unchanged inference.py; supplied painting0000.png; seed0;150latents=597RGB",
19
+ "minecraft": {
20
+ "anchor": 699,
21
+ "native_latents": 9,
22
+ "native_rgb": 33,
23
+ "scored_slice": [
24
+ 1,
25
+ 25
26
+ ],
27
+ "targets": [
28
+ 700,
29
+ 724
30
+ ],
31
+ "recorded_control_alignment": "incoming700:724 plus9noops; small_mouse scales camera only",
32
+ "reference": "rawRGB with official center crop and frame_process"
33
+ },
34
+ "score_caveat": "Only recorded controls replay GT actions; other modes test stability, not benchmark accuracy",
35
+ "cases": [
36
+ {
37
+ "index": "0",
38
+ "path": "test/val_plains/2/000034.mp4",
39
+ "seed": 42000000
40
+ },
41
+ {
42
+ "index": "1",
43
+ "path": "test/val_desert/1/000029.mp4",
44
+ "seed": 42000001
45
+ }
46
+ ],
47
+ "output_frames_per_case": 33,
48
+ "generator_requires_grad_parameters": 1619242304,
49
+ "inference_grad_policy": "unchanged native no_grad; parameter flags unmodified"
50
+ }
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_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": "85114"
7
+ }
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_demo_actions_job85112_task1/probe.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Official Matrix demo and native-image controls; all scores are diagnostic."""
2
+ import argparse
3
+ import json
4
+ import os
5
+ import subprocess
6
+ import sys
7
+ from pathlib import Path
8
+ import numpy as np
9
+ import torch
10
+ from PIL import Image
11
+ from diagnose_matrix_game2 import save_result
12
+ from protocol import minecraft_actions, read_frames, select_cases
13
+ from worldmem_adapter import map_actions
14
+
15
+ ROOT = Path(__file__).resolve().parents[1]
16
+ REPO = ROOT / 'Matrix-Game/Matrix-Game-2'
17
+ MODES = ['official_demo', 'demo_actions', 'neutral', 'recorded', 'small_mouse']
18
+
19
+ def replay_controls(raw, mode, length):
20
+ keyboard, mouse = map_actions(minecraft_actions(raw), 1.0)
21
+ keys, turns = torch.zeros(length, 4), torch.zeros(length, 2)
22
+ if mode != 'neutral':
23
+ keys[:24], turns[:24] = keyboard, mouse * (0.1 if mode == 'small_mouse' else 1.0)
24
+ return {'keyboard_condition': keys, 'mouse_condition': turns}
25
+
26
+ def main():
27
+ parser = argparse.ArgumentParser(description=__doc__)
28
+ parser.add_argument('--mode', choices=MODES, required=True)
29
+ parser.add_argument('--data-root', type=Path, required=True)
30
+ parser.add_argument('--output', type=Path, required=True)
31
+ parser.add_argument('--dry-run', action='store_true')
32
+ args = parser.parse_args()
33
+ checkpoint = ROOT / 'checkpoints/matrix-game2'
34
+ rows = select_cases(ROOT / 'deployment/manifests/minecraft_test_300.csv', limit=2)
35
+ manifest = {'mode': args.mode, 'diagnostic_only': True, 'checkpoint': str(checkpoint),
36
+ 'upstream_revision': '71c3cd7f741311f8100f6cf9cde942b6c1378d11',
37
+ 'weight_policy': 'released raw distilled; original normalization; no optimizer or updates',
38
+ 'expected_generator_parameters': 1619242304, 'expected_vae_parameters': 126892531,
39
+ 'expected_clip_parameters': 1193014785, 'batch_size': 1, 'lora': None, 'lr': None,
40
+ 'activation_checkpointing': False, 'steps': 3, 'shift': 5, 'cache_latents': 6,
41
+ 'decoder': 'official compiled max-autotune-no-cudagraphs',
42
+ 'official_demo': 'unchanged inference.py; supplied painting0000.png; seed0;150latents=597RGB',
43
+ 'minecraft': {'anchor': 699, 'native_latents': 9, 'native_rgb': 33, 'scored_slice': [1, 25],
44
+ 'targets': [700, 724], 'recorded_control_alignment': 'incoming700:724 plus9noops; small_mouse scales camera only',
45
+ 'reference': 'rawRGB with official center crop and frame_process'},
46
+ 'score_caveat': 'Only recorded controls replay GT actions; other modes test stability, not benchmark accuracy',
47
+ 'cases': ([{'image': 'demo_images/universal/0000.png', 'seed': 0}] if args.mode == 'official_demo'
48
+ else [{'index': r['global_test_index'], 'path': r['relative_path'],
49
+ 'seed': 42000000 + int(r['global_test_index'])} for r in rows]),
50
+ 'output_frames_per_case': 597 if args.mode == 'official_demo' else 33}
51
+ if args.dry_run:
52
+ print(json.dumps(manifest, indent=2))
53
+ return
54
+ args.output.mkdir(parents=True, exist_ok=True)
55
+ (args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
56
+ os.chdir(REPO)
57
+ if args.mode == 'official_demo':
58
+ subprocess.run([sys.executable, 'inference.py', '--checkpoint_path', str(checkpoint / 'base_distilled_model/base_distill.safetensors'),
59
+ '--pretrained_model_path', str(checkpoint), '--img_path', 'demo_images/universal/0000.png',
60
+ '--config_path', 'configs/inference_yaml/inference_universal.yaml', '--seed', '0',
61
+ '--num_output_frames', '150', '--output_folder', str(args.output)], check=True)
62
+ from torchvision.io import read_video
63
+ video, _, _ = read_video(str(args.output / 'demo.mp4'), pts_unit='sec')
64
+ assert len(video) == 597
65
+ Image.fromarray(torch.cat([video[t] for t in [0, 1, 2, 24, 100, 596]], dim=1).numpy()).save(args.output / 'samples.jpg')
66
+ else:
67
+ import inference as native
68
+ native.set_seed(0)
69
+ model_args = argparse.Namespace(config_path='configs/inference_yaml/inference_universal.yaml',
70
+ checkpoint_path=str(checkpoint / 'base_distilled_model/base_distill.safetensors'),
71
+ pretrained_model_path=str(checkpoint), num_output_frames=9, seed=0, img_path='', output_folder='')
72
+ engine = native.InteractiveGameInference(model_args)
73
+ manifest['generator_requires_grad_parameters'] = sum(p.numel() for p in engine.pipeline.generator.parameters() if p.requires_grad)
74
+ manifest['inference_grad_policy'] = 'unchanged native no_grad; parameter flags unmodified'
75
+ (args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
76
+ original_inference, native_controls = engine.pipeline.inference, native.Bench_actions_universal
77
+ captured = {}
78
+ def capture(**kwargs):
79
+ condition = kwargs['conditional_dict']
80
+ np.savez_compressed(case_dir / 'inputs.npz', initial_noise=kwargs['noise'].float().cpu().numpy(),
81
+ keyboard=condition['keyboard_cond'][0].float().cpu().numpy(), mouse=condition['mouse_cond'][0].float().cpu().numpy())
82
+ videos = original_inference(**kwargs)
83
+ captured['prediction'] = torch.cat(videos, dim=1)[0, 1:25].detach().float().cpu().add(1).div(2)
84
+ return videos
85
+ engine.pipeline.inference = capture
86
+ for row in rows:
87
+ case_dir = args.output / f"case{row['global_test_index']}"
88
+ case_dir.mkdir(exist_ok=True)
89
+ path = args.data_root / row['relative_path']
90
+ rgb = read_frames(path, torch.arange(699, 724))
91
+ images = [Image.fromarray(frame.mul(255).round().byte().permute(1, 2, 0).numpy()) for frame in rgb]
92
+ images[0].save(case_dir / 'input.png')
93
+ reference = torch.stack([engine.frame_process(engine._resizecrop(im, 352, 640)).add(1).div(2) for im in images[1:]])
94
+ with np.load(path.with_suffix('.npz')) as annotation:
95
+ controls = replay_controls(annotation['actions'][700:724], args.mode, 33)
96
+ native.Bench_actions_universal = native_controls if args.mode == 'demo_actions' else lambda length: controls
97
+ model_args.img_path, model_args.output_folder = str(case_dir / 'input.png'), str(case_dir)
98
+ engine.config['mode'] = 'universal'
99
+ native.set_seed(42000000 + int(row['global_test_index']))
100
+ engine.generate_videos()
101
+ save_result(case_dir, 'comparison', captured.pop('prediction'), reference)
102
+ (args.output / 'complete.json').write_text(json.dumps({'mode': args.mode, 'complete': True}))
103
+ print('NATIVE_CONTROL_COMPLETE', flush=True)
104
+
105
+ if __name__ == '__main__':
106
+ main()
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/comparison.jpg ADDED
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/comparison.json ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case": "comparison",
3
+ "raw_rgb_psnr": [
4
+ 29.00463104248047,
5
+ 25.083839416503906,
6
+ 5.1293206214904785,
7
+ 7.163086891174316,
8
+ 7.246057510375977,
9
+ 7.313009262084961,
10
+ 7.356295585632324,
11
+ 7.3129777908325195,
12
+ 7.402219772338867,
13
+ 7.4208784103393555,
14
+ 7.457307815551758,
15
+ 7.469139099121094,
16
+ 7.432450771331787,
17
+ 7.4313764572143555,
18
+ 7.441709518432617,
19
+ 7.446588516235352,
20
+ 7.415165901184082,
21
+ 7.416438579559326,
22
+ 7.437826156616211,
23
+ 7.455380439758301,
24
+ 7.600482940673828,
25
+ 7.668927192687988,
26
+ 7.7082390785217285,
27
+ 7.726196765899658
28
+ ],
29
+ "raw_rgb_mse": [
30
+ 0.0012575836153700948,
31
+ 0.0031018152367323637,
32
+ 0.3069502115249634,
33
+ 0.19217252731323242,
34
+ 0.18853598833084106,
35
+ 0.1856517493724823,
36
+ 0.1838105469942093,
37
+ 0.18565309047698975,
38
+ 0.18187710642814636,
39
+ 0.1810973733663559,
40
+ 0.17958466708660126,
41
+ 0.1790960729122162,
42
+ 0.18061546981334686,
43
+ 0.18066012859344482,
44
+ 0.18023081123828888,
45
+ 0.18002846837043762,
46
+ 0.18133574724197388,
47
+ 0.1812826246023178,
48
+ 0.1803920418024063,
49
+ 0.17966437339782715,
50
+ 0.1737607717514038,
51
+ 0.1710437834262848,
52
+ 0.16950249671936035,
53
+ 0.16880306601524353
54
+ ],
55
+ "mean_rgb": [
56
+ 0.71062171459198,
57
+ 0.712151288986206,
58
+ 0.20236869156360626,
59
+ 0.3093110918998718,
60
+ 0.31275486946105957,
61
+ 0.316022664308548,
62
+ 0.31764835119247437,
63
+ 0.31517931818962097,
64
+ 0.31939250230789185,
65
+ 0.32033178210258484,
66
+ 0.32227084040641785,
67
+ 0.3230479955673218,
68
+ 0.32040339708328247,
69
+ 0.31977322697639465,
70
+ 0.3199549615383148,
71
+ 0.32007846236228943,
72
+ 0.31954720616340637,
73
+ 0.32010453939437866,
74
+ 0.3214494287967682,
75
+ 0.3225550353527069,
76
+ 0.3296678364276886,
77
+ 0.33288630843162537,
78
+ 0.33478885889053345,
79
+ 0.3357396125793457
80
+ ]
81
+ }
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/demo.mp4 ADDED
Binary file (63.8 kB). View file
 
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/demo_icon.mp4 ADDED
Binary file (64.4 kB). View file
 
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/input.png ADDED
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case0/inputs.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1fe3a1516baaadafaf55d193a12a989c649b2c01bf0cfe6a68446be845073ec3
3
+ size 952253
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/comparison.jpg ADDED

Git LFS Details

  • SHA256: d842d9937979fa3f35b18bf9c48288fe8c77676f7bf92ae1725bed7afb11fbc7
  • Pointer size: 131 Bytes
  • Size of remote file: 164 kB
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/comparison.json ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "case": "comparison",
3
+ "raw_rgb_psnr": [
4
+ 20.059900283813477,
5
+ 18.597415924072266,
6
+ 18.113113403320312,
7
+ 17.338909149169922,
8
+ 18.3916072845459,
9
+ 18.688901901245117,
10
+ 18.53306007385254,
11
+ 18.357519149780273,
12
+ 18.232343673706055,
13
+ 18.186416625976562,
14
+ 18.135757446289062,
15
+ 18.113117218017578,
16
+ 18.16193389892578,
17
+ 18.166234970092773,
18
+ 18.167783737182617,
19
+ 18.165790557861328,
20
+ 18.197973251342773,
21
+ 18.205169677734375,
22
+ 18.255691528320312,
23
+ 18.27703285217285,
24
+ 18.182619094848633,
25
+ 18.162242889404297,
26
+ 18.10346794128418,
27
+ 18.056255340576172
28
+ ],
29
+ "raw_rgb_mse": [
30
+ 0.009863022714853287,
31
+ 0.013812059536576271,
32
+ 0.015441467985510826,
33
+ 0.018454786390066147,
34
+ 0.01448235847055912,
35
+ 0.013524146750569344,
36
+ 0.014018258079886436,
37
+ 0.014596477150917053,
38
+ 0.015023309737443924,
39
+ 0.015183024108409882,
40
+ 0.015361170284450054,
41
+ 0.01544145680963993,
42
+ 0.015268862247467041,
43
+ 0.015253743156790733,
44
+ 0.015248307026922703,
45
+ 0.015255306847393513,
46
+ 0.015142681077122688,
47
+ 0.015117603354156017,
48
+ 0.01494276151061058,
49
+ 0.014869509264826775,
50
+ 0.015196304768323898,
51
+ 0.015267775394022465,
52
+ 0.0154758021235466,
53
+ 0.01564495824277401
54
+ ],
55
+ "mean_rgb": [
56
+ 0.7140963077545166,
57
+ 0.7141072154045105,
58
+ 0.7137575149536133,
59
+ 0.7141113877296448,
60
+ 0.7121320366859436,
61
+ 0.7116583585739136,
62
+ 0.7107756733894348,
63
+ 0.7105647325515747,
64
+ 0.7109081149101257,
65
+ 0.711028516292572,
66
+ 0.7102257609367371,
67
+ 0.7101965546607971,
68
+ 0.7101762294769287,
69
+ 0.7103557586669922,
70
+ 0.7101123332977295,
71
+ 0.7103460431098938,
72
+ 0.7076926827430725,
73
+ 0.7064762115478516,
74
+ 0.7051817178726196,
75
+ 0.7046799063682556,
76
+ 0.7081876993179321,
77
+ 0.7094244956970215,
78
+ 0.7100866436958313,
79
+ 0.7104617953300476
80
+ ]
81
+ }
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/demo.mp4 ADDED
Binary file (73.9 kB). View file
 
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/demo_icon.mp4 ADDED
Binary file (72.7 kB). View file
 
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/input.png ADDED
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/case1/inputs.npz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:95cf1a93c298840e6226640ffa742607ab41f4aee3b1b5ae60a50691a67e83bd
3
+ size 951965
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/complete.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"mode": "neutral", "complete": true}
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/inference.py ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import argparse
3
+ import torch
4
+ import numpy as np
5
+
6
+ from omegaconf import OmegaConf
7
+ from torchvision.transforms import v2
8
+ from diffusers.utils import load_image
9
+ from einops import rearrange
10
+ from pipeline import CausalInferencePipeline
11
+ from wan.vae.wanx_vae import get_wanx_vae_wrapper
12
+ from demo_utils.vae_block3 import VAEDecoderWrapper
13
+ from utils.visualize import process_video
14
+ from utils.misc import set_seed
15
+ from utils.conditions import *
16
+ from utils.wan_wrapper import WanDiffusionWrapper
17
+ from safetensors.torch import load_file
18
+
19
+ def parse_args():
20
+ parser = argparse.ArgumentParser()
21
+ parser.add_argument("--config_path", type=str, default="configs/inference_yaml/inference_universal.yaml", help="Path to the config file")
22
+ parser.add_argument("--checkpoint_path", type=str, default="", help="Path to the checkpoint")
23
+ parser.add_argument("--img_path", type=str, default="demo_images/universal/0000.png", help="Path to the image")
24
+ parser.add_argument("--output_folder", type=str, default="outputs/", help="Output folder")
25
+ parser.add_argument("--num_output_frames", type=int, default=150,
26
+ help="Number of output latent frames")
27
+ parser.add_argument("--seed", type=int, default=0, help="Random seed")
28
+ parser.add_argument("--pretrained_model_path", type=str, default="Matrix-Game-2.0", help="Path to the VAE model folder")
29
+ args = parser.parse_args()
30
+ return args
31
+
32
+ class InteractiveGameInference:
33
+ def __init__(self, args):
34
+ self.args = args
35
+ self.device = torch.device("cuda")
36
+ self.weight_dtype = torch.bfloat16
37
+
38
+ self._init_config()
39
+ self._init_models()
40
+
41
+ self.frame_process = v2.Compose([
42
+ v2.Resize(size=(352, 640), antialias=True),
43
+ v2.ToTensor(),
44
+ v2.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]),
45
+ ])
46
+
47
+ def _init_config(self):
48
+ self.config = OmegaConf.load(self.args.config_path)
49
+
50
+ def _init_models(self):
51
+ # Initialize pipeline
52
+ generator = WanDiffusionWrapper(
53
+ **getattr(self.config, "model_kwargs", {}), is_causal=True)
54
+ current_vae_decoder = VAEDecoderWrapper()
55
+ vae_state_dict = torch.load(os.path.join(self.args.pretrained_model_path, "Wan2.1_VAE.pth"), map_location="cpu")
56
+ decoder_state_dict = {}
57
+ for key, value in vae_state_dict.items():
58
+ if 'decoder.' in key or 'conv2' in key:
59
+ decoder_state_dict[key] = value
60
+ current_vae_decoder.load_state_dict(decoder_state_dict)
61
+ current_vae_decoder.to(self.device, torch.float16)
62
+ current_vae_decoder.requires_grad_(False)
63
+ current_vae_decoder.eval()
64
+ current_vae_decoder.compile(mode="max-autotune-no-cudagraphs")
65
+ pipeline = CausalInferencePipeline(self.config, generator=generator, vae_decoder=current_vae_decoder)
66
+ if self.args.checkpoint_path:
67
+ print("Loading Pretrained Model...")
68
+ state_dict = load_file(self.args.checkpoint_path)
69
+ pipeline.generator.load_state_dict(state_dict)
70
+
71
+ self.pipeline = pipeline.to(device=self.device, dtype=self.weight_dtype)
72
+ self.pipeline.vae_decoder.to(torch.float16)
73
+
74
+ vae = get_wanx_vae_wrapper(self.args.pretrained_model_path, torch.float16)
75
+ vae.requires_grad_(False)
76
+ vae.eval()
77
+ self.vae = vae.to(self.device, self.weight_dtype)
78
+
79
+ def _resizecrop(self, image, th, tw):
80
+ w, h = image.size
81
+ if h / w > th / tw:
82
+ new_w = int(w)
83
+ new_h = int(new_w * th / tw)
84
+ else:
85
+ new_h = int(h)
86
+ new_w = int(new_h * tw / th)
87
+ left = (w - new_w) / 2
88
+ top = (h - new_h) / 2
89
+ right = (w + new_w) / 2
90
+ bottom = (h + new_h) / 2
91
+ image = image.crop((left, top, right, bottom))
92
+ return image
93
+
94
+ def generate_videos(self):
95
+ mode = self.config.pop('mode')
96
+ assert mode in ['universal', 'gta_drive', 'templerun']
97
+
98
+ image = load_image(self.args.img_path)
99
+ image = self._resizecrop(image, 352, 640)
100
+ image = self.frame_process(image)[None, :, None, :, :].to(dtype=self.weight_dtype, device=self.device)
101
+ # Encode the input image as the first latent
102
+ padding_video = torch.zeros_like(image).repeat(1, 1, 4 * (self.args.num_output_frames - 1), 1, 1)
103
+ img_cond = torch.concat([image, padding_video], dim=2)
104
+ tiler_kwargs={"tiled": True, "tile_size": [44, 80], "tile_stride": [23, 38]}
105
+ img_cond = self.vae.encode(img_cond, device=self.device, **tiler_kwargs).to(self.device)
106
+ mask_cond = torch.ones_like(img_cond)
107
+ mask_cond[:, :, 1:] = 0
108
+ cond_concat = torch.cat([mask_cond[:, :4], img_cond], dim=1)
109
+ visual_context = self.vae.clip.encode_video(image)
110
+ sampled_noise = torch.randn(
111
+ [1, 16,self.args.num_output_frames, 44, 80], device=self.device, dtype=self.weight_dtype
112
+ )
113
+ num_frames = (self.args.num_output_frames - 1) * 4 + 1
114
+
115
+ conditional_dict = {
116
+ "cond_concat": cond_concat.to(device=self.device, dtype=self.weight_dtype),
117
+ "visual_context": visual_context.to(device=self.device, dtype=self.weight_dtype)
118
+ }
119
+
120
+ if mode == 'universal':
121
+ cond_data = Bench_actions_universal(num_frames)
122
+ mouse_condition = cond_data['mouse_condition'].unsqueeze(0).to(device=self.device, dtype=self.weight_dtype)
123
+ conditional_dict['mouse_cond'] = mouse_condition
124
+ elif mode == 'gta_drive':
125
+ cond_data = Bench_actions_gta_drive(num_frames)
126
+ mouse_condition = cond_data['mouse_condition'].unsqueeze(0).to(device=self.device, dtype=self.weight_dtype)
127
+ conditional_dict['mouse_cond'] = mouse_condition
128
+ else:
129
+ cond_data = Bench_actions_templerun(num_frames)
130
+ keyboard_condition = cond_data['keyboard_condition'].unsqueeze(0).to(device=self.device, dtype=self.weight_dtype)
131
+ conditional_dict['keyboard_cond'] = keyboard_condition
132
+
133
+ with torch.no_grad():
134
+ videos = self.pipeline.inference(
135
+ noise=sampled_noise,
136
+ conditional_dict=conditional_dict,
137
+ return_latents=False,
138
+ mode=mode,
139
+ profile=False
140
+ )
141
+
142
+ videos_tensor = torch.cat(videos, dim=1)
143
+ videos = rearrange(videos_tensor, "B T C H W -> B T H W C")
144
+ videos = ((videos.float() + 1) * 127.5).clip(0, 255).cpu().numpy().astype(np.uint8)[0]
145
+ video = np.ascontiguousarray(videos)
146
+ mouse_icon = 'assets/images/mouse.png'
147
+ if mode != 'templerun':
148
+ config = (
149
+ keyboard_condition[0].float().cpu().numpy(),
150
+ mouse_condition[0].float().cpu().numpy()
151
+ )
152
+ else:
153
+ config = (
154
+ keyboard_condition[0].float().cpu().numpy()
155
+ )
156
+ process_video(video.astype(np.uint8), self.args.output_folder+f'/demo.mp4', config, mouse_icon, mouse_scale=0.1, process_icon=False, mode=mode)
157
+ process_video(video.astype(np.uint8), self.args.output_folder+f'/demo_icon.mp4', config, mouse_icon, mouse_scale=0.1, process_icon=True, mode=mode)
158
+ print("Done")
159
+
160
+ def main():
161
+ """Main entry point for video generation."""
162
+ args = parse_args()
163
+ set_seed(args.seed)
164
+ os.makedirs(args.output_folder, exist_ok=True)
165
+ pipeline = InteractiveGameInference(args)
166
+ pipeline.generate_videos()
167
+
168
+ if __name__ == "__main__":
169
+ main()
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/inference_universal.yaml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ denoising_step_list:
2
+ - 1000
3
+ - 666
4
+ - 333
5
+ warp_denoising_step: true
6
+ ts_schedule: false
7
+ mixed_precision: true
8
+ seed: 42
9
+ image_or_video_shape:
10
+ - 1
11
+ - 16
12
+ - 15
13
+ - 44
14
+ - 80
15
+ num_frame_per_block: 3
16
+ context_noise: 0
17
+ mode: universal
18
+ causal: true
19
+ model_kwargs:
20
+ timestep_shift: 5.0
21
+ model_config: configs/distilled_model/universal
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/launcher.sh ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ #SBATCH --job-name=matrix-game2-native-control
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=02: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=(official_demo demo_actions neutral recorded small_mouse)
19
+ MODE=${MODES[$SLURM_ARRAY_TASK_ID]}
20
+ OUTPUT=$ROOT/Matrix-Game/Matrix-Game-2/outputs/diagnostic_native_${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 TORCHINDUCTOR_CACHE_DIR=$ROOT/cache/torchinductor
24
+ export HF_HOME=$ROOT/cache/huggingface
25
+ export TORCH_HOME=$ROOT/cache/torch
26
+ export XDG_CACHE_HOME=$ROOT/cache
27
+ export MPLCONFIGDIR=$ROOT/cache/matplotlib
28
+ export PYTHONPATH=$ROOT/Matrix-Game/Matrix-Game-2
29
+ export PYTHONNOUSERSITE=1 PYTHONUNBUFFERED=1 OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
30
+ export WANDB_MODE=disabled HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1
31
+ mkdir -p "$TMPDIR" "$TORCHINDUCTOR_CACHE_DIR" "$OUTPUT"
32
+ "$PYTHON" "$ROOT/deployment/verify_node.py" --expected-gpus 1 --output "$OUTPUT"
33
+ cp "$0" "$OUTPUT/launcher.sh"
34
+ cp "$ROOT/deployment/matrix_native_controls.py" "$OUTPUT/probe.py"
35
+ cp "$ROOT/Matrix-Game/Matrix-Game-2/inference.py" "$ROOT/Matrix-Game/Matrix-Game-2/configs/inference_yaml/inference_universal.yaml" "$OUTPUT/"
36
+ srun --ntasks=1 --gpus-per-task=1 --cpus-per-task=14 --cpu-bind=cores \
37
+ "$PYTHON" "$ROOT/deployment/matrix_native_controls.py" \
38
+ --mode "$MODE" --data-root "$DATA_ROOT" --output "$OUTPUT"
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/manifest.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mode": "neutral",
3
+ "diagnostic_only": true,
4
+ "checkpoint": "/proj/cvl/users/x_fahkh2/worldmem-baseline-evals/checkpoints/matrix-game2",
5
+ "upstream_revision": "71c3cd7f741311f8100f6cf9cde942b6c1378d11",
6
+ "weight_policy": "released raw distilled; original normalization; no optimizer or updates",
7
+ "expected_generator_parameters": 1619242304,
8
+ "expected_vae_parameters": 126892531,
9
+ "expected_clip_parameters": 1193014785,
10
+ "batch_size": 1,
11
+ "lora": null,
12
+ "lr": null,
13
+ "activation_checkpointing": false,
14
+ "steps": 3,
15
+ "shift": 5,
16
+ "cache_latents": 6,
17
+ "decoder": "official compiled max-autotune-no-cudagraphs",
18
+ "official_demo": "unchanged inference.py; supplied painting0000.png; seed0;150latents=597RGB",
19
+ "minecraft": {
20
+ "anchor": 699,
21
+ "native_latents": 9,
22
+ "native_rgb": 33,
23
+ "scored_slice": [
24
+ 1,
25
+ 25
26
+ ],
27
+ "targets": [
28
+ 700,
29
+ 724
30
+ ],
31
+ "recorded_control_alignment": "incoming700:724 plus9noops; small_mouse scales camera only",
32
+ "reference": "rawRGB with official center crop and frame_process"
33
+ },
34
+ "score_caveat": "Only recorded controls replay GT actions; other modes test stability, not benchmark accuracy",
35
+ "cases": [
36
+ {
37
+ "index": "0",
38
+ "path": "test/val_plains/2/000034.mp4",
39
+ "seed": 42000000
40
+ },
41
+ {
42
+ "index": "1",
43
+ "path": "test/val_desert/1/000029.mp4",
44
+ "seed": 42000001
45
+ }
46
+ ],
47
+ "output_frames_per_case": 33,
48
+ "generator_requires_grad_parameters": 1619242304,
49
+ "inference_grad_policy": "unchanged native no_grad; parameter flags unmodified"
50
+ }
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_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": "85115"
7
+ }
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_neutral_job85112_task2/probe.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Official Matrix demo and native-image controls; all scores are diagnostic."""
2
+ import argparse
3
+ import json
4
+ import os
5
+ import subprocess
6
+ import sys
7
+ from pathlib import Path
8
+ import numpy as np
9
+ import torch
10
+ from PIL import Image
11
+ from diagnose_matrix_game2 import save_result
12
+ from protocol import minecraft_actions, read_frames, select_cases
13
+ from worldmem_adapter import map_actions
14
+
15
+ ROOT = Path(__file__).resolve().parents[1]
16
+ REPO = ROOT / 'Matrix-Game/Matrix-Game-2'
17
+ MODES = ['official_demo', 'demo_actions', 'neutral', 'recorded', 'small_mouse']
18
+
19
+ def replay_controls(raw, mode, length):
20
+ keyboard, mouse = map_actions(minecraft_actions(raw), 1.0)
21
+ keys, turns = torch.zeros(length, 4), torch.zeros(length, 2)
22
+ if mode != 'neutral':
23
+ keys[:24], turns[:24] = keyboard, mouse * (0.1 if mode == 'small_mouse' else 1.0)
24
+ return {'keyboard_condition': keys, 'mouse_condition': turns}
25
+
26
+ def main():
27
+ parser = argparse.ArgumentParser(description=__doc__)
28
+ parser.add_argument('--mode', choices=MODES, required=True)
29
+ parser.add_argument('--data-root', type=Path, required=True)
30
+ parser.add_argument('--output', type=Path, required=True)
31
+ parser.add_argument('--dry-run', action='store_true')
32
+ args = parser.parse_args()
33
+ checkpoint = ROOT / 'checkpoints/matrix-game2'
34
+ rows = select_cases(ROOT / 'deployment/manifests/minecraft_test_300.csv', limit=2)
35
+ manifest = {'mode': args.mode, 'diagnostic_only': True, 'checkpoint': str(checkpoint),
36
+ 'upstream_revision': '71c3cd7f741311f8100f6cf9cde942b6c1378d11',
37
+ 'weight_policy': 'released raw distilled; original normalization; no optimizer or updates',
38
+ 'expected_generator_parameters': 1619242304, 'expected_vae_parameters': 126892531,
39
+ 'expected_clip_parameters': 1193014785, 'batch_size': 1, 'lora': None, 'lr': None,
40
+ 'activation_checkpointing': False, 'steps': 3, 'shift': 5, 'cache_latents': 6,
41
+ 'decoder': 'official compiled max-autotune-no-cudagraphs',
42
+ 'official_demo': 'unchanged inference.py; supplied painting0000.png; seed0;150latents=597RGB',
43
+ 'minecraft': {'anchor': 699, 'native_latents': 9, 'native_rgb': 33, 'scored_slice': [1, 25],
44
+ 'targets': [700, 724], 'recorded_control_alignment': 'incoming700:724 plus9noops; small_mouse scales camera only',
45
+ 'reference': 'rawRGB with official center crop and frame_process'},
46
+ 'score_caveat': 'Only recorded controls replay GT actions; other modes test stability, not benchmark accuracy',
47
+ 'cases': ([{'image': 'demo_images/universal/0000.png', 'seed': 0}] if args.mode == 'official_demo'
48
+ else [{'index': r['global_test_index'], 'path': r['relative_path'],
49
+ 'seed': 42000000 + int(r['global_test_index'])} for r in rows]),
50
+ 'output_frames_per_case': 597 if args.mode == 'official_demo' else 33}
51
+ if args.dry_run:
52
+ print(json.dumps(manifest, indent=2))
53
+ return
54
+ args.output.mkdir(parents=True, exist_ok=True)
55
+ (args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
56
+ os.chdir(REPO)
57
+ if args.mode == 'official_demo':
58
+ subprocess.run([sys.executable, 'inference.py', '--checkpoint_path', str(checkpoint / 'base_distilled_model/base_distill.safetensors'),
59
+ '--pretrained_model_path', str(checkpoint), '--img_path', 'demo_images/universal/0000.png',
60
+ '--config_path', 'configs/inference_yaml/inference_universal.yaml', '--seed', '0',
61
+ '--num_output_frames', '150', '--output_folder', str(args.output)], check=True)
62
+ from torchvision.io import read_video
63
+ video, _, _ = read_video(str(args.output / 'demo.mp4'), pts_unit='sec')
64
+ assert len(video) == 597
65
+ Image.fromarray(torch.cat([video[t] for t in [0, 1, 2, 24, 100, 596]], dim=1).numpy()).save(args.output / 'samples.jpg')
66
+ else:
67
+ import inference as native
68
+ native.set_seed(0)
69
+ model_args = argparse.Namespace(config_path='configs/inference_yaml/inference_universal.yaml',
70
+ checkpoint_path=str(checkpoint / 'base_distilled_model/base_distill.safetensors'),
71
+ pretrained_model_path=str(checkpoint), num_output_frames=9, seed=0, img_path='', output_folder='')
72
+ engine = native.InteractiveGameInference(model_args)
73
+ manifest['generator_requires_grad_parameters'] = sum(p.numel() for p in engine.pipeline.generator.parameters() if p.requires_grad)
74
+ manifest['inference_grad_policy'] = 'unchanged native no_grad; parameter flags unmodified'
75
+ (args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
76
+ original_inference, native_controls = engine.pipeline.inference, native.Bench_actions_universal
77
+ captured = {}
78
+ def capture(**kwargs):
79
+ condition = kwargs['conditional_dict']
80
+ np.savez_compressed(case_dir / 'inputs.npz', initial_noise=kwargs['noise'].float().cpu().numpy(),
81
+ keyboard=condition['keyboard_cond'][0].float().cpu().numpy(), mouse=condition['mouse_cond'][0].float().cpu().numpy())
82
+ videos = original_inference(**kwargs)
83
+ captured['prediction'] = torch.cat(videos, dim=1)[0, 1:25].detach().float().cpu().add(1).div(2)
84
+ return videos
85
+ engine.pipeline.inference = capture
86
+ for row in rows:
87
+ case_dir = args.output / f"case{row['global_test_index']}"
88
+ case_dir.mkdir(exist_ok=True)
89
+ path = args.data_root / row['relative_path']
90
+ rgb = read_frames(path, torch.arange(699, 724))
91
+ images = [Image.fromarray(frame.mul(255).round().byte().permute(1, 2, 0).numpy()) for frame in rgb]
92
+ images[0].save(case_dir / 'input.png')
93
+ reference = torch.stack([engine.frame_process(engine._resizecrop(im, 352, 640)).add(1).div(2) for im in images[1:]])
94
+ with np.load(path.with_suffix('.npz')) as annotation:
95
+ controls = replay_controls(annotation['actions'][700:724], args.mode, 33)
96
+ native.Bench_actions_universal = native_controls if args.mode == 'demo_actions' else lambda length: controls
97
+ model_args.img_path, model_args.output_folder = str(case_dir / 'input.png'), str(case_dir)
98
+ engine.config['mode'] = 'universal'
99
+ native.set_seed(42000000 + int(row['global_test_index']))
100
+ engine.generate_videos()
101
+ save_result(case_dir, 'comparison', captured.pop('prediction'), reference)
102
+ (args.output / 'complete.json').write_text(json.dumps({'mode': args.mode, 'complete': True}))
103
+ print('NATIVE_CONTROL_COMPLETE', flush=True)
104
+
105
+ if __name__ == '__main__':
106
+ main()
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/complete.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"mode": "official_demo", "complete": true}
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/demo.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:84ced7733db07bb9514d2bcfbe8d8924dcf0a9d07af18e90ea4896929a8a5e2a
3
+ size 10078212
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/demo_icon.mp4 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a7a28ea7754985e0323280913c18bf9fc43d31b1109e0fe5b6d4dca19325606a
3
+ size 9950995
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/inference.py ADDED
@@ -0,0 +1,169 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import argparse
3
+ import torch
4
+ import numpy as np
5
+
6
+ from omegaconf import OmegaConf
7
+ from torchvision.transforms import v2
8
+ from diffusers.utils import load_image
9
+ from einops import rearrange
10
+ from pipeline import CausalInferencePipeline
11
+ from wan.vae.wanx_vae import get_wanx_vae_wrapper
12
+ from demo_utils.vae_block3 import VAEDecoderWrapper
13
+ from utils.visualize import process_video
14
+ from utils.misc import set_seed
15
+ from utils.conditions import *
16
+ from utils.wan_wrapper import WanDiffusionWrapper
17
+ from safetensors.torch import load_file
18
+
19
+ def parse_args():
20
+ parser = argparse.ArgumentParser()
21
+ parser.add_argument("--config_path", type=str, default="configs/inference_yaml/inference_universal.yaml", help="Path to the config file")
22
+ parser.add_argument("--checkpoint_path", type=str, default="", help="Path to the checkpoint")
23
+ parser.add_argument("--img_path", type=str, default="demo_images/universal/0000.png", help="Path to the image")
24
+ parser.add_argument("--output_folder", type=str, default="outputs/", help="Output folder")
25
+ parser.add_argument("--num_output_frames", type=int, default=150,
26
+ help="Number of output latent frames")
27
+ parser.add_argument("--seed", type=int, default=0, help="Random seed")
28
+ parser.add_argument("--pretrained_model_path", type=str, default="Matrix-Game-2.0", help="Path to the VAE model folder")
29
+ args = parser.parse_args()
30
+ return args
31
+
32
+ class InteractiveGameInference:
33
+ def __init__(self, args):
34
+ self.args = args
35
+ self.device = torch.device("cuda")
36
+ self.weight_dtype = torch.bfloat16
37
+
38
+ self._init_config()
39
+ self._init_models()
40
+
41
+ self.frame_process = v2.Compose([
42
+ v2.Resize(size=(352, 640), antialias=True),
43
+ v2.ToTensor(),
44
+ v2.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]),
45
+ ])
46
+
47
+ def _init_config(self):
48
+ self.config = OmegaConf.load(self.args.config_path)
49
+
50
+ def _init_models(self):
51
+ # Initialize pipeline
52
+ generator = WanDiffusionWrapper(
53
+ **getattr(self.config, "model_kwargs", {}), is_causal=True)
54
+ current_vae_decoder = VAEDecoderWrapper()
55
+ vae_state_dict = torch.load(os.path.join(self.args.pretrained_model_path, "Wan2.1_VAE.pth"), map_location="cpu")
56
+ decoder_state_dict = {}
57
+ for key, value in vae_state_dict.items():
58
+ if 'decoder.' in key or 'conv2' in key:
59
+ decoder_state_dict[key] = value
60
+ current_vae_decoder.load_state_dict(decoder_state_dict)
61
+ current_vae_decoder.to(self.device, torch.float16)
62
+ current_vae_decoder.requires_grad_(False)
63
+ current_vae_decoder.eval()
64
+ current_vae_decoder.compile(mode="max-autotune-no-cudagraphs")
65
+ pipeline = CausalInferencePipeline(self.config, generator=generator, vae_decoder=current_vae_decoder)
66
+ if self.args.checkpoint_path:
67
+ print("Loading Pretrained Model...")
68
+ state_dict = load_file(self.args.checkpoint_path)
69
+ pipeline.generator.load_state_dict(state_dict)
70
+
71
+ self.pipeline = pipeline.to(device=self.device, dtype=self.weight_dtype)
72
+ self.pipeline.vae_decoder.to(torch.float16)
73
+
74
+ vae = get_wanx_vae_wrapper(self.args.pretrained_model_path, torch.float16)
75
+ vae.requires_grad_(False)
76
+ vae.eval()
77
+ self.vae = vae.to(self.device, self.weight_dtype)
78
+
79
+ def _resizecrop(self, image, th, tw):
80
+ w, h = image.size
81
+ if h / w > th / tw:
82
+ new_w = int(w)
83
+ new_h = int(new_w * th / tw)
84
+ else:
85
+ new_h = int(h)
86
+ new_w = int(new_h * tw / th)
87
+ left = (w - new_w) / 2
88
+ top = (h - new_h) / 2
89
+ right = (w + new_w) / 2
90
+ bottom = (h + new_h) / 2
91
+ image = image.crop((left, top, right, bottom))
92
+ return image
93
+
94
+ def generate_videos(self):
95
+ mode = self.config.pop('mode')
96
+ assert mode in ['universal', 'gta_drive', 'templerun']
97
+
98
+ image = load_image(self.args.img_path)
99
+ image = self._resizecrop(image, 352, 640)
100
+ image = self.frame_process(image)[None, :, None, :, :].to(dtype=self.weight_dtype, device=self.device)
101
+ # Encode the input image as the first latent
102
+ padding_video = torch.zeros_like(image).repeat(1, 1, 4 * (self.args.num_output_frames - 1), 1, 1)
103
+ img_cond = torch.concat([image, padding_video], dim=2)
104
+ tiler_kwargs={"tiled": True, "tile_size": [44, 80], "tile_stride": [23, 38]}
105
+ img_cond = self.vae.encode(img_cond, device=self.device, **tiler_kwargs).to(self.device)
106
+ mask_cond = torch.ones_like(img_cond)
107
+ mask_cond[:, :, 1:] = 0
108
+ cond_concat = torch.cat([mask_cond[:, :4], img_cond], dim=1)
109
+ visual_context = self.vae.clip.encode_video(image)
110
+ sampled_noise = torch.randn(
111
+ [1, 16,self.args.num_output_frames, 44, 80], device=self.device, dtype=self.weight_dtype
112
+ )
113
+ num_frames = (self.args.num_output_frames - 1) * 4 + 1
114
+
115
+ conditional_dict = {
116
+ "cond_concat": cond_concat.to(device=self.device, dtype=self.weight_dtype),
117
+ "visual_context": visual_context.to(device=self.device, dtype=self.weight_dtype)
118
+ }
119
+
120
+ if mode == 'universal':
121
+ cond_data = Bench_actions_universal(num_frames)
122
+ mouse_condition = cond_data['mouse_condition'].unsqueeze(0).to(device=self.device, dtype=self.weight_dtype)
123
+ conditional_dict['mouse_cond'] = mouse_condition
124
+ elif mode == 'gta_drive':
125
+ cond_data = Bench_actions_gta_drive(num_frames)
126
+ mouse_condition = cond_data['mouse_condition'].unsqueeze(0).to(device=self.device, dtype=self.weight_dtype)
127
+ conditional_dict['mouse_cond'] = mouse_condition
128
+ else:
129
+ cond_data = Bench_actions_templerun(num_frames)
130
+ keyboard_condition = cond_data['keyboard_condition'].unsqueeze(0).to(device=self.device, dtype=self.weight_dtype)
131
+ conditional_dict['keyboard_cond'] = keyboard_condition
132
+
133
+ with torch.no_grad():
134
+ videos = self.pipeline.inference(
135
+ noise=sampled_noise,
136
+ conditional_dict=conditional_dict,
137
+ return_latents=False,
138
+ mode=mode,
139
+ profile=False
140
+ )
141
+
142
+ videos_tensor = torch.cat(videos, dim=1)
143
+ videos = rearrange(videos_tensor, "B T C H W -> B T H W C")
144
+ videos = ((videos.float() + 1) * 127.5).clip(0, 255).cpu().numpy().astype(np.uint8)[0]
145
+ video = np.ascontiguousarray(videos)
146
+ mouse_icon = 'assets/images/mouse.png'
147
+ if mode != 'templerun':
148
+ config = (
149
+ keyboard_condition[0].float().cpu().numpy(),
150
+ mouse_condition[0].float().cpu().numpy()
151
+ )
152
+ else:
153
+ config = (
154
+ keyboard_condition[0].float().cpu().numpy()
155
+ )
156
+ process_video(video.astype(np.uint8), self.args.output_folder+f'/demo.mp4', config, mouse_icon, mouse_scale=0.1, process_icon=False, mode=mode)
157
+ process_video(video.astype(np.uint8), self.args.output_folder+f'/demo_icon.mp4', config, mouse_icon, mouse_scale=0.1, process_icon=True, mode=mode)
158
+ print("Done")
159
+
160
+ def main():
161
+ """Main entry point for video generation."""
162
+ args = parse_args()
163
+ set_seed(args.seed)
164
+ os.makedirs(args.output_folder, exist_ok=True)
165
+ pipeline = InteractiveGameInference(args)
166
+ pipeline.generate_videos()
167
+
168
+ if __name__ == "__main__":
169
+ main()
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/inference_universal.yaml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ denoising_step_list:
2
+ - 1000
3
+ - 666
4
+ - 333
5
+ warp_denoising_step: true
6
+ ts_schedule: false
7
+ mixed_precision: true
8
+ seed: 42
9
+ image_or_video_shape:
10
+ - 1
11
+ - 16
12
+ - 15
13
+ - 44
14
+ - 80
15
+ num_frame_per_block: 3
16
+ context_noise: 0
17
+ mode: universal
18
+ causal: true
19
+ model_kwargs:
20
+ timestep_shift: 5.0
21
+ model_config: configs/distilled_model/universal
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/launcher.sh ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env bash
2
+ #SBATCH --job-name=matrix-game2-native-control
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=02: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=(official_demo demo_actions neutral recorded small_mouse)
19
+ MODE=${MODES[$SLURM_ARRAY_TASK_ID]}
20
+ OUTPUT=$ROOT/Matrix-Game/Matrix-Game-2/outputs/diagnostic_native_${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 TORCHINDUCTOR_CACHE_DIR=$ROOT/cache/torchinductor
24
+ export HF_HOME=$ROOT/cache/huggingface
25
+ export TORCH_HOME=$ROOT/cache/torch
26
+ export XDG_CACHE_HOME=$ROOT/cache
27
+ export MPLCONFIGDIR=$ROOT/cache/matplotlib
28
+ export PYTHONPATH=$ROOT/Matrix-Game/Matrix-Game-2
29
+ export PYTHONNOUSERSITE=1 PYTHONUNBUFFERED=1 OMP_NUM_THREADS=4 MKL_NUM_THREADS=4
30
+ export WANDB_MODE=disabled HF_HUB_OFFLINE=1 TRANSFORMERS_OFFLINE=1
31
+ mkdir -p "$TMPDIR" "$TORCHINDUCTOR_CACHE_DIR" "$OUTPUT"
32
+ "$PYTHON" "$ROOT/deployment/verify_node.py" --expected-gpus 1 --output "$OUTPUT"
33
+ cp "$0" "$OUTPUT/launcher.sh"
34
+ cp "$ROOT/deployment/matrix_native_controls.py" "$OUTPUT/probe.py"
35
+ cp "$ROOT/Matrix-Game/Matrix-Game-2/inference.py" "$ROOT/Matrix-Game/Matrix-Game-2/configs/inference_yaml/inference_universal.yaml" "$OUTPUT/"
36
+ srun --ntasks=1 --gpus-per-task=1 --cpus-per-task=14 --cpu-bind=cores \
37
+ "$PYTHON" "$ROOT/deployment/matrix_native_controls.py" \
38
+ --mode "$MODE" --data-root "$DATA_ROOT" --output "$OUTPUT"
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/manifest.json ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "mode": "official_demo",
3
+ "diagnostic_only": true,
4
+ "checkpoint": "/proj/cvl/users/x_fahkh2/worldmem-baseline-evals/checkpoints/matrix-game2",
5
+ "upstream_revision": "71c3cd7f741311f8100f6cf9cde942b6c1378d11",
6
+ "weight_policy": "released raw distilled; original normalization; no optimizer or updates",
7
+ "expected_generator_parameters": 1619242304,
8
+ "expected_vae_parameters": 126892531,
9
+ "expected_clip_parameters": 1193014785,
10
+ "batch_size": 1,
11
+ "lora": null,
12
+ "lr": null,
13
+ "activation_checkpointing": false,
14
+ "steps": 3,
15
+ "shift": 5,
16
+ "cache_latents": 6,
17
+ "decoder": "official compiled max-autotune-no-cudagraphs",
18
+ "official_demo": "unchanged inference.py; supplied painting0000.png; seed0;150latents=597RGB",
19
+ "minecraft": {
20
+ "anchor": 699,
21
+ "native_latents": 9,
22
+ "native_rgb": 33,
23
+ "scored_slice": [
24
+ 1,
25
+ 25
26
+ ],
27
+ "targets": [
28
+ 700,
29
+ 724
30
+ ],
31
+ "recorded_control_alignment": "incoming700:724 plus9noops; small_mouse scales camera only",
32
+ "reference": "rawRGB with official center crop and frame_process"
33
+ },
34
+ "score_caveat": "Only recorded controls replay GT actions; other modes test stability, not benchmark accuracy",
35
+ "cases": [
36
+ {
37
+ "image": "demo_images/universal/0000.png",
38
+ "seed": 0
39
+ }
40
+ ],
41
+ "output_frames_per_case": 597
42
+ }
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_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": "85113"
7
+ }
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/probe.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Official Matrix demo and native-image controls; all scores are diagnostic."""
2
+ import argparse
3
+ import json
4
+ import os
5
+ import subprocess
6
+ import sys
7
+ from pathlib import Path
8
+ import numpy as np
9
+ import torch
10
+ from PIL import Image
11
+ from diagnose_matrix_game2 import save_result
12
+ from protocol import minecraft_actions, read_frames, select_cases
13
+ from worldmem_adapter import map_actions
14
+
15
+ ROOT = Path(__file__).resolve().parents[1]
16
+ REPO = ROOT / 'Matrix-Game/Matrix-Game-2'
17
+ MODES = ['official_demo', 'demo_actions', 'neutral', 'recorded', 'small_mouse']
18
+
19
+ def replay_controls(raw, mode, length):
20
+ keyboard, mouse = map_actions(minecraft_actions(raw), 1.0)
21
+ keys, turns = torch.zeros(length, 4), torch.zeros(length, 2)
22
+ if mode != 'neutral':
23
+ keys[:24], turns[:24] = keyboard, mouse * (0.1 if mode == 'small_mouse' else 1.0)
24
+ return {'keyboard_condition': keys, 'mouse_condition': turns}
25
+
26
+ def main():
27
+ parser = argparse.ArgumentParser(description=__doc__)
28
+ parser.add_argument('--mode', choices=MODES, required=True)
29
+ parser.add_argument('--data-root', type=Path, required=True)
30
+ parser.add_argument('--output', type=Path, required=True)
31
+ parser.add_argument('--dry-run', action='store_true')
32
+ args = parser.parse_args()
33
+ checkpoint = ROOT / 'checkpoints/matrix-game2'
34
+ rows = select_cases(ROOT / 'deployment/manifests/minecraft_test_300.csv', limit=2)
35
+ manifest = {'mode': args.mode, 'diagnostic_only': True, 'checkpoint': str(checkpoint),
36
+ 'upstream_revision': '71c3cd7f741311f8100f6cf9cde942b6c1378d11',
37
+ 'weight_policy': 'released raw distilled; original normalization; no optimizer or updates',
38
+ 'expected_generator_parameters': 1619242304, 'expected_vae_parameters': 126892531,
39
+ 'expected_clip_parameters': 1193014785, 'batch_size': 1, 'lora': None, 'lr': None,
40
+ 'activation_checkpointing': False, 'steps': 3, 'shift': 5, 'cache_latents': 6,
41
+ 'decoder': 'official compiled max-autotune-no-cudagraphs',
42
+ 'official_demo': 'unchanged inference.py; supplied painting0000.png; seed0;150latents=597RGB',
43
+ 'minecraft': {'anchor': 699, 'native_latents': 9, 'native_rgb': 33, 'scored_slice': [1, 25],
44
+ 'targets': [700, 724], 'recorded_control_alignment': 'incoming700:724 plus9noops; small_mouse scales camera only',
45
+ 'reference': 'rawRGB with official center crop and frame_process'},
46
+ 'score_caveat': 'Only recorded controls replay GT actions; other modes test stability, not benchmark accuracy',
47
+ 'cases': ([{'image': 'demo_images/universal/0000.png', 'seed': 0}] if args.mode == 'official_demo'
48
+ else [{'index': r['global_test_index'], 'path': r['relative_path'],
49
+ 'seed': 42000000 + int(r['global_test_index'])} for r in rows]),
50
+ 'output_frames_per_case': 597 if args.mode == 'official_demo' else 33}
51
+ if args.dry_run:
52
+ print(json.dumps(manifest, indent=2))
53
+ return
54
+ args.output.mkdir(parents=True, exist_ok=True)
55
+ (args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
56
+ os.chdir(REPO)
57
+ if args.mode == 'official_demo':
58
+ subprocess.run([sys.executable, 'inference.py', '--checkpoint_path', str(checkpoint / 'base_distilled_model/base_distill.safetensors'),
59
+ '--pretrained_model_path', str(checkpoint), '--img_path', 'demo_images/universal/0000.png',
60
+ '--config_path', 'configs/inference_yaml/inference_universal.yaml', '--seed', '0',
61
+ '--num_output_frames', '150', '--output_folder', str(args.output)], check=True)
62
+ from torchvision.io import read_video
63
+ video, _, _ = read_video(str(args.output / 'demo.mp4'), pts_unit='sec')
64
+ assert len(video) == 597
65
+ Image.fromarray(torch.cat([video[t] for t in [0, 1, 2, 24, 100, 596]], dim=1).numpy()).save(args.output / 'samples.jpg')
66
+ else:
67
+ import inference as native
68
+ native.set_seed(0)
69
+ model_args = argparse.Namespace(config_path='configs/inference_yaml/inference_universal.yaml',
70
+ checkpoint_path=str(checkpoint / 'base_distilled_model/base_distill.safetensors'),
71
+ pretrained_model_path=str(checkpoint), num_output_frames=9, seed=0, img_path='', output_folder='')
72
+ engine = native.InteractiveGameInference(model_args)
73
+ manifest['generator_requires_grad_parameters'] = sum(p.numel() for p in engine.pipeline.generator.parameters() if p.requires_grad)
74
+ manifest['inference_grad_policy'] = 'unchanged native no_grad; parameter flags unmodified'
75
+ (args.output / 'manifest.json').write_text(json.dumps(manifest, indent=2))
76
+ original_inference, native_controls = engine.pipeline.inference, native.Bench_actions_universal
77
+ captured = {}
78
+ def capture(**kwargs):
79
+ condition = kwargs['conditional_dict']
80
+ np.savez_compressed(case_dir / 'inputs.npz', initial_noise=kwargs['noise'].float().cpu().numpy(),
81
+ keyboard=condition['keyboard_cond'][0].float().cpu().numpy(), mouse=condition['mouse_cond'][0].float().cpu().numpy())
82
+ videos = original_inference(**kwargs)
83
+ captured['prediction'] = torch.cat(videos, dim=1)[0, 1:25].detach().float().cpu().add(1).div(2)
84
+ return videos
85
+ engine.pipeline.inference = capture
86
+ for row in rows:
87
+ case_dir = args.output / f"case{row['global_test_index']}"
88
+ case_dir.mkdir(exist_ok=True)
89
+ path = args.data_root / row['relative_path']
90
+ rgb = read_frames(path, torch.arange(699, 724))
91
+ images = [Image.fromarray(frame.mul(255).round().byte().permute(1, 2, 0).numpy()) for frame in rgb]
92
+ images[0].save(case_dir / 'input.png')
93
+ reference = torch.stack([engine.frame_process(engine._resizecrop(im, 352, 640)).add(1).div(2) for im in images[1:]])
94
+ with np.load(path.with_suffix('.npz')) as annotation:
95
+ controls = replay_controls(annotation['actions'][700:724], args.mode, 33)
96
+ native.Bench_actions_universal = native_controls if args.mode == 'demo_actions' else lambda length: controls
97
+ model_args.img_path, model_args.output_folder = str(case_dir / 'input.png'), str(case_dir)
98
+ engine.config['mode'] = 'universal'
99
+ native.set_seed(42000000 + int(row['global_test_index']))
100
+ engine.generate_videos()
101
+ save_result(case_dir, 'comparison', captured.pop('prediction'), reference)
102
+ (args.output / 'complete.json').write_text(json.dumps({'mode': args.mode, 'complete': True}))
103
+ print('NATIVE_CONTROL_COMPLETE', flush=True)
104
+
105
+ if __name__ == '__main__':
106
+ main()
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_official_demo_job85112_task0/samples.jpg ADDED

Git LFS Details

  • SHA256: afc3f0021aec173a8117c4f6225346173ef3c3649a7c136c0ccb36d4816563e9
  • Pointer size: 131 Bytes
  • Size of remote file: 277 kB
results/worldmem-baseline-evals/matrix-game2-native-controls/diagnostic_native_recorded_job85112_task3/case0/comparison.jpg ADDED

Git LFS Details

  • SHA256: 79bda2168f937a60d6d0646050f56127c23b7226336fe430e93af62eb4ee9754
  • Pointer size: 131 Bytes
  • Size of remote file: 102 kB