robottt-pi05-base-comparison / code /scripts /validate_cached_runtime.py
jisue's picture
Experiment backup 2026-11-10T06:11:22.386926+00:00
add1d5f verified
Raw History Blame Contribute Delete
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)