File size: 2,460 Bytes
98776fc
 
 
 
 
 
 
 
 
 
 
 
 
 
5233356
98776fc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5233356
98776fc
 
 
 
 
 
 
 
 
 
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
87
88
89
90
91
92
# Run Endpoint Labeler Locally

Label trajectory success cutoffs on your machine. Same app as the HF Space, no org CPU limits.

## 1. Setup (one time)

```bash
cd /Users/kaushiksid/projs/rlplus/Labeler

python3.12 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
```

Use Python **3.11 or 3.12**. Avoid 3.13 — stdlib `audioop` was removed and breaks older Gradio builds.

## 2. Connect to HuggingFace data (optional)

**Public datasets** (e.g. `jesbu1/epic_rfm`) — no login needed.

**Gated or private datasets** — login once:

```bash
huggingface-cli login
# or: export HF_TOKEN=hf_...
```

The app reads `HF_TOKEN` / `HUGGING_FACE_HUB_TOKEN` automatically.

## 3. Launch

```bash
source .venv/bin/activate
python app.py
```

Or:

```bash
./run_local.sh
```

Open **http://127.0.0.1:7860**

## 4. Load data in the UI

| Field | Example | Notes |
|-------|---------|-------|
| Dataset Repository | `jesbu1/epic_rfm` | Any HF dataset with `frames`, `is_robot`, `quality_label` |
| Config Name | `epic` | Leave empty if single-config dataset |
| Quality Filter | `Success` | Filter trajectories before sampling |
| Human / Robot Samples | `10` / `10` | How many trajectories to label |

Click **Load Dataset** → videos download to `video_cache/` (cached after first fetch).

## 5. Label workflow

1. Scrub frame slider to the **success / task-complete frame**
2. Enter **End Frame** (or read from slider position)
3. Click **Save Label** → appends to `labels.csv`
4. After labeling a full batch, click **Analyze Pattern** for suggested cutoff %

## Output

`labels.csv`:

```csv
dataset_repo,config_name,trajectory_id,is_robot,quality_label,task,manual_end_frame,manual_end_percent,notes
```

Copy suggested cutoff % into `reward_fm/rfm/data/dataset_success_cutoff.txt`:

```
dataset_short_name,0.95
```

## Troubleshooting

| Problem | Fix |
|---------|-----|
| `ModuleNotFoundError: audioop` | Use Python 3.12 (not 3.13) |
| Videos won't load | Check dataset repo name; run `huggingface-cli login` for gated data |
| Empty sample list | Try Quality Filter = `All`, or increase sample counts |
| Slow first load | Normal — streaming + video download; cached after that |

## HF Spaces (if local isn't needed)

- Personal: https://huggingface.co/spaces/sksk99/endpoint-labeler
- Org: https://huggingface.co/spaces/robometer/endpoint-labeler

Both use this same repo. Space needs `python_version: 3.12` in README (already set).