Skip to main content

A Modular Pytorch Based library for training world models

Project description

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.

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

torchwm-0.4.2.tar.gz (245.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torchwm-0.4.2-py3-none-any.whl (254.0 kB view details)

Uploaded Python 3

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

Hashes for torchwm-0.4.2.tar.gz
Algorithm Hash digest
SHA256 74d8a89e3bf64358f28943e5a0e34fdd82a572235f4001edbaecbcf446c9b3f5
MD5 f509e77ce3b012624589116daa207938
BLAKE2b-256 271a44715acbf89f10c67e8eedc9e25012aa87d287bff10371151d2a2a892e03

See more details on using hashes here.

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

Hashes for torchwm-0.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8a2218d3245db18f9e80750890d5f6adb19980521f3d85876c955bf4603f220a
MD5 04b39f4cc2997b822515136b29d46bb6
BLAKE2b-256 58b3577034365304096abecd82c5069735594354603292c3302f8715d9c36497

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page