Download code/scripts/validate_cached_runtime.py from jisue/robottt-pi05-base-comparison: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/jisue/robottt-pi05-base-comparison/resolve/main/code/scripts/validate_cached_runtime.py
- Command line
-
hf download hf://jisue/robottt-pi05-base-comparison/code/scripts/validate_cached_runtime.py
-
curl -L -o validate_cached_runtime.py https://huggingface.co/jisue/robottt-pi05-base-comparison/resolve/main/code/scripts/validate_cached_runtime.py
1.09 kB
| """Recheck optimized training against audited math on the current prefix cache.""" | |
| import json | |
| import pathlib | |
| import sys | |
| import time | |
| import torch | |
| import argparse | |
| ROOT=pathlib.Path(__file__).resolve().parents[1] | |
| LOCAL=ROOT/'.release_local' | |
| sys.path[:0]=[str(ROOT/'src'),str(ROOT.parent/'openpi/src'),str(ROOT.parent/'openpi/packages/openpi-client/src')] | |
| from robottt_pi05.openpi_backend import load_model | |
| from robottt_pi05.profile_common import benchmark | |
| parser=argparse.ArgumentParser();parser.add_argument('--on-demand',action='store_true');args=parser.parse_args() | |
| torch.set_num_threads(4) | |
| model=load_model(source=ROOT.parent/'openpi',checkpoint=LOCAL/'assets/pi05_base_pytorch/model.safetensors',profile='pi05_base_libero_protocol') | |
| proof=LOCAL/'audit/runtime-profile-parity.json' | |
| if proof.exists():proof.rename(proof.with_name(f'runtime-profile-parity-before-cache-validation-{time.time_ns()}.json')) | |
| benchmark(model,root=ROOT,cache=LOCAL/'ondemand-prefix' if args.on_demand else '/tmp/robottt-comparison/prefix-cache',data=LOCAL/'assets/processed-libero',on_demand=args.on_demand) | |