Skip to main content

A Modular Pytorch Based library for training world models

Project description

TorchWM

TorchWM is a modular PyTorch library for world models and latent dynamics learning. It includes practical implementations of Dreamer-style agents, PlaNet/RSSM utilities, JEPA-style representation learning, and diffusion/transformer building blocks.

Highlights

  • Modular components for encoders, decoders, RSSMs, reward/value heads, and policies
  • Modular RSSM with swappable encoder/decoder/backbone for research experiments
  • Multiple environment backends: DMC, Gym/Gymnasium, Atari, MuJoCo, Unity ML-Agents
  • Replay/memory utilities for both Dreamer and PlaNet-style training loops
  • ViT + masking utilities for JEPA workflows
  • Diffusion utilities (DDPM schedule + DiT model)

Installation

Install from PyPI:

pip install torchwm

Install from source:

git clone https://github.com/ParamThakkar123/torchwm.git
cd torchwm
pip install -e .

Development extras:

pip install -e ".[dev]"

Quick Start

Train Dreamer on Gym

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

cfg = DreamerConfig()
cfg.env_backend = "gym"  # dmc | gym | unity_mlagents
cfg.env = "Pendulum-v1"
cfg.total_steps = 10_000

agent = DreamerAgent(cfg)
agent.train()

Train Dreamer on Unity ML-Agents

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

cfg = DreamerConfig()
cfg.env_backend = "unity_mlagents"
cfg.unity_file_name = r"E:\UnityBuilds\MyEnv.exe"
cfg.unity_behavior_name = "MyBehavior"
cfg.unity_no_graphics = True
cfg.unity_time_scale = 20.0

agent = DreamerAgent(cfg)
agent.train()

Train JEPA

from world_models.models import JEPAAgent
from world_models.configs import JEPAConfig

cfg = JEPAConfig()
cfg.dataset = "imagefolder"
cfg.root_path = "./data"
cfg.image_folder = "train"
cfg.epochs = 10

agent = JEPAAgent(cfg)
agent.train()

Documentation

  • Sphinx source: docs/source
  • Getting started guide: docs/source/getting_started.md
  • Package overview: docs/source/package_overview.md
  • API reference (autodoc): docs/source/api_reference.rst

Build HTML docs locally:

sphinx-build -b html docs/source docs/build/html

Package Layout

  • world_models/models: Agents and model architectures (Dreamer, JEPAAgent, Planet, ViT, diffusion)
  • world_models/models/modular_rssm: Modular RSSM with swappable encoder/decoder/backbone
  • world_models/configs: Config classes (DreamerConfig, JEPAConfig, DiTConfig)
  • world_models/envs: Environment adapters and wrappers
  • world_models/training: Script-style training entrypoints
  • world_models/datasets: CIFAR10/ImageNet/ImageFolder data loaders
  • world_models/memory: Replay and episodic memory implementations
  • world_models/utils: Training/logging/distributed helper utilities

Contributing

Contributions are welcome. See CONTRIBUTING.md.

License

MIT. See LICENSE.

Citation

@misc{Thakkar_GitHub_-_ParamThakkar123_torchwm,
author = {Thakkar, Param},
title = {{GitHub - ParamThakkar123/torchwm: A modular PyTorch library designed for learning, training, and deploying world models across various environments.}},
year = {2025},
url = {https://github.com/ParamThakkar123/torchwm}
}

Package: torchwm on PyPI

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.3.1.tar.gz (143.7 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.3.1-py3-none-any.whl (155.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: torchwm-0.3.1.tar.gz
  • Upload date:
  • Size: 143.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for torchwm-0.3.1.tar.gz
Algorithm Hash digest
SHA256 5237a76ca1ef2754963802a4b9291c5d85d43a5939c07ea7d28a176e34a23242
MD5 8971d69e18a5434c1400d8667a4c64c2
BLAKE2b-256 4ffbb6ad8eb194e2549077599b9583b0073563abb740f0eb722f0376013ccaf7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: torchwm-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 155.1 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.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ee5949440f76c713db4eee219eaaf01f4f7a911c0458970215d82999182fe42
MD5 5d86646c6b44bc2750057bc5344bdc69
BLAKE2b-256 6b0e861f279848bb7a23d769f6125e100916ae8489178b3b2e7740a629504616

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