Metadata-Version: 2.5
Name: supermimic-pytorch
Version: 0.1.10
Summary: Unofficial implementation of Supermimic, Scaling Humanoid Whole-Body Control with One Differentiable World Model
Project-URL: Homepage, https://pypi.org/project/supermimic-pytorch/
Project-URL: Repository, https://github.com/lucidrains/supermimic-pytorch
Author-email: Phil Wang <lucidrains@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Phil Wang
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: artificial intelligence,deep learning,robotics,world model
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.10
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.10
Requires-Dist: assoc-scan>=0.0.6
Requires-Dist: discrete-continuous-embed-readout>=0.2.12
Requires-Dist: einops>=0.8.1
Requires-Dist: einx>=0.4.0
Requires-Dist: ema-pytorch>=0.8.3
Requires-Dist: torch-einops-utils>=0.2.8
Requires-Dist: torch>=2.5
Requires-Dist: x-mlps-pytorch>=0.6.14
Provides-Extra: cli
Requires-Dist: accelerate; extra == 'cli'
Requires-Dist: fire; extra == 'cli'
Requires-Dist: memmap-replay-buffer>=0.3.0; extra == 'cli'
Requires-Dist: mujoco>=3.2; extra == 'cli'
Requires-Dist: numpy; extra == 'cli'
Provides-Extra: examples
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'
Description-Content-Type: text/markdown

<img src="./fig2.png" width="400px"></img>

## Supermimic - Pytorch

