TestRandomization / code /case2 /register_policies.py
harryzhang1018's picture
Add reproduction code and README
0c3dd1d verified
Raw History Blame Contribute Delete
762 Bytes
"""Build policies/registry.json from finished training runs (final 2 M-step checkpoint = ckpt_4.zip)."""
import json
from common import POLICY_DIR, rel_path, sha256
reg = {}
for d in sorted(POLICY_DIR.iterdir()):
meta = d / 'train_meta.json'
if not d.is_dir() or not meta.exists():
continue
m = json.loads(meta.read_text())
ck = d / 'ckpt_4.zip'
reg[d.name] = dict(path=rel_path(ck), origin='campaign', config=m['config'], seed=m['seed'], step=2_000_000,
sha256=sha256(ck), train_wall_s=round(m['wall_s'], 1),
mean_return_last100=m['mean_return_last100'])
(POLICY_DIR / 'registry.json').write_text(json.dumps(reg, indent=1) + '\n')
print(len(reg), 'policies registered:', ', '.join(reg))