Transformers are Sample-Efficient World Models: A Guide to IRIS

Jul 9, 2021 | Data Science

Welcome to our guide on the fascinating world of IRIS, an advanced agent built on a sample-efficient world model using Transformers. In this article, we will walk you through how to set up and run IRIS effectively, providing you with troubleshooting tips along the way. Let’s dive in!

What is IRIS?

IRIS represents an innovative data-efficient agent trained over millions of imagined trajectories in a world model. It uniquely fuses a discrete autoencoder and an autoregressive Transformer to approach dynamics learning as a sequence modeling problem. This translates to the autoencoder crafting a “language” of image tokens that the Transformer then orchestrates over time.

Getting Started with IRIS

To set up and run the IRIS agent, follow the steps outlined below:

Step 1: Setup Your Environment

  • Install PyTorch (focused on torch==1.11.0 and torchvision==0.12.0).
  • Install other necessary dependencies by executing:
    pip install -r requirements.txt
  • Warning: Atari ROMs will be downloaded with these dependencies, meaning you must acknowledge that you have the license to use them.

Step 2: Launch a Training Run

Train the model by running the following command:

bash python src/main.py env.train.id=BreakoutNoFrameskip-v4 common.device=cuda:0 wandb.mode=online

By default, logs are synced to Weights & Biases. Set wandb.mode=disabled if you want to turn this feature off.

Step 3: Configuration Management

All configuration files are located in the config folder, with the main configuration file being config/trainer.yaml. Edit these files directly for customization. For detailed insights, refer to Hydra.

Step 4: Organize Run Output

Each new run will create a folder structured as follows:

  • outputs/YYYY-MM-DD/hh-mm-ss
    • checkpoints: Last model and optimizer checkpoint.
    • media: Contains training, testing, and imagination episode visualizations.
    • scripts: Run various scripts such as eval.py, play.sh, and resume.sh.

Step 5: Visualizing Runs

Use play.sh to visualize the agent’s gameplay. Various flags enhance interactivity, such as displaying original frames, viewing reconstructions, and saving video recordings. Check the script for more options:

./scripts/play.sh -h

Troubleshooting Tips

Here are some common issues you might encounter while working with IRIS, along with their solutions:

  • If you face installation issues with PyTorch or dependencies, double-check your Python version and ensure compatibility with the versions specified.
  • For unexpected crashes during training, it may be helpful to check the available GPU memory or switch to wandb.mode=disabled for local runs.
  • When visualizations do not display as intended, verify that the required files are located in the correct output directories.

For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.

Additional Resources

Make use of the results/results_iris.ipynb notebook to reproduce the figures from the paper. Pretrained models are available here. Refer to the links for further exploration of games and training runs!

Final Thoughts

At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

With this guide, you’re now ready to embark on your journey with IRIS and explore the fascinating world of Transformers in the realm of AI. Happy training!

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox