single-task-transfer-artifacts / experiments /multi_source_3task /repro /build_multi_source_manifests.py
single-task-transfer-artifacts / experiments /multi_source_3task /repro /build_multi_source_manifests.py
Download experiments/multi_source_3task/repro/build_multi_source_manifests.py from Chand0320/single-task-transfer-artifacts: direct link, hf CLI and curl.
- Browser
- Download file 1.77 kB
-
https://huggingface.co/datasets/Chand0320/single-task-transfer-artifacts/resolve/main/experiments/multi_source_3task/repro/build_multi_source_manifests.py
- Command line
-
hf download hf://datasets/Chand0320/single-task-transfer-artifacts/experiments/multi_source_3task/repro/build_multi_source_manifests.py
-
curl -L -o build_multi_source_manifests.py https://huggingface.co/datasets/Chand0320/single-task-transfer-artifacts/resolve/main/experiments/multi_source_3task/repro/build_multi_source_manifests.py
1.77 kB
| #!/usr/bin/env python3 | |
| """Fix 100 seed-0 episodes per task for the three-task source pool.""" | |
| import argparse | |
| import json | |
| from pathlib import Path | |
| from inspect_and_manifest import select_manifest, summarize, write_json | |
| TASKS = { | |
| "coffee_preparation_d0": ("source_episodes.json", (68662, 67762)), | |
| "pick_place_d0": ("broad_pick_place_d0_episodes.json", (67611, 66711)), | |
| "kitchen_d0": ("multi_kitchen_d0_episodes.json", None), | |
| } | |
| def main(): | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument("--raw-root", type=Path, required=True) | |
| parser.add_argument("--output-dir", type=Path, required=True) | |
| args = parser.parse_args() | |
| combined = {"seed": 0, "episodes_per_task": 100, "sequence_length": 10, "tasks": {}} | |
| for task, (filename, expected) in TASKS.items(): | |
| raw = args.raw_root / "core" / f"{task}.hdf5" | |
| summary = summarize(raw) | |
| manifest = select_manifest(summary, f"core/{task}", 100, 0, 10) | |
| counts = ( | |
| sum(row["timesteps"] for row in manifest["episodes"]), | |
| manifest["valid_sequence_anchors"], | |
| ) | |
| if expected is not None and counts != expected: | |
| raise RuntimeError(f"{task}: expected {expected}, got {counts}") | |
| manifest["raw_file"] = {"path": str(raw), "bytes": summary["bytes"], "sha256": summary["sha256"]} | |
| manifest["raw_timesteps"] = counts[0] | |
| write_json(args.output_dir / filename, manifest) | |
| combined["tasks"][task] = {"manifest": filename, "raw_timesteps": counts[0], "complete_windows": counts[1]} | |
| write_json(args.output_dir / "multi_source_manifest.json", combined) | |
| print(json.dumps(combined, indent=2, sort_keys=True)) | |
| print("MULTI_SOURCE_MANIFESTS_OK") | |
| if __name__ == "__main__": | |
| main() | |