Upload from Ropedia Academy
Browse files
README.md
CHANGED
|
@@ -4,19 +4,25 @@ library_name: pytorch
|
|
| 4 |
tags:
|
| 5 |
- ropedia-academy
|
| 6 |
- educational
|
|
|
|
|
|
|
|
|
|
| 7 |
- reinforcement-learning
|
| 8 |
---
|
| 9 |
|
| 10 |
# World model + planning (CEM)
|
| 11 |
|
| 12 |
-
Learns environment dynamics, then plans with the Cross-Entropy Method to reach a goal inside imagination.
|
| 13 |
|
| 14 |
-
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.
|
|
|
|
|
|
|
| 15 |
|
| 16 |
| | |
|
| 17 |
|---|---|
|
|
|
|
| 18 |
| **Task** | model-based control |
|
| 19 |
-
| **
|
| 20 |
| **Track** | D Β· Scene & world models |
|
| 21 |
| **Notebook** | [](https://colab.research.google.com/github/ChaoYue0307/ropedia-academy/blob/main/notebooks/training/D_world_model.ipynb) |
|
| 22 |
|
|
@@ -28,24 +34,52 @@ Trained from scratch in **[Ropedia Academy](https://chaoyue0307.github.io/ropedi
|
|
| 28 |
- **Split:** train only
|
| 29 |
- **Source:** procedural env
|
| 30 |
|
| 31 |
-
##
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
|
| 40 |

|
| 41 |
|
| 42 |
-
##
|
| 43 |
|
| 44 |
```python
|
| 45 |
import torch
|
| 46 |
-
state = torch.load("
|
| 47 |
-
# Rebuild the
|
| 48 |
-
# model.load_state_dict(state)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
```
|
| 50 |
|
| 51 |
## Files
|
|
@@ -55,10 +89,34 @@ state = torch.load("model.pt", map_location="cpu") # some labs save pose.pt /
|
|
| 55 |
- `metrics.json`
|
| 56 |
|
| 57 |
|
| 58 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
---
|
| 64 |
-
*Part of the [Ropedia Academy](https://chaoyue0307.github.io/ropedia-academy/) trained-model collection.*
|
|
|
|
| 4 |
tags:
|
| 5 |
- ropedia-academy
|
| 6 |
- educational
|
| 7 |
+
- embodied-ai
|
| 8 |
+
- from-scratch
|
| 9 |
+
- reproducible
|
| 10 |
- reinforcement-learning
|
| 11 |
---
|
| 12 |
|
| 13 |
# World model + planning (CEM)
|
| 14 |
|
| 15 |
+
> Learns environment dynamics, then plans with the Cross-Entropy Method to reach a goal inside imagination.
|
| 16 |
|
| 17 |
+
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)**.
|
| 18 |
+
|
| 19 |
+
## At a glance
|
| 20 |
|
| 21 |
| | |
|
| 22 |
|---|---|
|
| 23 |
+
| **Base model** | Trained **from scratch** (random initialization) β no pretrained base model. |
|
| 24 |
| **Task** | model-based control |
|
| 25 |
+
| **Training objective** | Supervised **one-step dynamics** prediction (MSE); planning by the **Cross-Entropy Method (CEM)**. |
|
| 26 |
| **Track** | D Β· Scene & world models |
|
| 27 |
| **Notebook** | [](https://colab.research.google.com/github/ChaoYue0307/ropedia-academy/blob/main/notebooks/training/D_world_model.ipynb) |
|
| 28 |
|
|
|
|
| 34 |
- **Split:** train only
|
| 35 |
- **Source:** procedural env
|
| 36 |
|
| 37 |
+
## Training config
|
| 38 |
|
| 39 |
+
Adam (lr 1e-3), 1500 steps for the dynamics model; planning by Cross-Entropy Method (CEM).
|
| 40 |
+
|
| 41 |
+
## Evaluation results
|
| 42 |
+
|
| 43 |
+
| metric | value | meaning |
|
| 44 |
+
|---|---|---|
|
| 45 |
+
| `dyn_mse (final)` | 0.0 | |
|
| 46 |
+
| `final_dist.planner` | 0.0062 | |
|
| 47 |
+
| `final_dist.random` | 2.169 | |
|
| 48 |
|
| 49 |
|
| 50 |

|
| 51 |
|
| 52 |
+
## Inference example
|
| 53 |
|
| 54 |
```python
|
| 55 |
import torch
|
| 56 |
+
state = torch.load("dynamics.pt", map_location="cpu") # this repo's checkpoint
|
| 57 |
+
# Rebuild the exact module from the lab notebook (see "Reproduce"), then:
|
| 58 |
+
# model.load_state_dict(state); model.eval()
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
## Limitations
|
| 62 |
+
|
| 63 |
+
**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.**
|
| 64 |
+
|
| 65 |
+
Single 2D point-mass; one-step model errors compound over long horizons.
|
| 66 |
+
|
| 67 |
+
## Failure cases
|
| 68 |
+
|
| 69 |
+
CEM plans poorly when the learned model is queried off-distribution; errors compound over the horizon.
|
| 70 |
+
|
| 71 |
+
## Reproduce / train your own
|
| 72 |
+
|
| 73 |
+
**One click:** open the notebook in Colab β **Runtime β GPU β Run all**, then run its *Publish to the Hugging Face Hub* cell.
|
| 74 |
+
|
| 75 |
+
[](https://colab.research.google.com/github/ChaoYue0307/ropedia-academy/blob/main/notebooks/training/D_world_model.ipynb)
|
| 76 |
+
|
| 77 |
+
**From a shell:**
|
| 78 |
+
```bash
|
| 79 |
+
git clone https://github.com/ChaoYue0307/ropedia-academy.git && cd ropedia-academy
|
| 80 |
+
pip install torch numpy matplotlib scikit-learn scikit-image gymnasium
|
| 81 |
+
jupyter nbconvert --to notebook --execute notebooks/training/D_world_model.ipynb --output run.ipynb
|
| 82 |
+
# optional: override training length, e.g. STEPS=2000 (or EPISODES=600) before running
|
| 83 |
```
|
| 84 |
|
| 85 |
## Files
|
|
|
|
| 89 |
- `metrics.json`
|
| 90 |
|
| 91 |
|
| 92 |
+
## License
|
| 93 |
+
|
| 94 |
+
Code & weights: **MIT** (this repository) β educational use encouraged.
|
| 95 |
+
Data: generated procedurally in the notebook β no external dataset.
|
| 96 |
+
|
| 97 |
+
## Citation
|
| 98 |
+
|
| 99 |
+
If you use this model or the course materials, please cite:
|
| 100 |
+
|
| 101 |
+
```bibtex
|
| 102 |
+
@misc{ropedia_academy,
|
| 103 |
+
title = {Ropedia Academy: an interactive course on embodied & spatial AI},
|
| 104 |
+
author = {Ropedia Academy},
|
| 105 |
+
year = {2026},
|
| 106 |
+
howpublished = {\url{https://chaoyue0307.github.io/ropedia-academy/}}
|
| 107 |
+
}
|
| 108 |
+
```
|
| 109 |
+
|
| 110 |
+
|
| 111 |
+
**Method / original work:** Ha & Schmidhuber, *World Models*, NeurIPS 2018; Rubinstein, *The Cross-Entropy Method*, 1999.
|
| 112 |
+
|
| 113 |
+
## Related assets
|
| 114 |
|
| 115 |
+
- π **Live demos:** [https://huggingface.co/spaces/cy0307/ropedia-demos](https://huggingface.co/spaces/cy0307/ropedia-demos)
|
| 116 |
+
- π€ **All trained models + collection:** [https://huggingface.co/cy0307](https://huggingface.co/cy0307)
|
| 117 |
+
- π **Course & all labs:** [https://chaoyue0307.github.io/ropedia-academy/](https://chaoyue0307.github.io/ropedia-academy/) Β· [Labs tab](https://chaoyue0307.github.io/ropedia-academy/labs)
|
| 118 |
+
- π» **Source / notebooks:** [github.com/ChaoYue0307/ropedia-academy](https://github.com/ChaoYue0307/ropedia-academy)
|
| 119 |
|
| 120 |
|
| 121 |
---
|
| 122 |
+
*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).*
|