Download leaf/code/v1.5/v1.4/make_card.py from COCOMatrix/LEAF-Bench: direct link, hf CLI and curl.
- Browser
- Download file 7.86 kB
-
https://huggingface.co/datasets/COCOMatrix/LEAF-Bench/resolve/main/leaf/code/v1.5/v1.4/make_card.py
- Command line
-
hf download hf://datasets/COCOMatrix/LEAF-Bench/leaf/code/v1.5/v1.4/make_card.py
-
curl -L -o make_card.py https://huggingface.co/datasets/COCOMatrix/LEAF-Bench/resolve/main/leaf/code/v1.5/v1.4/make_card.py
7.86 kB
| """Generate release documentation from audited metadata.""" | |
| from collections import Counter | |
| from datetime import datetime, timezone | |
| import json | |
| from pathlib import Path | |
| import sys | |
| J=Path(__file__).resolve().parent | |
| B=J.parent | |
| group=sys.argv[1] | |
| legacy=group=='legacy' | |
| root=B/('legacy_dataset' if legacy else 'dataset') | |
| work=B/('legacy_work' if legacy else 'export_work') | |
| dest=Path('/mnt/cpfs/shared/datasets')/('lffbench_legacy_agent_replays/v1' if legacy else 'lffbench_agent_replays/v1.4') | |
| title='LFF-Bench Legacy Agent Replays v1' if legacy else 'LFF-Bench Agent Replays v1.4' | |
| audit=json.loads((J/f'{group}_release_audit.json').read_text()) | |
| val=json.loads((work/'validation_report.json').read_text()) | |
| assert audit['status']==val['status']=='pass' | |
| eps=[json.loads(s) for s in (root/'lff/episodes.jsonl').read_text().splitlines()] | |
| runs=[json.loads(s) for s in (root/'lff/runs.jsonl').read_text().splitlines()] | |
| selection=json.loads((J/'verified_selection.json').read_text()) | |
| added=[r for r in selection['accepted'] if r['cohort']==group] | |
| excluded=[r for r in selection['rejected'] if r['cohort']==group] | |
| models={} | |
| for e in eps: | |
| d=models.setdefault((e['model'],e['harness'],e['harness_version']),Counter()) | |
| d['episodes']+=1;d['frames']+=e['length'];d['attempts']+=len(e['attempts']) | |
| d['success']+=sum(s is True for s in e['success']);d['failure']+=sum(s is False for s in e['success']) | |
| table='\n'.join('| '+' / '.join(str(x) for x in k)+f" | {v['episodes']} | {v['frames']:,} | {v['attempts']} | {v['success']} | {v['failure']} |" for k,v in sorted(models.items())) | |
| batches=Counter(r['batch'] for r in added) | |
| batch_table='\n'.join(f'| `{k}` | {v} |' for k,v in sorted(batches.items())) | |
| counts=f"{audit['total_runs']} runs · {audit['total_episodes']} episodes · {audit['total_frames']:,} frames ({audit['total_frames']/20/3600:.1f} hours at 20 Hz) · {len({e['task'] for e in eps})} tasks · {audit['total_attempts']} attempts ({audit['total_success']} success / {audit['total_failure']} failure)." | |
| parent_note=('Separate historical simulator cohort: the original, uncapped elbow configuration is restored from the exact logged `lffbench/envs.py` hash (git revision `2105949bcafba9a4aa07529b1030e4b7df7a95ad`). Other simulator files match each run contract. This cohort must remain distinguishable from the current capped-elbow benchmark.' if legacy else | |
| 'Cumulative release extending v1.3. All 596 parent episodes retain their indices and simulation-state files. Parent videos are reused without lossy re-encoding. New data backfills completed historical evaluations and the completed portion of active batches at the inventory snapshot.') | |
| parent=Path('/mnt/cpfs/shared/datasets/lffbench_agent_replays/v1.3/README.md').read_text() | |
| feature_text=parent[parent.index('## Episodes and frames'):parent.index('## How it was made and verified')] | |
| feature_text=feature_text.replace('for the six continuous-scene tasks','for continuous-scene tasks') | |
| if legacy: | |
| feature_text=feature_text.replace('Panda elbow joint capped at −0.55 rad','original Panda elbow joint range (no −0.55 rad cap)') | |
| checked=sum(r['reports_checked'] for r in added) | |
| scope_note=('These are historical DeepSeek pilot, smoke and partial evaluation batches.' if legacy else | |
| 'The batches include pilot, smoke, diagnostic, repeated-task and full-evaluation runs.') | |
| framework_note=('These historical DeepSeek evaluations used the logged API-player driver versions shown above; their framework_config fields may be null.' if legacy else | |
| 'Framework names describe the logged LFF-Bench integrations: RPent, Embodied Evo and SenseNova are controlled integrations and are not assertions of equivalence to every native framework feature. RPent uses archive/handoff across sessions; Codex/Claude Code and the other newly integrated harnesses use their logged history settings. DeepSeek records use their logged API driver or Codex harness; a provider field of `openai` can describe the API transport rather than the model vendor.') | |
| card=f'''# {title} | |
| LeRobot v3.0 closed-loop LFF-Bench manipulation trajectories with success and failure outcomes, 20 Hz state/action records, two 256×256 cameras, command annotations and full MuJoCo states. | |
| **{counts}** | |
| {parent_note} | |
| ## Contents | |
| | Model / harness / version | Episodes | Frames | Attempts | Success | Failure | | |
| |---|---:|---:|---:|---:|---:| | |
| {table} | |
| ## Additions and scope | |
| This release adds {audit['added_runs']} runs, {audit['added_episodes']} episodes, {audit['added_frames']:,} frames and {audit['added_attempts']} judged attempts. Only completed runs at the frozen inventory and exact replay candidates are included. | |
| | Added batch | Runs | | |
| |---|---:| | |
| {batch_table} | |
| {scope_note} They are not independent repetitions of one unchanged agent. Keep source batch, task-seed, harness configuration and simulator cohort when filtering or splitting; overlapping runs and shared memory-free-retry first attempts can otherwise cause leakage. In-progress runs were not snapshotted as completed data. `lff/release/excluded_inventory.json` records pending, interrupted and unrecovered-code inputs; `lff/release/verified_selection.json` records replay candidates and exclusions. | |
| New episode annotations preserve `source.simulator_cohort`, `agent.evaluation_cohort`, `agent.framework_config` and their original harness/model fields. {framework_note} | |
| ## Verification | |
| For the additions, {checked:,} command reports and logged attempt outcomes reproduced with zero mismatches. Every accepted run's recorded simulator code hashes match its replay source. {len(excluded)} candidate runs with no exact replay were excluded from this dense cohort; their original logs remain in place and their mismatch reports are recorded. | |
| All episode/frame counts, original attempt labels, framework configs, input hashes and source hashes passed the release audit. Validation loaded {val['samples']} frames through LeRobot, sampling every newly added episode ({val['new_samples']} new and {val['old_samples']} parent samples). Maximum state/action absolute error: {val['max_state_action_abs_err']:.3g}; maximum mean image error after AV1 encoding: {val['max_mean_abs_pixel_err']} / 255. `SHA256SUMS` covers every published file and is checked during publication. | |
| ## Loading | |
| ```python | |
| from lerobot.datasets.lerobot_dataset import LeRobotDataset | |
| ds = LeRobotDataset("lffbench/agent-replays", root="{dest}") | |
| frame = ds[0] | |
| ``` | |
| {feature_text} | |
| ## Related historical archive | |
| Earlier evaluations without simulator code fingerprints are preserved separately in `/mnt/cpfs/shared/datasets/lffbench_legacy_evaluation_archive/v1`. That archive contains original videos, observation images and evaluator logs; it is not a dense-action LeRobot dataset and is not included in the counts above. | |
| ''' | |
| (root/'README.md').write_text(card) | |
| (root/'MANIFEST.md').write_text(f'''# {title} manifest | |
| Generated {datetime.now(timezone.utc).isoformat()}. | |
| {counts} | |
| Published path: `{dest}`. Working provenance: `{J}`. Initial replay job: `dlc160tqtnb00dmh`; any subsequent export job is recorded in `lff/release/`. | |
| {parent_note} | |
| Input selection and file hashes: `lff/release/snapshot.json`, `selected.json`, `verified_selection.json`. All audit and validation reports are bundled under `lff/release/`. Replay/export sources are frozen under `{J}/source` and `{J}/legacy_source`; per-file hashes are in the snapshot. Video frames retain observation-before-action semantics. This release is immutable. | |
| ''') | |
| notes=json.loads((root/'lff/batches.json').read_text()) | |
| for batch in batches: | |
| notes.setdefault(batch,dict(note='Historical completed-run backfill; retain batch identity and per-episode framework config.',simulator_cohort='legacy_uncapped_elbow' if legacy else 'current_capped_elbow')) | |
| (root/'lff/batches.json').write_text(json.dumps(notes,indent=2)) | |
| print(counts) | |