Implementation of Rigidformer
Project description
Rigidformer (wip)
Implementation of RigidFormer, Learning Rigid Dynamics using Transformers, out of MIT and Meta
Install
$ pip install rigidformer
Usage
import torch
from rigidformer import Rigidformer
# instantiate model
model = Rigidformer(
dim = 256,
dim_head = 192,
heads = 8,
object_self_attn_depth = 4,
anchor_cross_attn_depth = 4,
num_anchors = 4,
object_hidden_layers = (0, 1, 2, 4),
vertex_properties_dim = 3
)
# mock inputs
delta_times = torch.randn(2)
vertex_properties = torch.randn(2, 4, 3) # (batch, num_objects, d_attr)
object_pos = torch.randn(2, 4, 64, 3) # (batch, num_objects, num_points, 3)
object_pos_prev = torch.randn(2, 4, 64, 3)
object_pos_next = torch.randn(2, 4, 64, 3)
# training
loss, loss_breakdown = model(
delta_times = delta_times,
vertex_properties = vertex_properties,
object_pos = object_pos,
object_pos_prev = object_pos_prev,
object_pos_next = object_pos_next # target
)
loss.backward()
# if `object_pos_next` not passed in, will return predictions
pred = model(
delta_times = delta_times,
vertex_properties = vertex_properties,
object_pos = object_pos,
object_pos_prev = object_pos_prev,
)
assert pred.object_pos_next.shape == object_pos.shape
# rollout multiple steps with a wrapper
from rigidformer import RigidformerRolloutWrapper
wrapper = RigidformerRolloutWrapper(model)
rollout_positions = wrapper(
num_steps = 10,
delta_times = delta_times,
vertex_properties = vertex_properties,
object_positions = [object_pos_prev, object_pos]
)
# rollout_positions is a list of length 12 tensors of shape (batch, num_objects, num_points, 3)
# includes the 2 initial positions
Citations
@misc{dou2026rigidformerlearningrigiddynamics,
title = {RigidFormer: Learning Rigid Dynamics using Transformers},
author = {Zhiyang Dou and Minghao Guo and Haixu Wu and Doug Roble and Tuur Stuyck and Wojciech Matusik},
year = {2026},
eprint = {2605.09196},
archivePrefix = {arXiv},
primaryClass = {cs.CV},
url = {https://arxiv.org/abs/2605.09196},
}
@inproceedings{Arora2023ZoologyMA,
title = {Zoology: Measuring and Improving Recall in Efficient Language Models},
author = {Simran Arora and Sabri Eyuboglu and Aman Timalsina and Isys Johnson and Michael Poli and James Zou and Atri Rudra and Christopher R'e},
year = {2023},
url = {https://api.semanticscholar.org/CorpusID:266149332}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
rigidformer-0.1.0.tar.gz
(13.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rigidformer-0.1.0.tar.gz.
File metadata
- Download URL: rigidformer-0.1.0.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c417a2a027ddb2a1c1eee76c6637fac4d4393e45b7dc4d269f4f4fcd64cdf4a5
|
|
| MD5 |
655ce51e4b2d96e2c133ce1b73e3c999
|
|
| BLAKE2b-256 |
ad5976af9239ba3efaf731e17bfbf06e145aa8342c8c300b4a6533b842367133
|
File details
Details for the file rigidformer-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rigidformer-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
add3554150a5db8b3a26e9074dab03927065acaa8b9c265de3c2151dba4c5543
|
|
| MD5 |
d4bab929d1a3698f107b021b7975cd8b
|
|
| BLAKE2b-256 |
ff090f20a6a4333ef65171671e0ffde070570144ef7eacd6c7fde0a08d2afc13
|