Unofficial implementation of [Supermimic, Scaling Humanoid Whole-Body Control with One Differentiable World Model](https://supermimic.github.io/), from Qiayuan Liao et al. of Berkeley

## Install

```bash
$ pip install supermimic-pytorch
```

## Usage

```python
import torch
from torch import nn
from x_mlps_pytorch import MLP
from supermimic_pytorch import WorldModel, SuperMimic

world_model = WorldModel(
    dim_state = 71,
    dim_action = 29,
    dim_sim_context = 33
)

actor = MLP(71 + 71, 2048, 1024, 512, 256, 29, activation = nn.GELU())

supermimic = SuperMimic(
    actor = actor,
    world_model = world_model,
    observation_noise_scale = 0.05
)

# logged transitions from any non-differentiable simulator

state = torch.randn(4, 71)
sim_context = torch.randn(4, 33)
logged_actions = torch.randn(4, 32, 29)
logged_next_states = torch.randn(4, 32, 71)
logged_terminals = torch.randint(0, 2, (4, 32)).float()

# fit world model autoregressively on k = 32 window

wm_loss, _, _ = world_model.rollout(
    state,
    logged_actions,
    logged_next_states,
    sim_context = sim_context,
    next_terminals = logged_terminals
)
wm_loss.backward()

# imagine H = 32 steps through frozen world model and train actor via bptt

goals = torch.randn(4, 33, 71)

rollout = supermimic(
    state,
    sim_context = sim_context,
    actor_goals = goals,
    num_rollout_timesteps = 32
)

rewards = -(rollout.states[:, 1:] - goals[:, :-1]).square().mean(dim = -1)

actor_loss = supermimic.actor_loss(
    rewards,
    rollout.terminals
)

actor_loss.backward()
```

## Experiments

Toy `HalfCheetah-v5` experiment - trains an `x-ppo` expert, then tracks an 8-dim pose subset (no velocities or task reward) through the learned world model

```bash
$ uv run train_cheetah.py
```

<img src="./assets/cheetah/cheetah_expert_vs_supermimic.webp" width="500px"></img>

<img src="./assets/cheetah/cheetah_convergence.png" width="500px"></img>

[RUKA-v2](https://github.com/ruka-hand-v2/RUKA-v2) hand experiment - tracks real human hand motion under MuJoCo torque control

```bash
$ uv run train_ruka_hand.py
```

<img src="./assets/ruka/human_vs_ruka_supermimic.webp" width="700px"></img>

<img src="./assets/ruka/ruka_convergence.png" width="500px"></img>

[Unitree Go2](https://github.com/google-deepmind/mujoco_menagerie/tree/main/unitree_go2) quadruped experiment - tracks held-out real German Shepherd motion capture under MuJoCo rigid-body ground contact physics

```bash
$ uv run train_unitree_dog.py
```

<img src="./assets/go2/dog_vs_go2_supermimic.webp" width="700px"></img>

<img src="./assets/go2/go2_convergence.png" width="500px"></img>

## Citations

```bibtex
@misc{liao2026supermimicscalinghumanoidwholebody,
    title   = {SuperMimic: Scaling Humanoid Whole-Body Control with One Differentiable World Model},
    author  = {Qiayuan Liao and Yiyang Shao and Junfeng Long and Kevin Zakka and Roberto Horowitz and Pieter Abbeel and Koushil Sreenath},
    year    = {2026},
    eprint  = {2610.28480},
    archivePrefix = {arXiv},
    primaryClass = {cs.RO},
    url     = {https://arxiv.org/abs/2610.28480},
}
```

```bibtex
@misc{xu2022acceleratedpolicylearningparallel,
    title   = {Accelerated Policy Learning with Parallel Differentiable Simulation},
    author  = {Jie Xu and Viktor Makoviychuk and Yashraj Narang and Fabio Ramos and Wojciech Matusik and Animesh Garg and Miles Macklin},
    year    = {2022},
    eprint  = {2204.07137},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url     = {https://arxiv.org/abs/2204.07137},
}
```

```bibtex
@misc{georgiev2025pwmpolicylearningmultitask,
    title    = {PWM: Policy Learning with Multi-Task World Models},
    author   = {Ignat Georgiev and Varun Giridhar and Nicklas Hansen and Animesh Garg},
    year     = {2025},
    eprint   = {2407.02466},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url      =  {https://arxiv.org/abs/2407.02466},
}
```

```bibtex
@article{Peng2021AMPAM,
    title   = {AMP: Adversarial Motion Priors for Stylized Physics-Based Character Control},
    author  = {Xue Bin Peng and Ze Ma and Pieter Abbeel and Sergey Levine and Angjoo Kanazawa},
    year    = {2021},
    eprint  = {2104.02180},
    archivePrefix = {arXiv},
    primaryClass = {cs.GR},
    url     = {https://arxiv.org/abs/2104.02180},
}
```

```bibtex
@misc{gladstone2026explorativemodelingunlockingpretraining,
    title   = {Explorative Modeling: Unlocking a Third Pretraining Axis and End-to-End Generation},
    author  = {Alexi Gladstone and Heng Ji and Yilun Du},
    year    = {2026},
    eprint  = {2607.27372},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url     = {https://arxiv.org/abs/2607.27372},
}
```

```bibtex
@misc{jia2025antitheticnoisediffusionmodels,
    title   = {Antithetic Noise in Diffusion Models},
    author  = {Jing Jia and Sifan Liu and Bowen Song and Wei Yuan and Liyue Shen and Guanyang Wang},
    year    = {2025},
    eprint  = {2506.06185},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url     = {https://arxiv.org/abs/2506.06185},
}
```

```bibtex
@misc{zorin2025rukarethinkingdesignhumanoid,
    title   = {RUKA: Rethinking the Design of Humanoid Hands with Learning},
    author  = {Anya Zorin and Irmak Guzey and Billy Yan and Aadhithya Iyer and Lisa Kondrich and Nikhil X. Bhattasali and Lerrel Pinto},
    year    = {2025},
    eprint  = {2504.13165},
    archivePrefix = {arXiv},
    primaryClass = {cs.RO},
    url     = {https://arxiv.org/abs/2504.13165},
}
```

```bibtex
@misc{liu2026rukav2tendondrivenopensource,
    title   = {Ruka-v2: Tendon Driven Open-Source Dexterous Hand with Wrist and Abduction for Robot Learning},
    author  = {Xinqi Lucas Liu and Ruoxi Hu and Alejandro Ojeda Olarte and Zhuoran Chen and Kenny Ma and Charles Cheng Ji and Lerrel Pinto and Raunaq Bhirangi and Irmak Guzey},
    year    = {2026},
    eprint  = {2603.26660},
    archivePrefix = {arXiv},
    primaryClass = {cs.RO},
    url     = {https://arxiv.org/abs/2603.26660},
}
```

```bibtex
@inproceedings{peng2020learningagileroboticlocomotion,
    title     = {Learning Agile Robotic Locomotion Skills by Imitating Animals},
    author    = {Xue Bin Peng and Erwin Coumans and Tingnan Zhang and Tsang-Wei Edward Lee and Jie Tan and Sergey Levine},
    booktitle = {Robotics: Science and Systems (RSS)},
    year      = {2020},
    eprint    = {2004.00784},
    archivePrefix = {arXiv},
    primaryClass = {cs.RO},
    url       = {https://arxiv.org/abs/2004.00784},
}
```

```bibtex
@article{tessler2024maskedmimic,
    title   = {MaskedMimic: Unified Physics-Based Character Control Through Masked Motion Inpainting},
    author  = {Chen Tessler and Yunrong Guo and Ofir Nabati and Gal Chechik and Xue Bin Peng},
    journal = {ACM Transactions on Graphics (TOG)},
    volume  = {43},
    number  = {6},
    year    = {2024},
    eprint  = {2409.14393},
    archivePrefix = {arXiv},
    primaryClass = {cs.GR},
    url     = {https://arxiv.org/abs/2409.14393},
}
```

```bibtex
@misc{dang2026trustwhatrepeats,
    title   = {Trust What Repeats: Capped World-Model Policy Gradients for Humanoid Motion Tracking},
    author  = {Xuzhe Dang and Stefan Edelkamp},
    year    = {2026},
    eprint  = {2611.27648},
    archivePrefix = {arXiv},
    primaryClass = {cs.RO},
    url     = {https://arxiv.org/abs/2611.27648},
}
```

```bibtex
@inproceedings{hansen2024tdmpc2,
    title     = {TD-MPC2: Scalable, Robust World Models for Continuous Control},
    author    = {Nicklas Hansen and Hao Su and Xiaolong Wang},
    booktitle = {International Conference on Learning Representations (ICLR)},
    year      = {2024},
    eprint    = {2310.16828},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url       = {https://arxiv.org/abs/2310.16828},
}
```

```bibtex
@inproceedings{sanchezgonzalez2020learning,
    title     = {Learning to Simulate Complex Physics with Graph Networks},
    author    = {Alvaro Sanchez-Gonzalez and Jonathan Godwin and Tobias Pfaff and Rex Ying and Jure Leskovec and Peter Battaglia},
    booktitle = {International Conference on Machine Learning (ICML)},
    year      = {2020},
    eprint    = {2002.09405},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url       = {https://arxiv.org/abs/2002.09405},
}
```

```bibtex
@misc{luo2026handson,
    title   = {HandsOn: A Large-Scale Simulation Benchmark for Generalizable Dexterous Manipulation},
    author  = {Tianwei Luo and Yiming He and Hongjin Wu and Ting Pan and Debin Ren and Haorui Guo and Junlin Yang and Yuxin Zuo and Zhehao Kou and Kaisen Yang and Zhuoqun Lai and Yi Ding and Jiale Yu and Yuchen Zhang and Zijie Qiu and Haozhan Li and Ning Ding},
    year    = {2026},
    eprint  = {2610.26765},
    archivePrefix = {arXiv},
    primaryClass = {cs.RO},
    url     = {https://arxiv.org/abs/2610.26765},
}
```

```bibtex
@inproceedings{fang2025worldmodelgeneralization,
    title     = {Towards Unraveling and Improving Generalization in World Models},
    author    = {Qiaoyi Fang and Weiyu Du and Hang Wang and Junshan Zhang},
    booktitle = {Conference on Parsimony and Learning (CPAL)},
    year      = {2025},
    eprint    = {2501.00195},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url       = {https://arxiv.org/abs/2501.00195},
}
```

```bibtex
@inproceedings{yu2020mopo,
    title     = {MOPO: Model-based Offline Policy Optimization},
    author    = {Tianhe Yu and Garrett Thomas and Lantao Yu and Stefano Ermon and James Zou and Sergey Levine and Chelsea Finn and Tengyu Ma},
    booktitle = {Advances in Neural Information Processing Systems (NeurIPS)},
    volume    = {33},
    pages     = {14129--14142},
    year      = {2020},
    eprint    = {2005.13239},
    archivePrefix = {arXiv},
    primaryClass = {cs.LG},
    url       = {https://arxiv.org/abs/2005.13239},
}
```

```bibtex
@misc{li2026uncertaintyawareroboticworldmodel,
    title   = {Uncertainty-Aware Robotic World Model Makes Offline Model-Based Reinforcement Learning Work on Real Robots},
    author  = {Chenhao Li and Andreas Krause and Marco Hutter},
    year    = {2026},
    eprint  = {2504.16680},
    archivePrefix = {arXiv},
    primaryClass = {cs.RO},
    url     = {https://arxiv.org/abs/2504.16680},
}
```
