Upload from Ropedia Academy
Browse files
README.md
CHANGED
|
@@ -4,19 +4,25 @@ library_name: pytorch
|
|
| 4 |
tags:
|
| 5 |
- ropedia-academy
|
| 6 |
- educational
|
|
|
|
|
|
|
|
|
|
| 7 |
- imitation-learning
|
| 8 |
---
|
| 9 |
|
| 10 |
# Behavior cloning (imitation)
|
| 11 |
|
| 12 |
-
A policy trained by supervised imitation of expert demonstrations; 100% rollout success.
|
| 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** | imitation learning |
|
| 19 |
-
| **
|
| 20 |
| **Track** | AG · Agents & RL |
|
| 21 |
| **Notebook** | [](https://colab.research.google.com/github/ChaoYue0307/ropedia-academy/blob/main/notebooks/training/AG_behavior_cloning.ipynb) |
|
| 22 |
|
|
@@ -28,23 +34,49 @@ Trained from scratch in **[Ropedia Academy](https://chaoyue0307.github.io/ropedi
|
|
| 28 |
- **Split:** train; eval = rollout success from every cell
|
| 29 |
- **Source:** procedural
|
| 30 |
|
| 31 |
-
##
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
|
| 39 |

|
| 40 |
|
| 41 |
-
##
|
| 42 |
|
| 43 |
```python
|
| 44 |
import torch
|
| 45 |
-
state = torch.load("
|
| 46 |
-
# Rebuild the
|
| 47 |
-
# model.load_state_dict(state)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
```
|
| 49 |
|
| 50 |
## Files
|
|
@@ -54,10 +86,34 @@ state = torch.load("model.pt", map_location="cpu") # some labs save pose.pt /
|
|
| 54 |
- `policy.pt`
|
| 55 |
|
| 56 |
|
| 57 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
-
|
|
|
|
|
|
|
|
|
|
| 60 |
|
| 61 |
|
| 62 |
---
|
| 63 |
-
*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 |
- imitation-learning
|
| 11 |
---
|
| 12 |
|
| 13 |
# Behavior cloning (imitation)
|
| 14 |
|
| 15 |
+
> A policy trained by supervised imitation of expert demonstrations; 100% rollout success.
|
| 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** | imitation learning |
|
| 25 |
+
| **Training objective** | **Supervised imitation** — cross-entropy of the expert's actions (behavior cloning). |
|
| 26 |
| **Track** | AG · Agents & RL |
|
| 27 |
| **Notebook** | [](https://colab.research.google.com/github/ChaoYue0307/ropedia-academy/blob/main/notebooks/training/AG_behavior_cloning.ipynb) |
|
| 28 |
|
|
|
|
| 34 |
- **Split:** train; eval = rollout success from every cell
|
| 35 |
- **Source:** procedural
|
| 36 |
|
| 37 |
+
## Training config
|
| 38 |
|
| 39 |
+
Adam (lr 3e-3), 800 steps; cross-entropy on ~2k expert (state→action) pairs; 6×6 grid.
|
| 40 |
+
|
| 41 |
+
## Evaluation results
|
| 42 |
+
|
| 43 |
+
| metric | value | meaning |
|
| 44 |
+
|---|---|---|
|
| 45 |
+
| `imitation_acc (final)` | 1.0 | |
|
| 46 |
+
| `rollout_success` | 1.0 | fraction of start states from which the policy reaches the goal |
|
| 47 |
|
| 48 |
|
| 49 |

|
| 50 |
|
| 51 |
+
## Inference example
|
| 52 |
|
| 53 |
```python
|
| 54 |
import torch
|
| 55 |
+
state = torch.load("policy.pt", map_location="cpu") # this repo's checkpoint
|
| 56 |
+
# Rebuild the exact module from the lab notebook (see "Reproduce"), then:
|
| 57 |
+
# model.load_state_dict(state); model.eval()
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
## Limitations
|
| 61 |
+
|
| 62 |
+
**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.**
|
| 63 |
+
|
| 64 |
+
## Failure cases
|
| 65 |
+
|
| 66 |
+
Compounding error / distribution shift once it leaves the expert's states (no recovery) — needs DAgger to fix.
|
| 67 |
+
|
| 68 |
+
## Reproduce / train your own
|
| 69 |
+
|
| 70 |
+
**One click:** open the notebook in Colab → **Runtime → GPU → Run all**, then run its *Publish to the Hugging Face Hub* cell.
|
| 71 |
+
|
| 72 |
+
[](https://colab.research.google.com/github/ChaoYue0307/ropedia-academy/blob/main/notebooks/training/AG_behavior_cloning.ipynb)
|
| 73 |
+
|
| 74 |
+
**From a shell:**
|
| 75 |
+
```bash
|
| 76 |
+
git clone https://github.com/ChaoYue0307/ropedia-academy.git && cd ropedia-academy
|
| 77 |
+
pip install torch numpy matplotlib scikit-learn scikit-image gymnasium
|
| 78 |
+
jupyter nbconvert --to notebook --execute notebooks/training/AG_behavior_cloning.ipynb --output run.ipynb
|
| 79 |
+
# optional: override training length, e.g. STEPS=2000 (or EPISODES=600) before running
|
| 80 |
```
|
| 81 |
|
| 82 |
## Files
|
|
|
|
| 86 |
- `policy.pt`
|
| 87 |
|
| 88 |
|
| 89 |
+
## License
|
| 90 |
+
|
| 91 |
+
Code & weights: **MIT** (this repository) — educational use encouraged.
|
| 92 |
+
Data: generated procedurally in the notebook — no external dataset.
|
| 93 |
+
|
| 94 |
+
## Citation
|
| 95 |
+
|
| 96 |
+
If you use this model or the course materials, please cite:
|
| 97 |
+
|
| 98 |
+
```bibtex
|
| 99 |
+
@misc{ropedia_academy,
|
| 100 |
+
title = {Ropedia Academy: an interactive course on embodied & spatial AI},
|
| 101 |
+
author = {Ropedia Academy},
|
| 102 |
+
year = {2026},
|
| 103 |
+
howpublished = {\url{https://chaoyue0307.github.io/ropedia-academy/}}
|
| 104 |
+
}
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
**Method / original work:** Pomerleau, *ALVINN*, 1988; Ross et al., *DAgger*, AISTATS 2011.
|
| 109 |
+
|
| 110 |
+
## Related assets
|
| 111 |
|
| 112 |
+
- 🚀 **Live demos:** [https://huggingface.co/spaces/cy0307/ropedia-demos](https://huggingface.co/spaces/cy0307/ropedia-demos)
|
| 113 |
+
- 🤗 **All trained models + collection:** [https://huggingface.co/cy0307](https://huggingface.co/cy0307)
|
| 114 |
+
- 📚 **Course & all labs:** [https://chaoyue0307.github.io/ropedia-academy/](https://chaoyue0307.github.io/ropedia-academy/) · [Labs tab](https://chaoyue0307.github.io/ropedia-academy/labs)
|
| 115 |
+
- 💻 **Source / notebooks:** [github.com/ChaoYue0307/ropedia-academy](https://github.com/ChaoYue0307/ropedia-academy)
|
| 116 |
|
| 117 |
|
| 118 |
---
|
| 119 |
+
*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).*
|