andito's picture
andito HF Staff
Data, training code and reproduction steps for reachy-gestures
0cc835c verified
|
Raw History Blame Contribute Delete
14.7 kB
metadata
license: other
license_name: mixed-sources
language:
  - multilingual
  - en
  - es
  - fr
  - de
  - it
  - pt
  - nl
  - pl
  - ru
  - tr
  - ar
  - hi
  - zh
  - ja
  - ko
task_categories:
  - text-classification
pretty_name: Reachy gestures data
size_categories:
  - 100K<n<1M
tags:
  - reachy-mini
  - robotics
  - gestures
  - distillation
configs:
  - config_name: merged
    default: true
    data_files:
      - split: train
        path: splits/merged/train.jsonl
      - split: validation
        path: splits/merged/val.jsonl
      - split: test
        path: splits/merged/test.jsonl
      - split: test_real
        path: splits/merged/test_real.jsonl
      - split: hard
        path: splits/merged/hard.jsonl
  - config_name: agreed
    data_files:
      - split: train
        path: splits/agreed/train.jsonl
      - split: validation
        path: splits/agreed/val.jsonl

Reachy gestures data

This repo holds everything needed to retrain HuggingFaceM4/reachy-gestures. That model picks the gesture Reachy Mini plays while it speaks (say) or while it listens (react). The repo has:

  • the labelled sentences and the unlabelled pools,
  • the scripts that run on Hugging Face Jobs,
  • the scripts that ran on a laptop to make the data and launch the jobs,
  • the exact commands for the model that shipped.

The teacher the shipped model was distilled from is public too: HuggingFaceM4/reachy-gestures-teacher.

What's where

Path What it is
splits/{merged,agreed,kimi,gptoss}/ Labelled training sets, each with train, val, test, test_real, hard and labels.json. The four variants differ only in train.jsonl (see below).
pools/ Unlabelled sentences. The teacher scores them and the student learns from those scores.
scripts/ Code that runs inside the job: pipeline.py, train.py, distill_data.py, export.py, evaluate.py. The job reads it from this repo, which is mounted at /gesture.
lab/ Code that runs on your laptop: data generation and labelling, building the splits, launching jobs, checking results, and rendering the model card GIFs. It also holds the raw generated and labelled files the splits were built from.
lab/launch/ teachers.py and students.py start the jobs. watch.py, wait.sh and collect.py follow them and print their scores.

The data

