Download code/case2/register_policies.py from harryzhang1018/TestRandomization: direct link, hf CLI and curl.
- Browser
- Download file 762 Bytes
-
https://huggingface.co/datasets/harryzhang1018/TestRandomization/resolve/main/code/case2/register_policies.py
- Command line
-
hf download hf://datasets/harryzhang1018/TestRandomization/code/case2/register_policies.py
-
curl -L -o register_policies.py https://huggingface.co/datasets/harryzhang1018/TestRandomization/resolve/main/code/case2/register_policies.py
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)) | |