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 |
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.
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.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| torch_world-0.0.1.tar.gz | 4.3 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| torch_world-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.4 MB
Release files / torch_world-0.0.1.tar.gz
| Download URL | torch_world-0.0.1.tar.gz |
|---|---|
| Size | 4.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4fa327fdeef5041192c1158dd6d081e007fcc35992eec19c471c618daae48809
|
|
BLAKE2b-256 checksum How to use checksums |
8074f3be0a7ad9a205569601ce458843f8d347296bd6f94e1b68c93baacaa165
|
| 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 13, 2026.
Transparency logRelease files / torch_world-0.0.1-py3-none-any.whl
| Download URL | torch_world-0.0.1-py3-none-any.whl |
|---|---|
| Size | 84.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f27530c1598acd74861b3a1b195566178b103c2de05c1fb7c770a9507b836cf6
|
|
BLAKE2b-256 checksum How to use checksums |
94a30ce325ca36b97a664d400011e9bf4538dc9b04804ece2f810ed861a34526
|
| 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 13, 2026.
Transparency log