A Modular Pytorch Based library for training world models
Project description
TorchWM
⚡ Quick Start
Train Dreamer agents in just 3 lines of code. TorchWM provides a unified interface for training and deploying world models.
Installation
# Core dependencies
pip install torchwm
# With extras
pip install torchwm[gym] # Additional gym environments
pip install torchwm[ml-agents] # Unity ML-Agents
pip install torchwm[ml] # TensorBoard, W&B logging
pip install torchwm[viz] # FastAPI visualization
pip install torchwm[dev] # Testing and linting
Training a Dreamer Agent
Use the friendly top-level API for the common path:
import torchwm
agent = torchwm.create_model(
"dreamer",
env="walker-walk",
total_steps=1_000_000,
)
agent.train()
The lower-level research modules are still available when you need direct control:
from torchwm import DreamerAgent, DreamerConfig
cfg = DreamerConfig()
cfg.env = "walker-walk"
agent = DreamerAgent(cfg)
Creating Environments and Operators
import torchwm
env = torchwm.make_env("CartPole-v1", backend="gym")
op = torchwm.get_operator("dreamer", image_size=64, action_dim=6)
processed = op.process({"image": image, "action": action})
🚀 Features
- 🎯 Unified Interface: Consistent API across all world model algorithms
- 🔧 Modular Components: Swappable encoders, decoders, and backbones
- 🚀 High Performance: Optimized for both training and inference
- 🌍 Multi-Environment: Support for DMC, Gym, Unity, and custom environments
- 📊 Rich Monitoring: Integrated logging with Weights & Biases and TensorBoard
- 🧠 Research Ready: Easy experimentation with different architectures
🧠 Supported Algorithms
| Algorithm | Description | Key Features |
|---|---|---|
| Dreamer | Model-based RL with latent dynamics | Imagination, actor-critic |
| JEPA | Self-supervised visual representations | Masked prediction, ViT |
| IRIS | Sample-efficient RL with Transformers | Discrete VAEs, world models |
| Diamond | Diffusion + RL for continuous control | EDM sampling, value functions |
📖 Documentation
Get Started
User Guides
Algorithms
🤝 Community
- 🐛 Issue Tracker
- 💬 Discussions
- 📧 PyPI
TorchWM is under active development. APIs may change between versions.
:hidden:
:maxdepth: 1
:caption: Get Started
getting_started
installation
:hidden:
:maxdepth: 1
:caption: User Guides
operators_guide
training_guide
inference_guide
environments_guide
package_overview
:hidden:
:maxdepth: 1
:caption: Algorithms
dreamer
jepa
iris
dit
:hidden:
:maxdepth: 1
:caption: Reference
api_reference
configs_reference
:hidden:
:maxdepth: 1
:caption: Development
contributing
benchmarks
:hidden:
:maxdepth: 1
:caption: User Guides
operators_guide
training_guide
inference_guide
environments_guide
package_overview
:hidden:
:maxdepth: 1
:caption: Algorithms
dreamer
jepa
iris
dit
:hidden:
:maxdepth: 1
:caption: Reference
api_reference
configs_reference
:hidden:
:maxdepth: 1
:caption: Development
contributing
benchmarks
⚡ Quick Start
TorchWM provides a unified interface for training and deploying world models.
Installation
pip install torchwm
# or with uv
uv add torch torchvision torchaudio
Training a Dreamer Agent
Use the friendly top-level API for the common path:
import torchwm
agent = torchwm.create_model(
"dreamer",
env="walker-walk",
total_steps=1_000_000,
)
agent.train()
The lower-level research modules are still available when you need direct control:
from torchwm import DreamerAgent, DreamerConfig
cfg = DreamerConfig()
cfg.env = "walker-walk"
agent = DreamerAgent(cfg)
Creating Environments and Operators
import torchwm
env = torchwm.make_env("CartPole-v1", backend="gym")
op = torchwm.get_operator("dreamer", image_size=64, action_dim=6)
processed = op.process({"image": image, "action": action})
Features
- 🎯 Unified Interface: Consistent API across all world model algorithms
- 🔧 Modular Components: Swappable encoders, decoders, and backbones
- 🚀 High Performance: Optimized for both training and inference
- 🌍 Multi-Environment: Support for DMC, Gym, Unity, and custom environments
- 📊 Rich Monitoring: Integrated logging with Weights & Biases and TensorBoard
- 🧠 Research Ready: Easy experimentation with different architectures
🧠 Supported Algorithms
| Algorithm | Description | Key Features |
|---|---|---|
| Dreamer | Model-based RL with latent dynamics | Imagination, actor-critic |
| JEPA | Self-supervised visual representations | Masked prediction, ViT |
| IRIS | Sample-efficient RL with Transformers | Discrete VAEs, world models |
| Diamond | Diffusion + RL for continuous control | EDM sampling, value functions |
🤝 Community
- 📖 Documentation
- 🐛 Issue Tracker
- 💬 Discussions
- 📧 PyPI
TorchWM is under active development. APIs may change between versions.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file torchwm-0.4.2.tar.gz.
File metadata
- Download URL: torchwm-0.4.2.tar.gz
- Upload date:
- Size: 245.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
74d8a89e3bf64358f28943e5a0e34fdd82a572235f4001edbaecbcf446c9b3f5
|
|
| MD5 |
f509e77ce3b012624589116daa207938
|
|
| BLAKE2b-256 |
271a44715acbf89f10c67e8eedc9e25012aa87d287bff10371151d2a2a892e03
|
File details
Details for the file torchwm-0.4.2-py3-none-any.whl.
File metadata
- Download URL: torchwm-0.4.2-py3-none-any.whl
- Upload date:
- Size: 254.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a2218d3245db18f9e80750890d5f6adb19980521f3d85876c955bf4603f220a
|
|
| MD5 |
04b39f4cc2997b822515136b29d46bb6
|
|
| BLAKE2b-256 |
58b3577034365304096abecd82c5069735594354603292c3302f8715d9c36497
|