

World models for PyTorch. Learn how a world evolves, then plan by imagining what comes next. Shared parts keep every model short and easy to compare.
uv add torch_worldModel families
Models grouped by how they learn: JEPA, from image pretraining to multi-robot control; DINO; TD-MPC, for reward-driven control; and world action models, which imagine video and act. More families are coming.
One world-model interface
encode,predictandrolloutare the same for every world model, so they can be trained, compared and planned with interchangeably.Planning
Search for actions inside a model's imagination. The cross-entropy method works with any world model, with no extra code.
Environments
190 environments: 33 built-in tasks from planning puzzles to Franka manipulation, plus OGBench, DMControl, Meta-World, ManiSkill, MyoSuite, RoboCasa and RoboDojo.
Datasets
Windows over collected experience for training dynamics, plus medical images and questions for vision-language models.
Building blocks
Vision transformers for images and video, conditioned predictors, masking strategies and objectives, shared by every family.
Environments
190 environments: 33 built-in, 13 from OGBench, 20 from DMControl, 10 from Meta-World, 12 from ManiSkill, 10 from MyoSuite, 50 from RoboCasa and 42 from RoboDojo. Built-in tasks show a verified successful episode; OGBench tasks replay an episode of their dataset, Meta-World tasks its scripted expert, DMControl, ManiSkill and MyoSuite tasks a random policy, RoboCasa tasks a human demonstration, and RoboDojo tasks its official task video. See Environments for each one.
Arrange Bread Basket
stack bowls
Checkpoints
acrobot-swingup
Arrange Tea
push T
pointmaze-medium-navigate
PickCube-v1
IceMaze
reach-v3
myoFingerReachRandom-v0
Bread Selection
pack objects into box
Categorize Condiments
ball_in_cup-catch
KeyDoor
fold clothes
Close Blender Lid
hang mugs
Maze
Close Fridge
antmaze-medium-navigate
cartpole-balance
PushCube-v1
Close Toaster Oven Door
sweep blocks
Sokoban
push-v3
myoFingerPoseRandom-v0
Coffee Setup Mug
pour liquid into cup
Cutting Tool Selection
BallPlate
cartpole-balance_sparse
make toast
Deliver Straw
visual-antmaze-medium-navigate
arrange largest number
CartpoleSwingup
PullCube-v1
Garnish Pancake
cartpole-swingup
sort nesting dolls by size
Gather Tableware
ReactionWheel
pick-place-v3
myoElbowPose1D6MRandom-v0
Get Toasted Bread
store laptop and headphones
NewtonAcrobot
humanoidmaze-medium-navigate
Heat Kebab Sandwich
stack blocks
cartpole-swingup_sparse
Kettle Boiling
PokeCube-v1
NewtonPendulum
fasten screws
Load Dishwasher
insert tubes
Contributors
pytorch-world is built in the open. Thank you to everyone who contributes code, models, environments and ideas.
Thirty seconds
from torch_world.envs import PointMass
from torch_world.models import LeWM
from torch_world.nn import CLSEncoder
from torch_world.planning import CEM
model = LeWM(CLSEncoder(img_size=32, patch_size=8, embed_dim=64), action_dim=2, embed_dim=64)
episodes = PointMass(batch_size=64).collect(4) # pixels (64, 4, 3, 32, 32), actions (64, 4, 2)
loss = model(episodes["pixels"], episodes["actions"])["loss"] # prediction + SIGReg
model.eval()
z, goal = model.encode(episodes["pixels"][:, :1]), model.encode(episodes["pixels"][:, -1:])[:, 0]
actions = CEM(horizon=5, action_dim=2)(model, z, goal) # (64, 5, 2)This trains LeWM, a JEPA world model, on a point mass and plans toward a goal image. Read the quick start for what each line does, or open the tour notebook.
