danijar/dreamerv3: Running DreamerV3 With Fixed Hyperparameters
Mastering Diverse Domains through World Models
At a glance
- What is it?
- A Python and JAX reimplementation of DreamerV3, the world-model reinforcement learning algorithm that trains an actor critic policy from imagined trajectories. This is a guide to what it does, how to install it, and where it stops being the right tool.
- Who is it for?
- Adopt danijar/dreamerv3 if you already work with JAX, need a world-model baseline that does not require per-task hyperparameter tuning, and can supply a GPU or TPU. Do not adopt it if you want a PyTorch training loop, a hosted model, or a first reinforcement learning project.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 52 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 24, 2026, and from our analysis. They are not legal advice.
Star history
- danijar/dreamerv34,014 ★ · +191
| Repository | 2026-09-24 | 2026-11-24 |
|---|---|---|
| danijar/dreamerv3 | 3.8k | 4k |
191 Stars in the last 61 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
What danijar/dreamerv3 solves and who it is for
Reinforcement learning has a reputation problem that has nothing to do with algorithms and everything to do with tuning. A method that wins on one task usually needs its learning rate, batch size, and reward scaling adjusted before it works on the next one. DreamerV3 is aimed squarely at that. The README describes it as a scalable and general reinforcement learning algorithm that masters a wide range of applications with fixed hyperparameters, and it argues that removing the need for tuning reduces the amount of expert knowledge and computational resources needed to apply reinforcement learning.
The audience is narrow and specific. This is a research codebase, not a library with a stable API. The setup.py classifiers list Intended Audience :: Science/Research, and the package is named dreamer at version 3.3.1. If your job is to produce a trained agent on a benchmark and compare it against other methods, the fixed-hyperparameter claim is the whole value proposition. If your job is to ship an agent into a product, the repository layout will not help you much.
One thing worth reading carefully is the disclaimer. The repository states that it contains a reimplementation of DreamerV3 based on the open source DreamerV2 code base, that it is unrelated to Google or DeepMind, and that the implementation has been tested to reproduce the official results on a range of environments. That is a claim about reproduction, not about being the reference implementation.
The world model, the imagined trajectories, and the actor critic
The mechanism is described in the README in three sentences, and they are worth unpacking. 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.
So the data flow has two loops. The outer loop collects real experience from the environment. The inner loop does not touch the environment at all: it rolls the learned world model forward, generating imagined trajectories, and the actor critic is trained on those. The environment is only needed to keep the world model honest. This is why the algorithm can be more data-efficient than model-free methods, and it is also why a bad world model poisons everything downstream. If the model predicts rewards well but represents states poorly, the policy will be optimized against a fiction.
The categorical representation choice matters for the scaling claim. The README says that using larger models consistently increases not only final performance but also data-efficiency, and that increasing the number of gradient steps further increases data efficiency. That is an unusual combination: normally you trade compute for samples, and here the README claims you get both. The repository ships a baselines.yaml and a scores/ directory alongside the code, which is where the comparison numbers live rather than in the README prose.
Installing danijar/dreamerv3 and running a first training job
The README states the code has been tested on Linux and Mac and requires Python 3.11 or newer. There are two paths: a provided Dockerfile, or manual installation. The manual path starts by installing JAX, then the remaining dependencies from requirements.txt.
pip install -U -r requirements.txtThat file pins jax[cuda12]==0.4.33 and numpy<2, with a comment noting that DMLab needs numpy below 2 and MineRLv1.0 needs it below 1.24. If you are not on CUDA 12, the Dockerfile is the safer starting point because it installs jax[cuda]==0.5.0 separately after the environment packages.
The README gives this training command, which trains on Crafter:
python dreamerv3/main.py \
--logdir ~/logdir/dreamer/{timestamp} \
--configs crafter \
--run.train_ratio 32Expect a logdir to appear under your home directory with checkpoints and metrics inside it. To reproduce results on another task, the README says to train on the desired task using the corresponding config, such as --configs atari --task atari_pong. Config blocks compose: the README notes that multiple blocks override defaults in the order specified, for example --configs crafter size50m.
For a quick smoke test rather than a real run, the README describes a debug config block that reduces network size, batch size, and the interval between logs. It explicitly warns that debug does not learn a good model. To watch metrics while training:
pip install -U scope
python -m scope.viewer --basedir ~/logdir --port 8000Metrics are also appended to JSON lines files, and the README notes that other outputs such as WandB and TensorBoard can be enabled in the training script. By default the code tries to run on GPU; --jax.platform cpu switches it.
To resume, the README says to run the same command line again with --logdir pointing at the same directory.
Where the fixed-hyperparameter promise breaks down
The most useful thing in the README is the troubleshooting section, because it is honest about failure modes. If you see a Too many leaves for PyTreeDef error, the cause is a checkpoint that is not compatible with the current config, and the README says this often happens when reusing an old logdir by accident. That is a design consequence of fixed hyperparameters: the architecture is baked into the checkpoint, so changing config blocks after the fact is not a supported operation. There is no documented migration path between configs.
The CUDA advice is similarly blunt. The README says that if you are getting CUDA errors you should scroll up, because the cause is often an error that happened earlier, such as out of memory or incompatible JAX and CUDA versions, and suggests --batch_size 1 to rule out out of memory. In other words, the visible failure is frequently a downstream symptom.
Environment support is the other boundary. Many environments are included, but the README states that some require installing additional packages and points to the Dockerfile for reference. That Dockerfile installs DMLab, ale_py, autorom, procgen_mirror, crafter, dm_control, memory_maze, and a patched MineRL wheel, plus openjdk-8-jdk and MUJOCO_GL=egl. Reproducing that stack by hand on macOS is not a realistic afternoon. The Dockerfile also pins Python 3.11 with a comment that DMLab needs 3.11 or lower, so the Python 3.11+ requirement in the README has an upper bound in practice that the README does not state.
Finally, this is the wrong tool if you want a pretrained model you can call. There is no hosted inference endpoint described in the repository, and the homepage is a project page, not a service.
danijar/dreamerv3 compared with model-free PPO
The natural alternative is a model-free on-policy method such as PPO. The difference in approach is structural, not a matter of implementation quality. PPO optimizes the policy directly against returns sampled from the real environment, so every gradient step costs environment interaction. DreamerV3 inserts a learned model between the two: it spends environment steps training the world model, then spends gradient steps on imagined trajectories that cost no environment interaction at all. That is the trade the README is making when it claims favorable data-efficiency from larger models and more gradient steps.
The cost of that trade is complexity and failure surface. PPO has no world model to be wrong. DreamerV3 has an entire learned simulator in the loop, which means debugging involves two systems, and the README's checkpoint and CUDA notes show how that surfaces in practice. If your environment is cheap to simulate and you have plenty of throughput, the world model buys you less. If environment interaction is the scarce resource, the imagined-trajectory loop is the reason to be here.
A second alternative worth naming is the JAX ecosystem itself. Because this code is built on JAX, jax[cuda12], optax, and ninjax, the practical comparison for many teams is not DreamerV3 against another algorithm but JAX against PyTorch. The README does not offer a PyTorch path, and the related searches around a PyTorch version are not answered by anything in the repository.
Maintenance, licensing, and what an upgrade costs
The repository is not archived, and the last push was on 2026-05-25. The repository has no published GitHub releases, so versioning runs through the setup.py version field, currently 3.3.1, and through the pinned requirements rather than through tagged artifacts.
That pinning is the real upgrade cost. requirements.txt fixes jax[cuda12]==0.4.33 and numpy<2, while the Dockerfile installs jax[cuda]==0.5.0 before copying the same requirements file. Two JAX versions appear in the repository, which means the manual path and the container path are not the same environment. If you upgrade JAX on your own, you are outside what the repository pins, and the README's own note about incompatible JAX and CUDA versions producing CUDA errors is the relevant warning.
The licence is MIT, listed both in the LICENSE file and in the setup.py classifier License :: OSI Approved :: MIT License. That is permissive and imposes no source disclosure obligation on your own code. It says nothing about the environments you train on: Atari ROMs, MineRL, and DMLab each carry their own terms, and the Dockerfile pulls autorom[accept-rom-license] and a separately hosted MineRL wheel. Check those separately; this is not legal advice.
Editorial conclusion
Adopt danijar/dreamerv3 if you already work with JAX, need a world-model baseline that does not require per-task hyperparameter tuning, and can supply a GPU or TPU. Do not adopt it if you want a PyTorch training loop, a hosted model, or a first reinforcement learning project. Before you commit, verify that your Python is 3.11 or newer, that the environment you care about is among those the Dockerfile installs, and that your checkpoint and config stay paired, because the README states that a mismatched checkpoint produces a Too many leaves for PyTreeDef error.
Frequently asked questions
What is danijar/dreamerv3?
It is a reimplementation of DreamerV3, a reinforcement learning algorithm that learns a world model from experience and trains an actor critic policy on imagined trajectories. The README describes it as scalable and general, mastering a wide range of applications with fixed hyperparameters.
How do I use danijar/dreamerv3?
Install the dependencies from requirements.txt after installing JAX, then run dreamerv3/main.py with a --logdir and a --configs block such as crafter, and optionally a --task. The README also shows resuming by running the same command with the same logdir.
How does danijar/dreamerv3 compare with PPO?
PPO optimizes the policy directly from environment returns, so every gradient step needs real interaction. DreamerV3 trains the actor critic on trajectories imagined by a learned world model, which the README frames as a data-efficiency advantage, at the cost of an extra learned component that can be wrong.
What is a reinforcement learning world model?
In danijar/dreamerv3 the world model encodes sensory inputs into categorical representations and predicts future representations and rewards given actions. The policy is then trained inside that learned model rather than in the real environment.
How do I train a world model with danijar/dreamerv3?
Training the world model is not a separate step in this codebase. The README's single training command runs the full loop, and the debug config block reduces network and batch size for fast iteration while explicitly not learning a good model.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/danijar-dreamerv3)Star history chart for your README
[](https://hysenlabs.com/projects/danijar-dreamerv3)Was this useful?