Update README.md for ccnets/humanoid/medium-v0
Browse files
README.md
CHANGED
|
@@ -1,149 +1,155 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: cc-by-4.0
|
| 3 |
-
viewer: false
|
| 4 |
-
tags:
|
| 5 |
-
- reinforcement-learning
|
| 6 |
-
- offline-reinforcement-learning
|
| 7 |
-
- mujoco
|
| 8 |
-
- minari
|
| 9 |
-
- causal-gpt-rl
|
| 10 |
-
---
|
| 11 |
-
|
| 12 |
-
# Causal GPT-RL — MuJoCo trajectories
|
| 13 |
-
|
| 14 |
-
MuJoCo trajectories packaged as [Minari](https://minari.farama.org) datasets, in
|
| 15 |
-
**offline-RL** form. What makes this repository different from a collection of
|
| 16 |
-
rollouts is where the trajectories come from: **they were recorded by a policy
|
| 17 |
-
that had never seen expert data.**
|
| 18 |
-
|
| 19 |
-
The first dataset is **1000 episodes of `Humanoid-v5`, recorded by a policy
|
| 20 |
-
trained on `simple` and `medium` trajectories alone** — one episode at every
|
| 21 |
-
retention length from 1 to 1000, each value used exactly once.
|
| 22 |
-
|
| 23 |
-
## Why this repository exists
|
| 24 |
-
|
| 25 |
-
The scarcity of good trajectories is the binding constraint in offline RL. There
|
| 26 |
-
is no internet-scale corpus of behaviour, and the usual way out is circular —
|
| 27 |
-
expert datasets need an expert policy, and an expert policy is most of the
|
| 28 |
-
problem already solved.
|
| 29 |
-
|
| 30 |
-
So the question is not only *can a model learn from the current dataset*, but
|
| 31 |
-
**can it produce a better next one**:
|
| 32 |
-
|
| 33 |
-
```
|
| 34 |
-
simple -> model -> medium
|
| 35 |
-
simple + medium -> model -> better than medium
|
| 36 |
-
simple + medium + that -> model -> better still
|
| 37 |
-
... repeated, never using expert data ...
|
| 38 |
-
-> expert
|
| 39 |
-
```
|
| 40 |
-
|
| 41 |
-
Each dataset here is one turn of that loop. No expert trajectories are used at
|
| 42 |
-
any point.
|
| 43 |
-
|
| 44 |
-
## Where the loop stands
|
| 45 |
-
|
| 46 |
-
Normalized skill on the [model card's](https://huggingface.co/ccnets/causal-gpt-rl)
|
| 47 |
-
scale — a random policy is `0`, expert is `100`:
|
| 48 |
-
|
| 49 |
-
| | dataset | mean return | normalized |
|
| 50 |
-
|---|---|---:|---:|
|
| 51 |
-
| input | `mujoco/humanoid/simple-v0` | 5484.6 | 63.3 |
|
| 52 |
-
| input | `mujoco/humanoid/medium-v0` | 7014.5 | 81.3 |
|
| 53 |
-
| **this repo** | **`
|
| 54 |
-
| target | expert | 8605.1 | 100.0 |
|
| 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 |
-
|
| 120 |
-
|
| 121 |
-
(
|
| 122 |
-
`
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
viewer: false
|
| 4 |
+
tags:
|
| 5 |
+
- reinforcement-learning
|
| 6 |
+
- offline-reinforcement-learning
|
| 7 |
+
- mujoco
|
| 8 |
+
- minari
|
| 9 |
+
- causal-gpt-rl
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# Causal GPT-RL — MuJoCo trajectories
|
| 13 |
+
|
| 14 |
+
MuJoCo trajectories packaged as [Minari](https://minari.farama.org) datasets, in
|
| 15 |
+
**offline-RL** form. What makes this repository different from a collection of
|
| 16 |
+
rollouts is where the trajectories come from: **they were recorded by a policy
|
| 17 |
+
that had never seen expert data.**
|
| 18 |
+
|
| 19 |
+
The first dataset is **1000 episodes of `Humanoid-v5`, recorded by a policy
|
| 20 |
+
trained on `simple` and `medium` trajectories alone** — one episode at every
|
| 21 |
+
retention length from 1 to 1000, each value used exactly once.
|
| 22 |
+
|
| 23 |
+
## Why this repository exists
|
| 24 |
+
|
| 25 |
+
The scarcity of good trajectories is the binding constraint in offline RL. There
|
| 26 |
+
is no internet-scale corpus of behaviour, and the usual way out is circular —
|
| 27 |
+
expert datasets need an expert policy, and an expert policy is most of the
|
| 28 |
+
problem already solved.
|
| 29 |
+
|
| 30 |
+
So the question is not only *can a model learn from the current dataset*, but
|
| 31 |
+
**can it produce a better next one**:
|
| 32 |
+
|
| 33 |
+
```
|
| 34 |
+
simple -> model -> medium
|
| 35 |
+
simple + medium -> model -> better than medium
|
| 36 |
+
simple + medium + that -> model -> better still
|
| 37 |
+
... repeated, never using expert data ...
|
| 38 |
+
-> expert
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
Each dataset here is one turn of that loop. No expert trajectories are used at
|
| 42 |
+
any point.
|
| 43 |
+
|
| 44 |
+
## Where the loop stands
|
| 45 |
+
|
| 46 |
+
Normalized skill on the [model card's](https://huggingface.co/ccnets/causal-gpt-rl)
|
| 47 |
+
scale — a random policy is `0`, expert is `100`:
|
| 48 |
+
|
| 49 |
+
| | dataset | mean return | normalized |
|
| 50 |
+
|---|---|---:|---:|
|
| 51 |
+
| input | Minari `mujoco/humanoid/simple-v0` | 5484.6 | 63.3 |
|
| 52 |
+
| input | Minari `mujoco/humanoid/medium-v0` | 7014.5 | 81.3 |
|
| 53 |
+
| **this repo** | **`ccnets/humanoid/medium-v0`** | **7494.3** | **86.9** |
|
| 54 |
+
| target | expert | 8605.1 | 100.0 |
|
| 55 |
+
|
| 56 |
+
"Minari" marks the two [Farama-published](https://minari.farama.org/datasets/mujoco/humanoid/)
|
| 57 |
+
datasets this project trained on. Everything else in this repository is
|
| 58 |
+
recorded, not downloaded.
|
| 59 |
+
|
| 60 |
+
The recorded trajectories score **+479.8 return above the medium dataset the
|
| 61 |
+
policy was trained on**, and **85.7 % of the 1000 episodes beat that dataset's
|
| 62 |
+
mean**. The gap left to expert is 13.1 normalized points.
|
| 63 |
+
|
| 64 |
+
## `humanoid/medium-v0`
|
| 65 |
+
|
| 66 |
+
Recorded by the
|
| 67 |
+
[`ccnets/causal-gpt-rl/humanoid-v5`](https://huggingface.co/ccnets/causal-gpt-rl)
|
| 68 |
+
bundle, trained on the Minari `simple-v0` and `medium-v0` trajectories of that
|
| 69 |
+
environment with no expert data.
|
| 70 |
+
|
| 71 |
+
| | |
|
| 72 |
+
|---|---|
|
| 73 |
+
| Episodes | 1000 |
|
| 74 |
+
| Transitions | 924,747 |
|
| 75 |
+
| Episode length | 924.7 mean (87 min, 1000 max) |
|
| 76 |
+
| Return | 7494.3 ± 1667.6 (515.4 min, 8340.7 max) |
|
| 77 |
+
| Ended by termination | 156 |
|
| 78 |
+
| Ended by the 1000-step limit | 844 |
|
| 79 |
+
| Observation / action | `Box(348,)` / `Box(17,)`, float32 |
|
| 80 |
+
|
| 81 |
+
### One retention per episode
|
| 82 |
+
|
| 83 |
+
Every episode carries a distinct seed and a **different retention** —
|
| 84 |
+
`kv_cache_max_len` from 1 to 1000, each value used exactly once. Retention is
|
| 85 |
+
how many steps of its own past the policy keeps while acting. It is a load-time
|
| 86 |
+
argument, so all 1000 episodes come from the same weights and the same trained
|
| 87 |
+
context length of 32; only how much history each rollout kept differs.
|
| 88 |
+
|
| 89 |
+
`episode_metadata.jsonl` maps every episode file to the retention that recorded
|
| 90 |
+
it — episodes are numbered in the order they finished, not by retention:
|
| 91 |
+
|
| 92 |
+
```json
|
| 93 |
+
{"episode": "ep_000000", "row": 4, "transitions": 113, "terminated": true, "truncated": false, "kv_cache_max_len": 16}
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
That makes the dataset usable two ways: as offline-RL trajectories, and as a
|
| 97 |
+
measurement of what retention does to a policy's behaviour. Within it, episodes
|
| 98 |
+
recorded between 16 and 128 steps of retention average 91.1 normalized against
|
| 99 |
+
85.5 for those above 500 — but with one episode per retention, seed variance is
|
| 100 |
+
larger than the effect, so treat the per-retention axis as evidence to build on
|
| 101 |
+
rather than a settled result.
|
| 102 |
+
|
| 103 |
+
### Files
|
| 104 |
+
|
| 105 |
+
```
|
| 106 |
+
humanoid/medium-v0/
|
| 107 |
+
data/main_data.hdf5 the Minari dataset
|
| 108 |
+
data/metadata.json
|
| 109 |
+
episode_metadata.jsonl one line per episode: file, row, length, retention
|
| 110 |
+
collection_spec.json what recorded it: bundle, context length, retentions
|
| 111 |
+
validation_summary.json every number quoted above
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
### Load it
|
| 115 |
+
|
| 116 |
+
```python
|
| 117 |
+
import minari
|
| 118 |
+
|
| 119 |
+
dataset = minari.load_dataset("ccnets/humanoid/medium-v0")
|
| 120 |
+
episode = next(dataset.iterate_episodes())
|
| 121 |
+
print(episode.observations.shape, episode.rewards.sum())
|
| 122 |
+
```
|
| 123 |
+
|
| 124 |
+
Place the `humanoid/medium-v0` directory under `ccnets/` in your Minari
|
| 125 |
+
datasets path — `~/.minari/datasets/ccnets/humanoid/medium-v0` — or point
|
| 126 |
+
`MINARI_DATASETS_PATH` at wherever you keep it.
|
| 127 |
+
|
| 128 |
+
The files were recorded with `torch 2.12.0`, `gymnasium 1.2.2` and
|
| 129 |
+
`mujoco 3.8.1`; a different simulator release is a different measurement even
|
| 130 |
+
with identical weights and seeds. The recorder and packager are
|
| 131 |
+
[`collection/`](https://github.com/ccnets-team/causal-gpt-rl/tree/main/collection),
|
| 132 |
+
and the cycle this repository is built on is described in
|
| 133 |
+
[Improving the next dataset](https://github.com/ccnets-team/causal-gpt-rl/blob/main/collection/docs/improving-the-next-dataset.md).
|
| 134 |
+
|
| 135 |
+
## A note on the name
|
| 136 |
+
|
| 137 |
+
`ccnets/humanoid/medium-v0` keeps the rung — `medium-v0` — and changes the
|
| 138 |
+
namespace. The rung says where in the ladder the data was produced: after the
|
| 139 |
+
medium trajectories, before expert. The namespace says who produced it, and
|
| 140 |
+
keeps it clear of Farama's `mujoco/humanoid/medium-v0`, which is the dataset
|
| 141 |
+
the recording policy was trained on. Minari resolves a dataset by id, so the two
|
| 142 |
+
can sit in one `~/.minari` without either hiding the other — which matters
|
| 143 |
+
here, because they are the input and the output of the same experiment.
|
| 144 |
+
|
| 145 |
+
## Companion repos
|
| 146 |
+
|
| 147 |
+
- Policy bundles for eight MuJoCo environments:
|
| 148 |
+
[ccnets/causal-gpt-rl](https://huggingface.co/ccnets/causal-gpt-rl)
|
| 149 |
+
- Unity ML-Agents trajectories, with a calibrated quality ladder:
|
| 150 |
+
[ccnets/causal-gpt-rl-unity-datasets](https://huggingface.co/datasets/ccnets/causal-gpt-rl-unity-datasets)
|
| 151 |
+
- Code:
|
| 152 |
+
[ccnets-team/causal-gpt-rl](https://github.com/ccnets-team/causal-gpt-rl)
|
| 153 |
+
|
| 154 |
+
**한국어 카드 / Korean edition:**
|
| 155 |
+
[README.ko.md](https://huggingface.co/datasets/ccnets/causal-gpt-rl-datasets/blob/main/README.ko.md)
|