Skip to main content

TorchWM

TorchWM Logo

PyPI version PyPI downloads License: MIT Documentation

Modular PyTorch Library for World Models


⚡ 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

📖 Full Documentation

Get Started

User Guides

Algorithms

🤝 Community


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


TorchWM is under active development. APIs may change between versions.

Metadata

Release files for torchwm 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for torchwm 0.4.2
File Size Uploaded
torchwm-0.4.2.tar.gz 245.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for torchwm 0.4.2
File Interpreter ABI Platform
torchwm-0.4.2-py3-none-any.whl Python 3 none any Details

Total release size: 499.8 kB

Release files / torchwm-0.4.2.tar.gz

Download URL torchwm-0.4.2.tar.gz
Size 245.8 kB
Tags Source
SHA-256 checksum
How to use checksums
74d8a89e3bf64358f28943e5a0e34fdd82a572235f4001edbaecbcf446c9b3f5
BLAKE2b-256 checksum
How to use checksums
271a44715acbf89f10c67e8eedc9e25012aa87d287bff10371151d2a2a892e03
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release files / torchwm-0.4.2-py3-none-any.whl

Download URL torchwm-0.4.2-py3-none-any.whl
Size 254.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a2218d3245db18f9e80750890d5f6adb19980521f3d85876c955bf4603f220a
BLAKE2b-256 checksum
How to use checksums
58b3577034365304096abecd82c5069735594354603292c3302f8715d9c36497
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.9

Release history Release notifications | RSS feed

This release

0.4.2 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page