rssmlite
A lightweight, well-documented, PyTorch-only library for learning RSSM-based (Recurrent State-Space Model) world models — in the DreamerV2/V3 tradition — on Gymnasium environments. Designed to run end-to-end on a free Google Colab T4 GPU with zero external datasets.
Status: core library complete and released at
v0.1.0.RSSM,ReplayBuffer,RSSMAgent, four environment configs,scripts/train.pyCLI, checkpoint save/resume, and full documentation are all implemented and tested (29 tests passing).World model component: production-quality. Reconstruction MSE ~0.004 on CartPole, near-perfect pole-angle tracking confirmed on a real Colab T4.
Actor-critic component: research-grade. Correct implementation of DreamerV3-style imagination-based AC with EMA critic target, but does not reliably solve CartPole within 200k steps on a small model. This is a known limitation of imagination-based RL at small model scale — documented honestly in
configs/cartpole.yaml. TheP2roadmap (TransformerDynamics ablation) is the next planned improvement.
Install
pip install rssmlite[envs] # + gymnasium
pip install rssmlite[envs,viz] # + matplotlib for plots
From source (development):
git clone https://github.com/Mattral/rssmlite.git
cd rssmlite
pip install -e ".[dev,envs,viz]"
pytest tests/ # 21 passed
Quick start
import gymnasium as gym
from rssmlite import RSSMAgent
env = gym.make("CartPole-v1")
agent = RSSMAgent.from_config("configs/cartpole.yaml", env=env)
agent.train(env, steps=200_000, checkpoint_dir="./ckpts")
# Inspect what the model learned
agent.imagine_rollout(steps=15)
agent.visualize_latent_space()
Or via the CLI:
python scripts/train.py --config configs/cartpole.yaml
python scripts/train.py --config configs/cartpole.yaml --resume ckpts/checkpoint_50000.pt
Design philosophy
- PyTorch only. No JAX, no TensorFlow.
- Readable over clever. Every class should be understandable in under 10 minutes top-to-bottom. If it's longer, it gets split.
- Config-driven experiments, code-driven architecture. Hyperparameters and environment choice live in YAML; the model code doesn't change per run.
- Self-contained. No external dataset downloads — the environment is the data source.
Available environments
| Config | Env | Actions | Notes |
|---|---|---|---|
configs/cartpole.yaml |
CartPole-v1 | Discrete | Fastest sanity check |
configs/acrobot.yaml |
Acrobot-v1 | Discrete | Sparse reward stress test |
configs/pendulum.yaml |
Pendulum-v1 | Continuous | Exercises continuous actor |
configs/lunarlander.yaml |
LunarLander-v3 | Discrete | Hardest in v1 scope |
Documentation
docs/architecture.md— RSSM math, design rationale, file mapdocs/getting_started.md— install, first training run, evaluationdocs/api_reference.md— full public APIdocs/colab_guide.md— Colab setup, Drive checkpointing, disconnect recovery
Known simplifications (documented, not hidden)
- Continuous actions (Pendulum) have no tanh squashing — actions can technically exceed the env's valid range; Gym clips silently. Fine for current results; to fix before reporting serious Pendulum numbers.
train.stepsis a total budget across the whole run including pre-resume time. Resuming from step 80 000 withsteps: 200000trains until 200 000.- Device management is explicit: call
.to(device)onagent.rssm,agent.actor,agent.criticmanually. Seedocs/colab_guide.md.
License
MIT — see LICENSE.
Metadata
Release files for rssmlite 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rssmlite-0.1.0.tar.gz | 27.1 kB | Without provenance | Details for rssmlite-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rssmlite-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for rssmlite-0.1.0-py3-none-any.whl |
Total release size: 50.9 kB
Release files / rssmlite-0.1.0.tar.gz
| Download URL | rssmlite-0.1.0.tar.gz |
|---|---|
| Size | 27.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7ac84927a345eb9691fd4cdbeebfa67fff135bed65c5f7795a6a0a2bf254547c
|
|
BLAKE2b-256 checksum How to use checksums |
0c3133293706f8cd93183acd26efd84a174b2151ce1e3019497157793c2920d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / rssmlite-0.1.0-py3-none-any.whl
| Download URL | rssmlite-0.1.0-py3-none-any.whl |
|---|---|
| Size | 23.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
93e8d71f6901e1a7a5d1c32f1ea7ff02aa7f360bbd9f76c0e87cee564ee561ea
|
|
BLAKE2b-256 checksum How to use checksums |
11e7407de3ef806c5f531b92909f11aea51b20fc4ebcb2dc1ddd3938feb5d7db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for rssmlite 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.