Datasets:
Download code/robohome/src/paper_eval/validation/collect_validation.py from RoboParty/RoboHome: direct link, hf CLI and curl.
- Browser
- Download file 2.6 kB
-
https://huggingface.co/datasets/RoboParty/RoboHome/resolve/main/code/robohome/src/paper_eval/validation/collect_validation.py
- Command line
-
hf download hf://datasets/RoboParty/RoboHome/code/robohome/src/paper_eval/validation/collect_validation.py
-
curl -L -o collect_validation.py https://huggingface.co/datasets/RoboParty/RoboHome/resolve/main/code/robohome/src/paper_eval/validation/collect_validation.py
2.6 kB
| """Per seed: take the newest finished run (z_ > x_ > w_), re-run the current conventions audit on its saved manifest and report the | |
| final status with the driver's rule: geometry+visibility passed AND audit passed => accepted.""" | |
| import sys | |
| from pathlib import Path | |
| sys.path.insert(0, str(Path(__file__).resolve().parents[2])) | |
| import rhg_paths | |
| import json, subprocess, sys, glob, os | |
| V = rhg_paths.resolve('${RHG_WORKSPACE_ROOT}/hayfung/validation/') | |
| AUDIT = rhg_paths.resolve('${RHG_WORKSPACE_ROOT}/generic_20261101/src/layout_conventions_audit.py') | |
| PREF = {'z': 3, 'x': 2, 'w': 1} | |
| best = {} | |
| for d in glob.glob(V + '[wxz]_*/'): | |
| p = d + 'results.json' | |
| if not os.path.exists(p): | |
| continue | |
| r = json.load(open(p))[0] | |
| k = PREF[os.path.basename(d.rstrip('/'))[0]] | |
| if r['seed'] not in best or k > best[r['seed']][0]: | |
| best[r['seed']] = (k, d, r) | |
| rows = [] | |
| for seed, (k, d, r) in sorted(best.items(), key=lambda x: int(x[0])): | |
| status, fails, warns = r['status'], None, None | |
| manifest = None | |
| try: | |
| manifest = json.load(open(d + 'run_01/execute.receipt.json')) | |
| except Exception: | |
| pass | |
| res = None | |
| for cand in glob.glob(d + 'run_01/layout_conventions.json'): | |
| res = json.load(open(cand)) | |
| if res is not None: | |
| m = res['manifest']; out = '/tmp/audit_%s.json' % seed | |
| shell = os.path.join(os.path.dirname(m), 'shell_geometry_input.json') | |
| cmd = ['/usr/bin/python3', '-B', AUDIT, '--manifest', m, '--out', out] + (['--shell', shell] if os.path.isfile(shell) else []) | |
| subprocess.run(cmd, stdout=subprocess.DEVNULL) | |
| a = json.load(open(out)); fails, warns = a['fail_count'], a['warn_count'] | |
| if status in ('accepted_with_conventions', 'visibility_passed_conventions_failed'): | |
| status = 'accepted_with_conventions' if a['passed'] else 'visibility_passed_conventions_failed' | |
| rows.append(dict(seed=seed, run=os.path.basename(d.rstrip('/')), status=status, driver_status=r['status'], elapsed_s=r['elapsed_s'], fails=fails, warns=warns, | |
| fail_rules=[f['rule'] for f in a['findings'] if f['severity'] == 'fail'], warn_rules=sorted({f['rule'] for f in a['findings'] if f['severity'] == 'warn'}))) | |
| else: | |
| rows.append(dict(seed=seed, run=os.path.basename(d.rstrip('/')), status=status, driver_status=r['status'], elapsed_s=r['elapsed_s'])) | |
| json.dump(rows, open(V + 'final_table.json', 'w'), indent=1, ensure_ascii=False) | |
| for x in rows: | |
| print(x['seed'], x['run'], x['status'], x['elapsed_s'], x.get('fails'), x.get('warns'), x.get('fail_rules', '')) | |