Contributing¶
Thanks for helping build pytorch-world. Bug reports, fixes, new models, environments, datasets and documentation are all welcome.
Development setup¶
git clone <repository-url> pytorch-world
cd pytorch-world
uv sync --extra examples --extra action --extra test
| extra | adds |
|---|---|
examples |
matplotlib, for the notebooks and torch_world.plots |
action |
MuJoCo, for the RobotCube arms |
test |
pytest |
Checks¶
Run these before opening a pull request:
Code is formatted and linted with ruff at a line length of 120.
Adding a model¶
- Subclass
JEPAorWorldModelin a new file in its family's folder, for exampletorch_world/models/jepa/_mymodel.py. Build it from the shared modules innn,masksandlosses. See Build your own model. - Write the docstring: what the model predicts, its loss, and the paper and reference code. It becomes the model's API reference.
- Export it from the family's
__init__.pyand fromtorch_world.models. - Add tests under
tests/models/: output shapes, a finite loss, gradients and, for world models, a planning call. - Add a notebook under
examples/that trains it on one of the environments and shows what it learned. - Add a page in its family's folder under
docs/models/(for exampledocs/models/jepa/), link it from the family page and list it inmkdocs.yml.
A new family gets its own folder, torch_world/models/<family>/ and docs/models/<family>/, with an index page that says what the family has in common.
Documentation¶
The site is built with Material for MkDocs from docs/. API pages are generated from docstrings and the notebooks are rendered with their saved outputs, so run a notebook before committing it.
Pushes to main deploy the site to GitHub Pages. This page and CONTRIBUTING.md at the repository root say the same thing; update both.
Pull requests¶
- Keep each pull request to one change: a fix, a model, a feature.
- Add or update tests for the code you touch, and docs for anything user-facing.
- For a model, say how you checked it against the paper or the reference code.
By contributing, you agree that your contributions are licensed under the Apache 2.0 license.