Skip to content

BrunooCS/World-Model-2018

Repository files navigation

World Models PyTorch Implementation 🏎️


Python PyTorch Gymnasium License

A clean, interactive PyTorch implementation of "World Models" by David Ha and Jürgen Schmidhuber.

Car Racing Environment

Overview


This project implements the complete World Models architecture for the CarRacing-v3 environment from Gymnasium. World Models consist of three components:

  1. Vision (V): A Variational Autoencoder (VAE) that compresses raw images into latent representations
  2. Memory (M): A Mixed Density Network with LSTM (MDN-RNN) that predicts future states
  3. Controller (C): A simple neural network policy trained with CMA-ES

Interactive Notebooks


The implementation is organized into interactive notebooks that explain each component:

Notebook Description
1-Rollouts.ipynb Generating dataset from environment interactions
2-Vision (VAE).ipynb Training the Variational Autoencoder
3-Memory (rnn-mdn).ipynb Building the MDN-RNN predictive model
4-Controller (C).ipynb Evolutionary training of the controller
5-Videos.ipynb Generating videos of model performance

Features


  • Pure PyTorch implementation with clean, commented code
  • Interactive Visualization of latent space and model predictions
  • End-to-End Pipeline from data collection to agent training
  • Pre-trained Models included in checkpoints/ directory
  • Modular Design allowing for experimentation with architectures

Visualizations

VAE Latent exploration tools

Latent Space Visualization

Pygmae interactive game visualzation of trained models with keyboard controls

Pygame interactive visualization


@Ha2018WorldModels
Ha, David and Schmidhuber, Jürgen. "World Models." Zenodo, 2018. Link to paper.
Copyright: Creative Commons Attribution 4.0.


License

This project is open-sourced under the MIT License.

About

Modern PyTorch implementation of World Models with interactive notebooks for the Car Racing environment. Features VAE vision model, MDN-RNN memory system, and CMA-ES controller with visualization tools. Complete end-to-end reinforcement learning pipeline with clean, well-documented code.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors