Training-oriented PyTorch + MuJoCo implementation of the paper "SuperTrack: Motion Tracking for Physically Simulated Characters using Supervised Learning".
- SuperTrack-style training pipeline
- PyTorch implementation
- MuJoCo humanoid simulation
- BVH to target-motion conversion
- Learned world dynamics model
- Policy training through differentiable rollouts
- Policy viewer with GIF recording
- Code organized for reading and modification
This repository is currently structured around a single BVH clip workflow.
Recommended usage:
- place one BVH file under
data/motions/ - convert it into MuJoCo-friendly motion targets
- train the world model and policy using the generated motion data
Generated motion targets are written to:
mjmotions/
If you want multi-clip or full-dataset training later, you can extend the motion loading and replay-buffer logic, but the default flow is intentionally kept simple.
Recommended environment:
- Python 3.11+
- PyTorch 2.0+
- MuJoCo 3.0+
- NumPy
- SciPy
- imageio (for GIF recording)
Python 3.11+ is recommended because the current configuration code uses
tomllib.
git clone https://github.com/kistf001/supertrack-pytorch-mujoco.git
cd supertrack-pytorch-mujoco
python -m venv .venv
source .venv/bin/activate
pip install torch numpy scipy mujoco imageioFor CUDA, install the appropriate PyTorch build for your environment.
Put one BVH file into:
data/motions/
Then run:
python motion_export.pyThis converts the motion into MuJoCo-friendly target data and writes the output into:
mjmotions/
Run the default training configuration:
python main.pyTo use a TOML config override:
python main.py --config path/to/your_config.tomlThe training loop follows this high-level cycle:
- collect trajectories in MuJoCo
- fill / update the replay buffer
- train the world model on short chunks
- train the policy using differentiable rollouts through the learned world model
- periodically save checkpoints
Launch the viewer:
python policy_viewer.pyRecord a demo GIF:
python policy_viewer.py --recordCustom recording:
python policy_viewer.py --record --delay 2 --duration 10 --output assets/custom.gifThere is currently a small path mismatch between training and visualization:
main.pysaves checkpoints such as:policy_final.pthworld_final.pth
policy_viewer.pycurrently looks for:data/weight/policy.pth
So after training, you may need to move or copy the trained policy checkpoint manually, for example:
mkdir -p data/weight
cp policy_final.pth data/weight/policy.pthOn Windows PowerShell:
New-Item -ItemType Directory -Force data/weight
Copy-Item policy_final.pth data/weight/policy.pthAlternatively, you can edit ViewerConfig.policy_path inside policy_viewer.py.
Data Collection -> Replay Buffer -> World Model Training -> Policy Training
More concretely:
-
Data collection
- roll out trajectories in MuJoCo
- gather observations, controls, and target motion information
- push samples into the replay buffer
-
World model training
- train a learned dynamics model on short motion chunks
- predict future motion evolution from state + action
-
Policy training
- use the learned world model as a differentiable surrogate
- optimize the policy to reduce tracking error over longer horizons
Configuration is defined through dataclasses in config.py, with optional TOML overrides.
Main categories include:
processtrainingdata_collectionbuffernetwork_architectureoptimizerloss_weightspolicy_trainingsimulation
Typical configurable items include:
- device
- buffer size
- world / policy chunk sizes
- learning rates
- gradient clipping
- hidden sizes
- loss weights
- exploration noise
- output scaling
- model path
For the most reliable first run, start with:
python main.pyand only then introduce custom TOML overrides.
- Paper: https://dl.acm.org/doi/10.1145/3478513.3480527
- Orange Duck article / paper page: https://theorangeduck.com/page/supertrack-motion-tracking-physically-simulated-characters-using-supervised-learning
If this repository helps your work, please cite the original paper.
MIT License
