PyTorch World (torch_world) is a library of world models for PyTorch. It gives world-model research shared parts (layers, masking, objectives, planners, environments) so that a new model is a short file and existing models are easy to compare.
uv add torch_world # core: depends only on torch
uv add "torch_world[examples]" # + matplotlib, for the notebooks' figures
uv add "torch_world[action]" # + mujoco, for the RobotCube arms and Push-T
Quick start
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)
Structure
| module | contents |
|---|---|
torch_world.nn |
VisionTransformer (image and video), MaskedPredictor, Transformer, Block, AdaLNBlock, Attention, MLP, sin-cos and rotary positions; ready encoders CLSEncoder, PixelPatches and PatchTokens.from_hub (DINOv2); TextEncoder and WordTokenizer |
torch_world.masks |
MultiBlockMask (2D), MultiBlock3DMask (video), frame_causal_mask, apply_masks |
torch_world.losses |
SIGReg, info_nce |
torch_world.models |
the JEPA and WorldModel base classes and the models below |
torch_world.planning |
CEM, for any WorldModel, scoring the final or every imagined step |
torch_world.envs |
MuJoCo worlds: RobotCube (reach or pick-and-place with a UR10e or SO-101 arm, after OGBench cube-single) and PushT; the batched pixel worlds Macaw and PointMass; run_policy |
torch_world.datasets |
TrajectoryDataset, sliding windows over episodes; MedMNIST and MedicalVQA, templated medical VQA in the style of MMBU |
torch_world.evaluation |
goal_reaching for planners in any environment, with success rates and recorded videos; vqa and compare for retrieval question answering, with a shuffled-image control |
torch_world.metrics |
the metrics of the papers: linear, k-NN and attentive probes, RankMe, LiDAR, rollout error, SSIM, PSNR, Chamfer distance, recall@k; for robotics, success rates with confidence intervals, steps to success, progress, SPL and smoothness |
torch_world.utils |
ema_update, linear_schedule, recompute_batchnorm |
torch_world.plots |
matplotlib figures for notebooks (optional dependency) |
Models
JEPA
| model | paper | reference code | notebook |
|---|---|---|---|
IJEPA |
Assran et al., 2023 | facebookresearch/ijepa | vision/ijepa |
VJEPA (and V-JEPA 2) |
Bardes et al., 2024, Assran et al., 2025 | facebookresearch/jepa, facebookresearch/vjepa2 | vision/vjepa |
LeJEPA |
Balestriero & LeCun, 2025 | galilai-group/lejepa | vision/lejepa |
VLJEPA |
Chen et al., 2026 | not released | vqa/vljepa |
LeWAM |
Fu et al., 2026 | MinghaoFu/lewam | action/lewam |
LeWM |
Maes et al., 2026 | lucas-maes/le-wm | action/lewm |
DINOWM |
Zhou et al., 2025 | gaoyuezhou/dino_wm | action/dinowm |
RoboJEPA |
Zholus et al., 2026 | facebookresearch/robo_jepa | action/robojepa |
Joint-embedding predictive architectures (JEPAs) predict the representation of a target from the representation of a context, instead of reconstructing pixels. Action-conditioned JEPAs are world models: they predict the next latent state from the current one and an action, and planning searches for the actions that bring the imagined latent closest to a goal.
Environment benchmarks
Work with 138 environments: 33 built-in tasks (28 new tasks and five benchmark recipes for the original environments), 13 from OGBench, 50 from RoboCasa and 42 from RoboDojo. Discover the built-in, OGBench and RoboCasa tasks with torch_world.envs.list_envs() and create them with make(id): planning puzzles, MuJoCo manipulation and control, Newton articulated dynamics, Isaac Lab robotics and kitchen tasks. RoboDojo's dual-arm tasks are evaluated by RoboDojo's own client, which a torch-world policy serves through XPolicyLab. Setup and contributor API.
from torch_world.envs import KeyDoor
from torch_world.benchmarks import run_experiment
world = KeyDoor()
world.show_env() # initial state and GT
result = run_experiment(world, output_dir="runs/benchmarks")
world.show_success()
world.close()
One notebook per task, grouped by category folder (puzzles/, control/, navigation/, manipulation/), uses LeWM and CEM from the library, with replaceable model/planner factories. Executed notebooks include measured results, tables, GT references, and episode GIFs for all 28 tasks, including actual Franka camera views. The folders also include PointMass, Macaw, PushT, and both RobotCube arms. torch_world.benchmarks.run_experiment(..., output_dir="runs/benchmarks") saves versioned run artifacts; write_summary combines completed runs into a benchmark CSV.
Visual quality defaults to high (128-pixel RGB inputs, 512-pixel previews/GIFs). Use quality="low" or "medium", or set size and render_size separately. Franka supports camera="task" / "overview" and observation="rgb" / "state".
Adding a model
Subclass JEPA (representation learning) or WorldModel (action-conditioned dynamics) and build it from the shared modules. A WorldModel that implements encode, predict and forward gets rollout, cost and CEM planning with no extra code. See examples/custom_model.ipynb and CONTRIBUTING.md.
Tests
pytest
Contributors
Contributions are welcome: see CONTRIBUTING.md.
Supported by
License
Apache 2.0
Metadata
Release files for torch-world 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| torch_world-0.2.0.tar.gz | 73.3 MB | With provenance | Details for torch_world-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| torch_world-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for torch_world-0.2.0-py3-none-any.whl |
Total release size: 74.5 MB
Release files / torch_world-0.2.0.tar.gz
| Download URL | torch_world-0.2.0.tar.gz |
|---|---|
| Size | 73.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7416da0a4ec8228a2fc65e8f29068bf952c137e4ef5dcb61172ac258db2f13b
|
|
BLAKE2b-256 checksum How to use checksums |
625f20acf585edf5bd464a66545d438c4a2796d81ec1eda3f61c23988d3cde0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logRelease files / torch_world-0.2.0-py3-none-any.whl
| Download URL | torch_world-0.2.0-py3-none-any.whl |
|---|---|
| Size | 1.2 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9115046e7025b446ec9c7cc58eba1164e55e1d87a4fedcf9dc60fac9fbc1138a
|
|
BLAKE2b-256 checksum How to use checksums |
baac282e6ef0b2935dd7aa0e2dc39186c4fa2ac15abb375d7417667dec0b72b7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logSecurity for torch-world 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for torch_world-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 18, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.