A reimplementation of DreamerV3, a scalable and general reinforcement learning algorithm that masters a wide range of applications with fixed hyperparameters.

If you find this code useful, please reference in your paper:
@article{hafner2025dreamerv3,
title={Mastering diverse control tasks through world models},
author={Hafner, Danijar and Pasukonis, Jurgis and Ba, Jimmy and Lillicrap, Timothy},
journal={Nature},
pages={1--7},
year={2025},
publisher={Nature Publishing Group}
}
To learn more:
DreamerV3 learns a world model from experiences and uses it to train an actor critic policy from imagined trajectories. The world model encodes sensory inputs into categorical representations and predicts future representations and rewards given actions.

DreamerV3 masters a wide range of domains with a fixed set of hyperparameters, outperforming specialized methods. Removing the need for tuning reduces the amount of expert knowledge and computational resources needed to apply reinforcement learning.
Due to its robustness, DreamerV3 shows favorable scaling properties. Notably, using larger models consistently increases not only its final performance but also its data-efficiency. Increasing the number of gradient steps further increases data efficiency.

The code has been tested on Linux and Mac and requires Python 3.11+.
You can either use the provided Dockerfile that contains instructions or
follow the manual instructions below.
Install JAX and then the other dependencies:
pip install -U -r requirements.txt
Training script:
python dreamerv3/main.py \
--logdir ~/logdir/dreamer/{timestamp} \
--configs crafter \
--run.train_ratio 32
To reproduce results, train on the desired task using the corresponding config,
such as --configs atari --task atari_pong.
View results:
pip install -U scope
python -m scope.viewer --basedir ~/logdir --port 8000
Scalar metrics are also writting as JSONL files.
dreamerv3/configs.yaml and you can
override them as flags from the command line.debug config block reduces the network size, batch size, duration
between logs, and so on for fast debugging (but does not learn a good model).--jax.platform cpu flag.--configs crafter size50m.Too many leaves for PyTreeDef error, it means you're
reloading a checkpoint that is not compatible with the current config. This
often happens when reusing an old logdir by accident.--batch_size 1 to rule out an out of memory error.Dockerfile for reference.--logdir points to the same directory.This repository contains a reimplementation of DreamerV3 based on the open source DreamerV2 code base. It is unrelated to Google or DeepMind. The implementation has been tested to reproduce the official results on a range of environments.
$ claude mcp add dreamerv3 \
-- python -m otcore.mcp_server <graph>