File size: 4,666 Bytes
d8478de
 
457ef79
d8478de
 
 
dff9293
 
 
457ef79
d8478de
 
457ef79
d8478de
dff9293
d8478de
dff9293
 
 
d8478de
457ef79
 
dff9293
457ef79
dff9293
457ef79
 
 
7084fd7
 
 
 
 
 
 
 
dff9293
457ef79
dff9293
 
 
 
 
 
 
457ef79
 
 
 
dff9293
457ef79
 
 
dff9293
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457ef79
 
 
 
 
 
 
 
 
dff9293
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457ef79
dff9293
 
 
 
457ef79
 
 
dff9293
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
---
license: mit
library_name: pytorch
tags:
- ropedia-academy
- educational
- embodied-ai
- from-scratch
- reproducible
- diffusion
---

# Motion diffusion (DDPM)

> A denoising-diffusion model that generates motion trajectories β€” the MDM recipe, trained from scratch, sampled from EMA weights.

Trained from scratch in **[Ropedia Academy](https://chaoyue0307.github.io/ropedia-academy/)** β€” an interactive, bilingual course on embodied & spatial AI. **Educational model:** small and quick to train; the value is the *method* and a reproducible pipeline, not a leaderboard score. Try it live in the **[Ropedia demos Space](https://huggingface.co/spaces/cy0307/ropedia-demos)**.

## At a glance

| | |
|---|---|
| **Base model** | Trained **from scratch** (random initialization) β€” no pretrained base model. |
| **Task** | human-motion generation |
| **Training objective** | **DDPM** denoising objective (predict the added noise) over motion trajectories; sample from an EMA of the weights. |
| **Track** | A Β· Human modeling |
| **Notebook** | [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ChaoYue0307/ropedia-academy/blob/main/notebooks/training/A_motion_diffusion.ipynb) |

## Dataset

- **Name:** Synthetic motion trajectories
- **Type:** synthetic β€” procedural
- **Size / stats:** 4,096 looping 2D trajectories, 32 timesteps Γ— 2 = 64-D each (varied radius/phase/noise)
- **Split:** train only (generative model)
- **Source:** procedural

## Training config

DDPM; Adam (lr 2e-4), 4000 steps, sequence length 32; EMA of weights for sampling. `STEPS` env-overridable.

## Evaluation results

| metric | value | meaning |
|---|---|---|
| `loss (final)` | 0.159 |  |


![figure](figure.png)

## Inference example

```python
import torch
state = torch.load("denoiser.pt", map_location="cpu")   # this repo's checkpoint
# Rebuild the exact module from the lab notebook (see "Reproduce"), then:
# model.load_state_dict(state); model.eval()
```

## Limitations

**Educational scale.** Trained quickly on CPU on small or synthetic data, so absolute numbers are not competitive with production systems β€” the value is the *method* and a reproducible pipeline. No large-scale data, no hyperparameter sweep, and no multi-seed variance is reported. **Not for production use.**

## Failure cases

Too few sampling steps or no EMA β†’ jittery/averaged motions; mode collapse with too little data.

## Reproduce / train your own

**One click:** open the notebook in Colab β†’ **Runtime β†’ GPU β†’ Run all**, then run its *Publish to the Hugging Face Hub* cell.

[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/ChaoYue0307/ropedia-academy/blob/main/notebooks/training/A_motion_diffusion.ipynb)

**From a shell:**
```bash
git clone https://github.com/ChaoYue0307/ropedia-academy.git && cd ropedia-academy
pip install torch numpy matplotlib scikit-learn scikit-image gymnasium
jupyter nbconvert --to notebook --execute notebooks/training/A_motion_diffusion.ipynb --output run.ipynb
# optional: override training length, e.g.  STEPS=2000  (or EPISODES=600)  before running
```

## Files

- `denoiser.pt`
- `figure.png`
- `metrics.json`


## License

Code & weights: **MIT** (this repository) β€” educational use encouraged.  
Data: generated procedurally in the notebook β€” no external dataset.

## Citation

If you use this model or the course materials, please cite:

```bibtex
@misc{ropedia_academy,
  title  = {Ropedia Academy: an interactive course on embodied & spatial AI},
  author = {Ropedia Academy},
  year   = {2026},
  howpublished = {\url{https://chaoyue0307.github.io/ropedia-academy/}}
}
```


**Method / original work:** Tevet et al., *Human Motion Diffusion Model (MDM)*, ICLR 2023 (arXiv:2209.14916); Ho et al., *DDPM*, NeurIPS 2020.

## Related assets

- πŸš€ **Live demos:** [https://huggingface.co/spaces/cy0307/ropedia-demos](https://huggingface.co/spaces/cy0307/ropedia-demos)
- πŸ€— **All trained models + collection:** [https://huggingface.co/cy0307](https://huggingface.co/cy0307)
- πŸ“š **Course & all labs:** [https://chaoyue0307.github.io/ropedia-academy/](https://chaoyue0307.github.io/ropedia-academy/) Β· [Labs tab](https://chaoyue0307.github.io/ropedia-academy/labs)
- πŸ’» **Source / notebooks:** [github.com/ChaoYue0307/ropedia-academy](https://github.com/ChaoYue0307/ropedia-academy)


---
*Part of the [Ropedia Academy](https://chaoyue0307.github.io/ropedia-academy/) trained-model collection. Contributions & issues welcome on [GitHub](https://github.com/ChaoYue0307/ropedia-academy).*