File size: 734 Bytes
37d6dcb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | 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))
|