andito's picture
andito HF Staff
Data, training code and reproduction steps for reachy-gestures
0cc835c verified
Raw History Blame Contribute Delete
2.71 kB
"""Launch one pipeline job per teacher. python launch/teachers.py smoke|full"""
import sys, subprocess, os
NAMESPACE = os.environ.get("NAMESPACE", "HuggingFaceM4") # where the trained runs are pushed (private repos)
TEACHERS = {
"e5-large": ("intfloat/multilingual-e5-large", '--prefix "query: " --lr 2e-5'),
"qwen3-emb-0.6b": ("Qwen/Qwen3-Embedding-0.6B", '--prefix "Instruct: Classify the feeling or conversational gesture this sentence expresses\\nQuery:" --pooling last --lr 1e-5'),
"embeddinggemma": ("google/embeddinggemma-300m", '--prefix "task: classification | query: " --lr 2e-5'),
"e5-large-instruct": ("intfloat/multilingual-e5-large-instruct", '--prefix "Instruct: Classify the feeling or conversational gesture this sentence expresses\\nQuery: " --lr 2e-5'),
"bge-m3": ("BAAI/bge-m3", '--lr 2e-5 --pooling first'),
"qwen3-emb-4b": ("Qwen/Qwen3-Embedding-4B", '--prefix "Instruct: Classify the feeling or conversational gesture this sentence expresses\\nQuery:" --pooling last --lr 5e-6 --batch 32'),
"qwen3-emb-8b": ("Qwen/Qwen3-Embedding-8B", '--prefix "Instruct: Classify the feeling or conversational gesture this sentence expresses\\nQuery:" --pooling last --lr 3e-6 --batch 32 --optim adamw8bit --save_dtype bfloat16'),
}
BIG = {"qwen3-emb-4b": "h200", "qwen3-emb-8b": "h200"}
mode = sys.argv[1]
only = sys.argv[2:] or list(TEACHERS)
smoke = " --frac 0.01 --epochs 1" if mode == "smoke" else ""
for name in only:
repo, args = TEACHERS[name]
tag = os.environ.get("TAG", "")
env = ["-e", f"DATA_DIR={os.environ.get('DATA_DIR', '')}", "-e", f"POOLS={os.environ.get('POOLS', 'gen_train3.jsonl real_big.jsonl')}", "-e", f"TEACHER={repo}", "-e", f"TEACHER_ARGS=--save_dtype float32 {args}{smoke}"]
if mode == "full":
env += ["-e", f"PUSH_TO={NAMESPACE}/reachy-gesture-minilm-from-{name}{tag}", "-e", f"PUSH_TEACHER_TO={NAMESPACE}/reachy-gesture-teacher-{name}{tag}"]
student = ["--base", "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2", "--distill_weight", "1.0", "--epochs", os.environ.get("STUDENT_EPOCHS", "5")] + (["--frac", "0.01", "--epochs", "1"] if smoke else [])
cmd = ["hf", "jobs", "uv", "run", "--flavor", BIG.get(name, os.environ.get("FLAVOR", "a100-large")), "--timeout", "4h" if mode == "full" else "40m", "-d", "--secrets", "HF_TOKEN", *env,
"-v", "hf://datasets/HuggingFaceM4/reachy-gestures-data:/gesture", "pipeline.py", *student]
out = subprocess.run(cmd, capture_output=True, text=True, cwd=os.path.dirname(os.path.dirname(os.path.abspath(__file__))), env=os.environ | {"HF_HUB_DISABLE_EXPERIMENTAL_WARNING": "1"})
print(name, (out.stdout + out.stderr).strip().splitlines()[-1:])