Download scripts/evaluate.py from luyingxi35/RoboFAPE: direct link, hf CLI and curl.
- Browser
- Download file 2.59 kB
-
https://huggingface.co/datasets/luyingxi35/RoboFAPE/resolve/main/scripts/evaluate.py
- Command line
-
hf download hf://datasets/luyingxi35/RoboFAPE/scripts/evaluate.py
-
curl -L -o evaluate.py https://huggingface.co/datasets/luyingxi35/RoboFAPE/resolve/main/scripts/evaluate.py
2.59 kB
| """Run frozen IND/OOD evaluation against the release's exact NPZ cache.""" | |
| import argparse,os,shlex,subprocess,sys | |
| from pathlib import Path | |
| def main(): | |
| p=argparse.ArgumentParser() | |
| p.add_argument('--root',type=Path,default=Path(__file__).resolve().parents[1]) | |
| p.add_argument('--robometer-repo',type=Path,required=True) | |
| p.add_argument('--split',choices=['test_ind','test_ood'],required=True) | |
| p.add_argument('--checkpoint-root',type=Path,required=True) | |
| p.add_argument('--base-model',required=True,help='Step-0 Robometer checkpoint; not the Qwen backbone alone') | |
| p.add_argument('--output',type=Path,required=True) | |
| p.add_argument('--steps',type=int,nargs='+',default=[0,100,200,300,400,500]) | |
| p.add_argument('--batch-size',type=int,default=4) | |
| p.add_argument('--setting',default='A') | |
| p.add_argument('--worker',default='worker0') | |
| p.add_argument('--filtering-only',action='store_true') | |
| p.add_argument('--dry-run',action='store_true') | |
| a=p.parse_args();root=a.root.resolve();repo=a.robometer_repo.resolve() | |
| output=a.output.resolve() | |
| if output.is_relative_to(root) or root.is_relative_to(output): | |
| p.error('--output must be separate from the release directory') | |
| if a.batch_size < 1 or any(step < 0 for step in a.steps): | |
| p.error('Batch size must be positive and checkpoint steps must be nonnegative') | |
| assert (repo/'robometer').is_dir(),'Pass the Robometer repository' | |
| ood=a.split=='test_ood';name='setting_4_ood_test' if ood else 'setting_12_ind_test' | |
| script=root/'scripts/frozen'/('sweep_ood_twelve_progress_resume.py' if ood else 'sweep_setting_a_twelve_progress_resume.py') | |
| assert (root/'repro/processed'/name/'processed_dataset').is_dir() | |
| cmd=[sys.executable,str(script),'--processed-dataset',str(root/'repro/processed'/name/'processed_dataset'), | |
| '--checkpoint-root',str(a.checkpoint_root.resolve()),'--base-model',a.base_model, | |
| '--output-dir',str(a.output.resolve()),'--batch-size',str(a.batch_size),'--per-class','50', | |
| '--steps',*[str(s) for s in a.steps],'--setting',a.setting,'--worker',a.worker] | |
| if ood:cmd+=['--pearson-threshold','-0.2','--task-ids','PokeCubeWristCam-v1_OOD','PushCube-cup_OOD','PutEggplantInBasketScene-v1_OOD','StackCube-orangebowl_OOD'] | |
| if a.filtering_only:cmd+=['--filtering-only'] | |
| env=dict(os.environ,ROBOMETER_PROCESSED_DATASETS_PATH=str(root/'repro/processed'),PYTHONPATH=str(repo)) | |
| print(shlex.join(cmd),flush=True) | |
| if not a.dry_run:subprocess.run(cmd,cwd=repo,env=env,check=True) | |
| if __name__=='__main__':main() | |