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

from world_models.models import DreamerAgent
from world_models.configs import DreamerConfig

cfg = DreamerConfig()
cfg.env = "walker-walk"
cfg.total_steps = 1_000_000

agent = DreamerAgent(cfg)
agent.train()

Using Inference Operators

from world_models.inference.operators import DreamerOperator

op = DreamerOperator(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

from world_models.models import DreamerAgent
from world_models.configs import DreamerConfig

cfg = DreamerConfig()
cfg.env = "walker-walk"
cfg.total_steps = 1_000_000

agent = DreamerAgent(cfg)
agent.train()

Using Inference Operators

from world_models.inference.operators import DreamerOperator

op = DreamerOperator(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.0.tar.gz (215.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.0-py3-none-any.whl (235.4 kB view details)

Uploaded Python 3

File details

Details for the file torchwm-0.4.0.tar.gz.

File metadata

  • Download URL: torchwm-0.4.0.tar.gz
  • Upload date:
  • Size: 215.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.0.tar.gz
Algorithm Hash digest
SHA256 ed33b606ac052ea733b13c80ae8a95c9ae4af1cf2f01a73022274a0f4ce66770
MD5 3598d8836bfa19d78d27e059d6eaae74
BLAKE2b-256 c53ab3149909d21ee65dda54b9ff27b18bfe1cf266a29ac0ddfd54c55248c29e

See more details on using hashes here.

File details

Details for the file torchwm-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: torchwm-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 235.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2f18035a591c9ba1bd865350127d5cceb8bb2cbdab1c7c229749bd5c04045fff
MD5 71dd3d7621e5af36d47c54297c8045be
BLAKE2b-256 552de282beb2c837243ca65c7dd66f233e7652e93d82ac56b6a81044c6f8cc51

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