Labelled rows (splits/*/*.jsonl)

{"kind": "react", "text": "I'm happy you helped me compare the prices.", "best": "grateful1", "ok": ["grateful1", "welcoming2"],
 "language": "English", "target": "welcoming2", "model": "openai/gpt-oss-120b", "source": null, "req": "1-544"}
Field Meaning
kind say is a sentence the robot says. react is a sentence the person says and the robot hears. Each kind has its own set of gestures in labels.json (22 + none for say, 15 + none for react).
text The sentence.
ok Every gesture that would be fine for this sentence, possibly none. A prediction counts as correct when it's in this list.
best The labeller's single favourite. The training loss pulls a little towards it.
language, target, model, source, req Where the sentence came from. target was only a prompt to vary the generation. Sentences were labelled blind, so target is not the label.

pools/*.jsonl rows are generation batches: {"kind", "language", "sentences": [...20 sentences], ...}, with no labels.

The four label variants

openai/gpt-oss-120b and moonshotai/Kimi-K3 each labelled the same 38,092 sentences without seeing each other's answer. A pair of labels counts as compatible when each labeller's best is in the other's ok.

Variant train.jsonl Used for
agreed The 29,674 compatible sentences. ok is the intersection of the two sets and best is Kimi's. The shipped teacher
merged agreed, plus the incompatible sentences with ok = the union and best = Kimi's (38,092). The shipped student
kimi Kimi's labels only. Comparisons
gptoss gpt-oss labels only. Comparisons

The evaluation sets are shared by all four variants:

File Rows What it is
val.jsonl 2,494 Held out from the generated data by request id. Kept only where the two labellers agree. The decision threshold is chosen on this set.
test.jsonl 462 Written by zai-org/GLM-5.3, a model that wrote none of the training data. Labelled by gpt-oss and GLM, and kept where they agree.
test_real.jsonl 411 Real text from oasst2, GoEmotions and BRIGHTER, held out by request id. Labelled by gpt-oss and GLM, and kept where they agree.
hard.jsonl 119 Hand-written traps from lab/hard_cases.py: negation, implied feelings, neutral questions, other languages.

Pools

File Sentences Source
gen_train3.jsonl, gen_pool11–13.jsonl 18k each gpt-oss-120b and gemma-4-31B-it, 15 languages (lab/generate.py, seeds 4, 11, 12, 13)
gen_pool21–26.jsonl 21–23k each Same, plus a little Qwen3.8-27B. Weighted towards the hard categories and the confused gestures (seeds 21–26).
real_all.jsonl 131k Every short sentence from oasst2, GoEmotions and BRIGHTER (lab/real_sources_all.py)
real_big.jsonl 53k A capped sample of the same (lab/real_sources_big.py), used by early runs

Sentences that also appear in an evaluation set are dropped before distillation (distill_data.py).

How the shipped model was made

lab/generate.py ─┐                     ┌─ splits/agreed ──► teacher: Qwen3-Embedding-8B fine-tune ─┐
lab/real_sources ┴► lab/label.py ×2 ──►┤   (gpt-oss + Kimi)                                          ├─► distill_data.py: teacher scores
                    (gpt-oss, Kimi)    └─ splits/merged ─────────────────────────────────────────────┤    merged + ~334k pool sentences
                                                                                                     └─► student: MiniLM-L12, 15 epochs, T=4
                                                                                                          ► export.py: ONNX + int8 ► evaluate.py

There were two jobs, both run through scripts/pipeline.py on one H200:

  1. Teacher (job 6afe2be4545f95df1c06c0d1, 2026-11-18). It fine-tuned Qwen/Qwen3-Embedding-8B on splits/agreed for 5 epochs (about 7.5 min per epoch), with lr 3e-6, batch 32, 8-bit AdamW, last-token pooling and an instruction prefix. It pushed reachy-gesture-teacher-qwen3-emb-8b-lab-agreed, now renamed to HuggingFaceM4/reachy-gestures-teacher.
  2. Student (job 6afe4aab545f95df1c06e028, 2026-11-19). It distilled that teacher into sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2 on splits/merged plus the pools, for 15 epochs at temperature 4 with lr 4e-5 / head lr 2e-3, then exported and scored it. It pushed reachy-gesture-student-minilm-e15-t4-full-q8b, which was then copied to HuggingFaceM4/reachy-gestures. Its training.json has every argument and the per-epoch scores.

Reproduce it

0. Setup

You need:

  • the hf CLI, logged in with a token that can write to the org you push to (hf auth login),
  • access to Hugging Face Jobs,
  • uv.
hf download HuggingFaceM4/reachy-gestures-data --repo-type dataset --local-dir reachy-gestures-data
cd reachy-gestures-data/lab
uv venv && uv pip install huggingface_hub

Run every launcher from lab/. hf jobs uv run uploads lab/pipeline.py, and the job installs its own dependencies from the script header.

Trained runs are pushed as private repos named $NAMESPACE/reachy-gesture-…. NAMESPACE defaults to HuggingFaceM4; set NAMESPACE=your-user to keep test runs out of the org.

1. Smoke test (about 10 minutes, under $1)

This checks that the mount, the scripts and the public teacher all work before you spend H200 hours. It uses 1% of the data, one epoch and one small pool, and pushes nothing:

SMOKE=1 FLAVOR=a10g-large TEACHER_BF16=1 TEACHER_REPO=HuggingFaceM4/reachy-gestures-teacher \
  DATA_DIR=splits/merged POOLS="gen_train3.jsonl" \
  .venv/bin/python launch/students.py smoke minilm-e15-t4
# prints  minilm-e15-t4=<job id>
.venv/bin/python launch/watch.py smoke=<job id>

The run ends with {"model": ...} score lines for model.onnx and model_qint8.onnx. The scores will be poor, because it trained on 1% for one epoch.

2. Teacher (skip it to reuse the published teacher)

DATA_DIR=splits/agreed TAG=-lab-agreed STUDENT_EPOCHS=10 \
  POOLS="gen_train3.jsonl gen_pool11.jsonl gen_pool12.jsonl gen_pool13.jsonl real_all.jsonl" \
  .venv/bin/python launch/teachers.py full qwen3-emb-8b

This runs on an H200. It trains the teacher and also distills a 10-epoch side student, which was only used for comparison. The teacher lands in $NAMESPACE/reachy-gesture-teacher-qwen3-emb-8b-lab-agreed.

3. Student (the shipped model)

TEACHER_BF16=1 FLAVOR=h200 TEACHER_REPO=HuggingFaceM4/reachy-gestures-teacher DATA_DIR=splits/merged \
  POOLS="gen_train3.jsonl gen_pool11.jsonl gen_pool12.jsonl gen_pool13.jsonl gen_pool21.jsonl gen_pool22.jsonl gen_pool23.jsonl gen_pool24.jsonl gen_pool25.jsonl gen_pool26.jsonl real_all.jsonl" \
  .venv/bin/python launch/students.py full-q8b minilm-e15-t4

If you trained your own teacher in step 2, point TEACHER_REPO at it. launch/students.py lists the other variants that were tried (minilm-e15-t2, mpnet-e10-t2, e5small-…). You can pass several names to launch them side by side.

4. Read the scores

.venv/bin/python launch/watch.py q8b=<job id>     # live: one line per epoch
.venv/bin/python launch/collect.py q8b=<job id>   # final int8 ONNX scores at the val-chosen threshold

The shipped model scored 83.5% on test, 94.9% on test_real and 83.2% on hard, with 6 opposite-feeling mistakes. Training on GPUs isn't bit-exact, so expect to land within about a point of those.

5. Ship it

  1. Copy the new run's files (model_qint8.onnx, gesture_heads.npz, gesture_labels.json, tokenizer files, training.json) into HuggingFaceM4/reachy-gestures.
  2. In the conversation app, set _MODEL_REVISION in src/reachy_mini_conversation_app/gestures.py to the new commit hash. The app pins a revision, so robots keep the old model until they get an app update.
  3. lab/render_gifs.py re-renders the model card GIFs in MuJoCo. It needs reachy_mini and mujoco==3.3.0.

Rebuild the data from scratch

You only need this to change the data: new gestures, new languages, a different labeller. It calls LLMs through Hugging Face Inference Providers, which bills your account. LLM sampling isn't deterministic, so you'll get new sentences, not the same ones. The published files are the record of what the model saw.

Run everything from lab/, in a venv with huggingface_hub pandas pyarrow.

  1. Real sentences: run real_sources.py real.jsonl (labelled set) and real_sources_all.py real_all.jsonl (pool). real_test.jsonl is a set of batches taken out of real.jsonl by request id; the build scripts keep those out of training.
  2. Generated sentences:
    • Training batches: generate.py gen_train.jsonl openai/gpt-oss-120b,google/gemma-4-31B-it 1 1, then seed 3 for gen_train2 and seed 4 for gen_train3.
    • Pools: seeds 4, 11–13 and 21–26. Pools 21–26 also listed Qwen/Qwen3.8-27B.
    • Test set: generate.py gen_test.jsonl zai-org/GLM-5.3 1 2. gen_test_small.jsonl is the 75-batch sample of it that was labelled.
    • The prompts, languages, topics and hard categories are at the top of generate.py.
  3. Labels: run label.py gen_train.jsonl openai/gpt-oss-120b lab_train_gptoss.jsonl, and the same with moonshotai/Kimi-K3 for lab_train_kimi.jsonl. Do this for gen_train2 and real too, and label the test sets with GLM-5.3. THREADS=16 sets the parallelism. The label prompt and gesture descriptions are in labels.py, move_descriptions.json and gesture_phrases.json.
  4. Splits: build_dataset.py writes data/: the gpt-oss-only v1 splits plus the shared test, test_real and hard. build_dataset2.py then writes splits/{gptoss,kimi,agreed,merged}/.
  5. Upload: hf upload HuggingFaceM4/reachy-gestures-data splits splits --repo-type dataset, and the same for pools/.

score_teachers.py compares candidate LLM labellers on the hand-written hard cases. That comparison is how gpt-oss and Kimi were chosen. lab_*.jsonl and gen_*.jsonl in lab/ are the raw files the published splits were built from.

Gotchas

  • The job reads scripts/, not lab/. pipeline.py copies /gesture/scripts/ into the job. After editing train.py, distill_data.py, export.py or evaluate.py in lab/, upload them, for example hf upload HuggingFaceM4/reachy-gestures-data lab/train.py scripts/train.py --repo-type dataset. Otherwise the job runs the old code.
  • lab/evaluate.py is a superset of scripts/evaluate.py. It adds THREE_WAY=1, which also scores the test rows where Kimi agrees (lab_test_kimi.jsonl, lab_test_real_kimi.jsonl).
  • Teachers with billions of parameters need TEACHER_BF16=1 for distillation, or they run out of memory.
  • In job logs, thr0 is the score with no threshold. best picks a threshold per set, which is optimistic. @val applies the val-chosen threshold to every set, and those are the honest numbers.
  • lab/split_check.py compares reading whole replies, the last 64 tokens, or each sentence. The app reads the last 64 tokens because of it.

Sources and licences

Part Source Terms
Real sentences OpenAssistant/oasst2 Apache 2.0
google-research-datasets/go_emotions Apache 2.0
brighter-dataset/BRIGHTER-emotion-categories CC BY 4.0
Generated sentences openai/gpt-oss-120b, google/gemma-4-31B-it, Qwen/Qwen3.8-27B, zai-org/GLM-5.3 Each model's own terms
Labels openai/gpt-oss-120b, moonshotai/Kimi-K3, zai-org/GLM-5.3 Each model's own terms
Hard cases, scripts Written for this project Apache 2.0

Reuse the real sentences under their original licences, with attribution for BRIGHTER. No recordings or transcripts of conversations with a robot are in this dataset.