Datasets:
Download lab/launch/students.py from HuggingFaceM4/reachy-gestures-data: direct link, hf CLI and curl.
- Browser
- Download file 2.26 kB
-
https://huggingface.co/datasets/HuggingFaceM4/reachy-gestures-data/resolve/main/lab/launch/students.py
- Command line
-
hf download hf://datasets/HuggingFaceM4/reachy-gestures-data/lab/launch/students.py
-
curl -L -o students.py https://huggingface.co/datasets/HuggingFaceM4/reachy-gestures-data/resolve/main/lab/launch/students.py
2.26 kB
| """Launch student variants distilled from a trained teacher (TEACHER_REPO). python launch/students.py round [names...] | |
| SMOKE=1 runs a tiny version (1% of the data, one epoch, nothing pushed) to check that everything starts. | |
| """ | |
| import os, sys, subprocess | |
| NAMESPACE = os.environ.get("NAMESPACE", "HuggingFaceM4") # where the trained runs are pushed (private repos) | |
| MPNET = "sentence-transformers/paraphrase-multilingual-mpnet-base-v2" | |
| MINILM, E5S = "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2", "intfloat/multilingual-e5-small" | |
| VARIANTS = { | |
| "minilm-e10": [MINILM, "--epochs", "10"], | |
| "minilm-e10-t2": [MINILM, "--epochs", "10", "--distill_temp", "2"], | |
| "e5small-e10": [E5S, "--prefix", "query: ", "--epochs", "10"], | |
| "e5small-e10-t2": [E5S, "--prefix", "query: ", "--epochs", "10", "--distill_temp", "2"], | |
| "minilm-e15": [MINILM, "--epochs", "15"], | |
| "minilm-e15-t2": [MINILM, "--epochs", "15", "--distill_temp", "2"], | |
| "minilm-e15-t4": [MINILM, "--epochs", "15", "--distill_temp", "4"], | |
| "mpnet-e10-t2": [MPNET, "--epochs", "10", "--distill_temp", "2", "--lr", "3e-5"], | |
| } | |
| round_tag, names = sys.argv[1], sys.argv[2:] or list(VARIANTS) | |
| pools = os.environ.get("POOLS", "gen_train3.jsonl real_big.jsonl") | |
| smoke = bool(os.environ.get("SMOKE")) | |
| for name in names: | |
| base, *extra = VARIANTS[name] | |
| cmd = ["hf", "jobs", "uv", "run", "--flavor", os.environ.get("FLAVOR", "a100-large"), "--timeout", "4h", "-d", "--secrets", "HF_TOKEN", | |
| "-e", f"TEACHER_REPO={os.environ.get('TEACHER_REPO', 'HuggingFaceM4/reachy-gestures-teacher')}", "-e", f"DATA_DIR={os.environ.get('DATA_DIR', '')}", "-e", f"TEACHER_BF16={os.environ.get('TEACHER_BF16', '')}", "-e", f"POOLS={pools}", | |
| *([] if smoke else ["-e", f"PUSH_TO={NAMESPACE}/reachy-gesture-student-{name}-{round_tag}"]), | |
| "-v", "hf://datasets/HuggingFaceM4/reachy-gestures-data:/gesture", "pipeline.py", "--base", base, "--distill_weight", "1.0", *extra, *(["--frac", "0.01", "--epochs", "1"] if smoke else [])] | |
| out = subprocess.run(cmd, capture_output=True, text=True, env=os.environ | {"HF_HUB_DISABLE_EXPERIMENTAL_WARNING": "1"}) | |
| job = (out.stdout + out.stderr).split("hf jobs logs ")[-1].split("`")[0] | |
| print(f"{name}={job}") | |