lzhts1 commited on
Commit
26eef82
·
verified ·
1 Parent(s): 567e51a

Upload 3 files

Browse files
Files changed (3) hide show
  1. eval_scene.py +26 -0
  2. train_hyperbolic_scene.py +46 -0
  3. train_scene.py +46 -0
eval_scene.py ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Evaluate the original LeWM model on OGBench Scene.
3
+
4
+ Example:
5
+ MUJOCO_GL=egl python eval_scene.py \
6
+ policy=/data_nvme/user/zliu681/le-wm-main/lewm_cache/ogbench_scene/lewm_scene/lewm_scene_epoch_10 \
7
+ solver.device=auto \
8
+ eval.num_eval=50 \
9
+ eval.save_video=True
10
+ """
11
+
12
+ import faulthandler
13
+ import sys
14
+
15
+ from eval import run
16
+
17
+
18
+ def _has_config_name(argv: list[str]) -> bool:
19
+ return any(arg == "--config-name" or arg.startswith("--config-name=") for arg in argv)
20
+
21
+
22
+ if __name__ == "__main__":
23
+ faulthandler.enable(all_threads=True)
24
+ if not _has_config_name(sys.argv):
25
+ sys.argv.insert(1, "--config-name=scene")
26
+ run()
train_hyperbolic_scene.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Train the HyperbolicJEPA variant on OGBench Scene.
3
+
4
+ Example:
5
+ MUJOCO_GL=egl python train_hyperbolic_scene.py \
6
+ trainer.accelerator=gpu \
7
+ trainer.devices=1 \
8
+ trainer.max_epochs=10 \
9
+ loader.batch_size=128 \
10
+ subdir=ogbench_scene/hyperbolic_scene \
11
+ wandb.enabled=False
12
+
13
+ If your local cache uses a different dataset layout, override the dataset name:
14
+ data.dataset.name=/path/to/visual-scene-play-v0.h5
15
+ """
16
+
17
+ import faulthandler
18
+
19
+ import hydra
20
+
21
+ try:
22
+ from torch.distributed.elastic.multiprocessing.errors import record
23
+ except Exception:
24
+ def record(fn):
25
+ return fn
26
+
27
+ from train_hyperbolic import run_hyperbolic_training
28
+
29
+
30
+ @hydra.main(
31
+ version_base=None,
32
+ config_path="./config/train",
33
+ config_name="lewm_hyperbolic_scene",
34
+ )
35
+ def run(cfg):
36
+ run_hyperbolic_training(cfg)
37
+
38
+
39
+ @record
40
+ def _main():
41
+ faulthandler.enable(all_threads=True)
42
+ run()
43
+
44
+
45
+ if __name__ == "__main__":
46
+ _main()
train_scene.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Train the original LeWM model on OGBench Scene.
3
+
4
+ Example:
5
+ MUJOCO_GL=egl python train_scene.py \
6
+ trainer.accelerator=gpu \
7
+ trainer.devices=1 \
8
+ trainer.max_epochs=10 \
9
+ loader.batch_size=128 \
10
+ subdir=ogbench_scene/lewm_scene \
11
+ wandb.enabled=False
12
+
13
+ If your local cache uses a different dataset layout, override the dataset name:
14
+ data.dataset.name=/path/to/visual-scene-play-v0.h5
15
+ """
16
+
17
+ import faulthandler
18
+
19
+ import hydra
20
+
21
+ try:
22
+ from torch.distributed.elastic.multiprocessing.errors import record
23
+ except Exception:
24
+ def record(fn):
25
+ return fn
26
+
27
+ from train import run_training
28
+
29
+
30
+ @hydra.main(
31
+ version_base=None,
32
+ config_path="./config/train",
33
+ config_name="lewm_scene",
34
+ )
35
+ def run(cfg):
36
+ run_training(cfg)
37
+
38
+
39
+ @record
40
+ def _main():
41
+ faulthandler.enable(all_threads=True)
42
+ run()
43
+
44
+
45
+ if __name__ == "__main__":
46
+ _main()