File size: 1,088 Bytes
a61a6da add1d5f a61a6da add1d5f a61a6da add1d5f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | """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)
|