Download leaf/code/v1.5/v1.4/record_one.py from COCOMatrix/LEAF-Bench: direct link, hf CLI and curl.
- Browser
- Download file 734 Bytes
-
https://huggingface.co/datasets/COCOMatrix/LEAF-Bench/resolve/main/leaf/code/v1.5/v1.4/record_one.py
- Command line
-
hf download hf://datasets/COCOMatrix/LEAF-Bench/leaf/code/v1.5/v1.4/record_one.py
-
curl -L -o record_one.py https://huggingface.co/datasets/COCOMatrix/LEAF-Bench/resolve/main/leaf/code/v1.5/v1.4/record_one.py
734 Bytes
| import json | |
| import os | |
| from pathlib import Path | |
| import subprocess | |
| import sys | |
| J = Path(__file__).resolve().parent | |
| B = J.parent | |
| run = sys.argv[1] | |
| row = next(r for r in json.loads((J/'selected.json').read_text()) if r['path'] == run) | |
| legacy = row['cohort'] == 'legacy' | |
| source = J/('legacy_source' if legacy else 'source') | |
| out = B/('legacy_raw' if legacy else 'raw') | |
| if '--local' in sys.argv: | |
| out = B/(out.name + '_local') | |
| env = dict(os.environ, PYTHONPATH=str(source)+':/mnt/cpfs/workspace/RSS/LIBERO-Recovery/LIBERO') | |
| cmd = ['/mnt/cpfs/workspace/env/libero-cpu/bin/python', str(J/'osmesa_run.py'), | |
| str(source/'scripts/lerobot_replay.py'), 'record', run, '--out', str(out)] | |
| sys.exit(subprocess.call(cmd, env=env, cwd=source)) | |