File size: 2,862 Bytes
9243326
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Instructions

How to reproduce this dataset locally and push it to the Hugging Face Hub.

## Setup

```bash
uv sync
```

## Generation pipeline

Four scripts under `scripts/`, run in order:

1. **`download_lafan.py`** — pulls the G1 subset of
   [`lvhaidong/LAFAN1_Retargeting_Dataset`][lafan1] into `.cache/lafan1_g1/`
   (gitignored).
2. **`retarget.py`** — step 1 direct G1 → Lite joint remap (sign + offset
   table baked into `common.G1_TO_LITE`) and step 2 per-frame `mink` IK
   refinement on both feet and both hands. Writes a HuggingFace
   LeRobotDataset at the repository root (`meta/` + `data/chunk-*/`).
3. **`visualize.py`** — viser web viewer; renders Lite (solid) overlaid with
   the source G1 (alpha-blended ghost). Episode dropdown lazy-loads each
   clip on selection.
4. **`push_to_hub.py`** — uploads the dataset to the Hugging Face Hub using
   `LeRobotDataset.push_to_hub` (auto-generates the dataset card).

End-to-end reproduction:

```bash
uv run scripts/download_lafan.py
uv run scripts/retarget.py --workers -1     # parallelise across all CPU cores
uv run scripts/visualize.py                 # browse and inspect
uv run scripts/push_to_hub.py               # publish
```

### `retarget.py` flags

| Flag | Default | Effect |
| --- | --- | --- |
| `--clip <regex>` | none | Process only matching CSVs (e.g. `'walk1_subject1'`). |
| `--validate-only` | off | Print step-1 vs step-2 EE-error table without writing the dataset. |
| `--no-ik` | off | Output step 1 only (skips per-frame IK refinement). |
| `--ik-iters N` | 15 | `mink` Newton iterations per frame in step 2. |
| `--workers N` | 1 | Parallel processes across clips. `-1` = all CPU cores. |

### `visualize.py` flags

| Flag | Default | Effect |
| --- | --- | --- |
| `--episode-index N` | 0 | Initial episode to load (switch later from the GUI dropdown). |
| `--port N` | 8080 | viser HTTP port. |
| `--no-ghost` | off | Hide the source G1 ghost; show Lite only. |

## Pushing to Hugging Face Hub

Authenticate once:

```bash
hf auth login                # interactive
# or, non-interactive:
export HF_TOKEN=hf_...
```

Your token needs **write** scope on the target namespace (your account or
an org you belong to).

Then upload:

```bash
uv run scripts/push_to_hub.py
uv run scripts/push_to_hub.py --repo-id your-username/your-dataset
uv run scripts/push_to_hub.py --private
uv run scripts/push_to_hub.py --branch v0.1
```

`push_to_hub.py` calls `LeRobotDataset.push_to_hub`, which:

* Creates the dataset repo if it doesn't exist.
* Uploads `meta/` + `data/` (and `videos/` if any — there are none here).
* Generates a LeRobot dataset card from `meta/info.json` (this overwrites
  whatever `README.md` was uploaded).
* Tags the revision with the LeRobot codebase version.

[lafan1]: https://huggingface.co/datasets/lvhaidong/LAFAN1_Retargeting_Dataset