ParamTh commited on
Commit
f942573
·
verified ·
1 Parent(s): 226c283

Add Simulusion 1.1.0 demo checkpoint

Browse files
Files changed (6) hide show
  1. .gitattributes +1 -0
  2. README.md +86 -0
  3. config.yaml +67 -0
  4. iris_curve.png +0 -0
  5. iris_dream.gif +3 -0
  6. model.pt +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ iris_dream.gif filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: simulusion
3
+ license: mit
4
+ pipeline_tag: reinforcement-learning
5
+ tags:
6
+ - simulusion
7
+ - pytorch
8
+ - iris
9
+ - model-based-rl
10
+ - atari
11
+ - transformer
12
+ - world-model
13
+ ---
14
+
15
+ # IRIS on Atari Boxing
16
+
17
+ ![IRIS imagining Boxing token by token](iris_dream.gif)
18
+
19
+ A demo checkpoint from [Simulusion](https://github.com/ParamThakkar123/simulusion), an open-source PyTorch library that puts world models behind one API. It implements the paper **[Transformers are Sample-Efficient World Models (Micheli et al., ICLR 2023)](https://arxiv.org/abs/2209.00588)**.
20
+
21
+ IRIS compresses every frame into 16 discrete tokens with a VQ autoencoder, models the game as a sequence of tokens and actions with a Transformer, and trains its policy only on the Transformer's imagination.
22
+
23
+ ## Results
24
+
25
+ Trained for 300 epochs (60,000 real environment steps) on a 4 GB RTX 3050 laptop GPU. The world model keeps the ring, both boxers and the scoreboard, and the policy has learned to close in and trade punches. In a full round in the real emulator it led 29-21 with 24 seconds left and lost **31-32**: level with the game's built-in opponent, not yet better. The paper reaches about +70 with several times more policy training per epoch.
26
+
27
+ This is a short demo run sized for a laptop GPU, meant to show what the model does. It is **not** a reproduction of the paper's results. More clips and learning curves are in the [gallery](https://paramthakkar123.github.io/simulusion/gallery.html).
28
+
29
+ ## Usage
30
+
31
+ ```bash
32
+ pip install simulusion huggingface_hub
33
+ ```
34
+
35
+ ```python
36
+ from huggingface_hub import snapshot_download
37
+ from simulusion.world_model import load_world_model
38
+
39
+ path = snapshot_download("simillusion/iris-atari-boxing")
40
+ wm = load_world_model(path, "iris") # encode / step / rollout / decode
41
+ ```
42
+
43
+ The same interface works for every world model in Simulusion. To get the full agent:
44
+
45
+ ```python
46
+ from simulusion.models.iris_agent import IRISAgent
47
+
48
+ # The first load also downloads torchvision's VGG16 (528 MB) for the perceptual loss
49
+ agent = IRISAgent.from_pretrained(path)
50
+ ```
51
+
52
+ Checkpoints are plain state dicts and load with `torch.load(..., weights_only=True)`. They include optimizer state, so you can continue training from them.
53
+
54
+ ## Training
55
+
56
+ Reproduce this checkpoint from a clone of the repository:
57
+
58
+ ```bash
59
+ python demos/iris_demo.py train --game ALE/Boxing-v5 --run demos/runs/iris_boxing --until-epoch 300 \
60
+ --autoencoder-steps 200 --transformer-steps 200 --actor-critic-steps 50 --actor-critic-batch 64
61
+ ```
62
+
63
+ ## Citation
64
+
65
+ If you use this model, please cite the original paper:
66
+
67
+ ```bibtex
68
+ @inproceedings{micheli2023iris,
69
+ title = {Transformers are Sample-Efficient World Models},
70
+ author = {Micheli, Vincent and Alonso, Eloi and Fleuret, Fran{\c{c}}ois},
71
+ booktitle = {International Conference on Learning Representations},
72
+ year = {2023},
73
+ url = {https://arxiv.org/abs/2209.00588},
74
+ }
75
+ ```
76
+
77
+ and Simulusion:
78
+
79
+ ```bibtex
80
+ @software{simulusion,
81
+ title = {Simulusion: a PyTorch library for world models},
82
+ author = {Thakkar, Param},
83
+ year = {2026},
84
+ url = {https://github.com/ParamThakkar123/simulusion},
85
+ }
86
+ ```
config.yaml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ action_repeat: 4
2
+ actor_critic_batch_size: 64
3
+ actor_critic_steps_per_epoch: 50
4
+ actor_hidden_size: 512
5
+ actor_layers: 1
6
+ actor_learning_rate: 0.0001
7
+ adam_beta1: 0.9
8
+ adam_beta2: 0.999
9
+ atari_100k: true
10
+ autoencoder_batch_size: 64
11
+ burn_in_length: 20
12
+ checkpoint_interval: 50
13
+ collect_epsilon: 0.01
14
+ collect_temperature: 1.0
15
+ collection_epochs: 500
16
+ commitment_weight: 1.0
17
+ decoder_depth: 64
18
+ discount: 0.995
19
+ early_stopping: false
20
+ encoder_channels: 64
21
+ encoder_layers: 4
22
+ encoder_residual_blocks: 2
23
+ entropy_coef: 0.001
24
+ env: ALE/Pong-v5
25
+ env_backend: gym
26
+ env_steps_per_epoch: 200
27
+ eval_episodes: 100
28
+ eval_temperature: 0.5
29
+ frame_channels: 3
30
+ frame_height: 64
31
+ frame_width: 64
32
+ grad_clip_norm: 10.0
33
+ gradient_checkpointing: true
34
+ imagination_horizon: 20
35
+ log_interval: 1000
36
+ max_env_steps: 100000
37
+ max_episode_steps: 27000
38
+ min_delta: 0.0001
39
+ model_learning_rate: 0.0001
40
+ patience: 10
41
+ perceptual_blocks: 5
42
+ perceptual_linear_weights: ''
43
+ perceptual_weight: 1.0
44
+ quantizer: gradient
45
+ reconstruction_weight: 1.0
46
+ repeat_action_probability: 0.0
47
+ reward_loss: cross_entropy
48
+ reward_transform: sign
49
+ start_actor_critic_after: 50
50
+ start_autoencoder_after: 5
51
+ start_transformer_after: 25
52
+ td_lambda: 0.95
53
+ token_embedding_dim: 512
54
+ tokens_per_frame: 16
55
+ total_epochs: 600
56
+ training_steps_per_epoch: 200
57
+ transformer_batch_size: 16
58
+ transformer_dropout: 0.1
59
+ transformer_embed_dim: 256
60
+ transformer_heads: 4
61
+ transformer_layers: 10
62
+ transformer_steps_per_epoch: 200
63
+ transformer_timesteps: 20
64
+ use_amp: true
65
+ value_learning_rate: 0.0001
66
+ vocab_size: 512
67
+ weight_decay: 0.01
iris_curve.png ADDED
iris_dream.gif ADDED

Git LFS Details

  • SHA256: 5d5b96358d15e8a7cedfd82c174bf157ba2768110201d9b877cccf8e26b7e914
  • Pointer size: 131 Bytes
  • Size of remote file: 639 kB
model.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:46e997fd903e66b3c1e789c8cbe80166ed4412d81ab23a99507b25686035c384
3
+ size 174388401