LEAF-Bench / leaf /code /v1.5 /v1.4 /record_one.py
PeterXie666's picture
Add files using upload-large-folder tool
37d6dcb verified
Raw History Blame Contribute Delete
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))