File size: 2,721 Bytes
25971f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
library_name: brax
tags:
  - reinforcement-learning
  - robotics
  - mujoco
  - mjx
  - ppo
  - franka-panda
  - curriculum-learning
---

# Curriculum Learning for Robotic Manipulation: Trained Weights

PPO policy and value weights for every run in [ynkos22/Curriculum_Learning](https://github.com/ynkos22/Curriculum_Learning). That project tests whether pretraining on harder tasks transfers better than pretraining on easier ones (Franka Panda, MuJoCo MJX, Brax PPO, 50 tasks).

Code, results tables and figures are in the GitHub repo. This repo only holds the weights.

## Layout

The folders mirror `runs/` in the GitHub repo. Each run folder contains `params.pkl` (final), `best_params.pkl` (best eval), `config.json` and `summary.json`.

| Folder | Runs | Contents |
| :--- | :---: | :--- |
| `phase1_calibration_final/<Task>/seed_<s>/` | 150 | Single-task PPO from scratch, 50 tasks × 3 seeds, 40M steps |
| `phase2_pretrain/<condition>/seed_<s>/` | 15 | Multi-task pretraining, 5 conditions (`easy`, `medium`, `hard`, `uniform`, `curriculum`) × 3 seeds, 120M steps. Also `ckpt_40M.pkl`, `ckpt_80M.pkl`, `ckpt_120M.pkl` |
| `phase2_transfer/<condition>/seed_<s>/<Task>/` | 210 | Fine-tuning from each pretrained model on 14 held-out tasks, 40M steps |
| `phase2_hero_snapshots/<Task>/<condition>/seed_0/` | 18 | Selected fine-tuning runs with checkpoints at 0, 5, 10, 20 and 40M steps |

## Format

Each `.pkl` is a pickled Brax PPO params tuple `(normalizer_params, policy_params, value_params)` as NumPy arrays (loading needs `brax` installed). Network: 155-D observation, 8-D action, policy and value MLPs of (256, 256, 256).

Pickle files can run code when loaded. Only load files from a source you trust.

## Usage

```python
import pickle
import jax, jax.numpy as jnp
from huggingface_hub import hf_hub_download
from brax.training.acme import running_statistics
from brax.training.agents.ppo import networks as ppo_networks

path = hf_hub_download(
    "ynkos/curriculum-learning-panda",
    "phase2_pretrain/hard/seed_0/params.pkl",
)
with open(path, "rb") as f:
    params = jax.tree_util.tree_map(jnp.asarray, pickle.load(f))

net = ppo_networks.make_ppo_networks(
    155, 8,
    preprocess_observations_fn=running_statistics.normalize,
    policy_hidden_layer_sizes=(256, 256, 256),
    value_hidden_layer_sizes=(256, 256, 256),
)
policy = ppo_networks.make_inference_fn(net)(params, deterministic=True)
```

To fine-tune from a checkpoint, pass it to the trainer in the GitHub repo:

```bash
python -m curriculum_learning.train_baseline --task <Task> --restore_params_path params.pkl
```

Download a whole folder with `huggingface_hub.snapshot_download(..., allow_patterns="phase2_pretrain/*")`.