#!/usr/bin/env python3 """Turn build_lap_uniform.py's output into the HF release folder LehongWu/sft_lap_data-1128 (in place). - sft_json//meta.json: action_store.file relative to that folder, provenance.annotation_dir relative to the release; vla_config.json: file names relative to that folder (as in LehongWu/sft_lap_data-1125). - code/ (the scripts that built it), docs/ (the construction notes), README.md with the counts from the metas. - manifest.json: bytes and sha256 of every other file (LlamaFactory's v3 builder checks the manifest sizes). Usage: python package_lap_release.py /tmp/lap-sft-1128/hf """ import argparse import hashlib import json from pathlib import Path import shutil from build_lap_uniform import DATASETS, QUOTAS, RUN HERE = Path(__file__).resolve().parent WORKSPACE = HERE.parents[1] REPO = "LehongWu/sft_lap_data-1128" CODE = ("build_lap_uniform.py", "build_lap_selected.py", "annotate_lap.py", "convert_annotation_lap_to_sft_json.py", "convert_annotation_idm_to_sft_json.py", "run_lap_uniform.sh", "package_lap_release.py", "test_build_lap_uniform.py") DOCS = ("docs/lap_uniform_data_construction-261128.md", "docs/lap_selected_data_construction-261125.md") def sha256(path): digest = hashlib.sha256() with open(path, "rb") as stream: for block in iter(lambda: stream.read(8 << 20), b""): digest.update(block) return digest.hexdigest() def relativize(root, name): folder = root / name / "sft_json" / RUN meta = json.loads((folder / "meta.json").read_text()) store = Path(meta["action_store"]["file"]) if store.is_absolute(): meta["action_store"]["file"] = f"../../{RUN}/{store.name}" meta["provenance"]["annotation_dir"] = f"{name}/{RUN}" (folder / "meta.json").write_text(json.dumps(meta, indent=2) + "\n") if not (folder / meta["action_store"]["file"]).resolve().is_file(): raise SystemExit(f"{folder}: action store {meta['action_store']['file']} is missing") config = json.loads((folder / "vla_config.json").read_text()) for key in ("train_json", "val_json", "val_ood_json"): config[key] = [Path(value).name for value in config[key]] (folder / "vla_config.json").write_text(json.dumps(config, indent=2) + "\n") return meta def readme(root, metas): rows, totals = [], {"chunks": 0, "train": 0, "val": 0, "val_ood": 0, "episodes": 0, "picked": 0, "all": 0} for name in DATASETS: meta, annotation = metas[name], json.loads((root / name / RUN / "meta.json").read_text()) files = annotation["selection"]["files"] items = {split: sum(f["num_items"] for f in meta["files"].values() if f["split"] == split) for split in ("train", "val", "val_ood")} train_episodes = meta["files"]["LAP-A2L-train.jsonl"]["num_episodes"] all_train = files["episodes"]["train"][1] rows.append(f"| {name} | {QUOTAS[name]:,} | {items['train']:,} | {items['val']:,} | {items['val_ood']:,} | " f"{train_episodes:,} / {all_train:,} ({train_episodes / all_train:.0%}) | " f"{annotation['selection']['summary']['rate']:.1%} | {files['bytes'][0] / 1e9:.1f} / " f"{files['bytes'][1] / 1e9:.1f} GB |") totals["chunks"] += QUOTAS[name] for split in ("train", "val", "val_ood"): totals[split] += items[split] totals["episodes"] += train_episodes totals["all"] += all_train totals["picked"] += files["bytes"][0] table = "\n".join(rows) return f"""--- license: other pretty_name: LAP (action <-> language) SFT data, 2026-11-28 --- # LAP SFT data (2026-11-28) Action-to-language (LAP-A2L) and language-to-action (LAP-L2A) SFT data for four bimanual datasets: ABC-130k (zheyuan 1115), MolmoAct YAM (1116), World Engine (1120) and Agibot 2026 (1122). The text is computed from the actions (rounded per-arm tool-frame pose changes at 1 cm / 5 deg / 10% gripper, relative to the measured start pose), so no model is involved; the text protocol is the same as LehongWu/sft_lap_data-1125. Agibot Beta is not included (wrist-camera axis bug). What changed from 1125: chunks are sampled uniformly (no motion weighting, no static cap), every chunk gives **both** an A2L and an L2A item (with the chunk's own A2L horizon and L2A rate), and the sampling is download-efficient. The low-dim streams are stored many episodes per parquet file, so whole files are picked at random until every task has at least 1/3 of its prepared train episodes; every prepared episode in a picked file is used, and every whole-second chunk of those episodes is drawn at one rate per dataset. The per-dataset chunk totals are proportional to the datasets' whole-second train chunks (each chunk of the four datasets has the same 11.8% chance overall). | Dataset | train chunks | train items (A2L + L2A) | val items | val_ood items | train episodes used | chunks drawn per episode-second | low-dim downloaded | |---|---|---|---|---|---|---|---| {table} | **Total** | **{totals['chunks']:,}** | **{totals['train']:,}** | {totals['val']:,} | {totals['val_ood']:,} | {totals['episodes']:,} / {totals['all']:,} ({totals['episodes'] / totals['all']:.0%}) | | {totals['picked'] / 1e9:.1f} GB | val / val_ood come from the episodes of the picked files at the train rate; the converter keeps 2 val episodes per task (10 per held-out ABC-130k task for val_ood), as for the IDM manifests. Windows were checked against the 1125 release: identical at every shared (episode, second). Details: `docs/lap_uniform_data_construction-261128.md`. ## Layout ``` /{RUN}/actions.npy (N, 61, 16) float16 cartesian_tool windows at 60 Hz, per arm [dx dy dz rx ry rz gripper pad]; rows [:60] are the training window /{RUN}/episodes.jsonl per-episode chunk records (lap-episode-v2 without "direction": both items) /{RUN}/meta.json selection settings and counts /sft_json/{RUN}/LAP-{{A2L,L2A}}-{{train,val,val_ood}}.jsonl LlamaFactory manifests (loader abc130k-lap, schema 3) /sft_json/{RUN}/meta.json shared settings; action_store.file is relative to this folder /sft_json/{RUN}/vla_config.json a LlamaFactory source config (file names relative to this folder) code/ the scripts that built it; docs/ construction notes manifest.json bytes and sha256 of every other file ``` Download everything with `hf download {REPO} --repo-type dataset --local-dir ` and point a LlamaFactory `vla_config` dataset at `//sft_json/{RUN}/vla_config.json`, or use `examples/vla/build_action_lang_align-v3-1124.py --lap-root ` in LlamaFactory. """ def main(): parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument("root", type=Path) root = parser.parse_args().root.resolve() metas = {name: relativize(root, name) for name in DATASETS} for sub, names, base in (("code", CODE, HERE), ("docs", DOCS, WORKSPACE)): (root / sub).mkdir(exist_ok=True) for name in names: shutil.copy2(base / name, root / sub / Path(name).name) (root / "README.md").write_text(readme(root, metas)) manifest = {} for path in sorted(p for p in root.rglob("*") if p.is_file() and ".cache" not in p.parts): relative = str(path.relative_to(root)) if relative != "manifest.json": manifest[relative] = {"bytes": path.stat().st_size, "sha256": sha256(path)} (root / "manifest.json").write_text(json.dumps(manifest, indent=1) + "\n") print(f"{root}: {len(manifest)} files, {sum(v['bytes'] for v in manifest.values()) / 1e9:.2f} GB") if __name__ == "__main__": main()