"""Copy evaluator code/assets without modifying the reference repositories.""" import argparse import shutil from pathlib import Path from common import WORK, PEER, sha256, write_json def main(): p = argparse.ArgumentParser() p.add_argument('--peer', type=Path, default=PEER) a = p.parse_args() target = WORK / 'vendor' files = [] def copy(source, destination): if source.is_dir(): for item in sorted(source.rglob('*')): if item.is_file() and '__pycache__' not in item.parts and '.cache' not in item.parts: copy(item, destination / item.relative_to(source)) return destination.parent.mkdir(parents=True, exist_ok=True) digest = sha256(source) if not destination.exists() or sha256(destination) != digest: shutil.copy2(source, destination, follow_symlinks=True) if sha256(destination) != digest: raise RuntimeError(f'Copy verification failed: {destination}') files.append(dict(path=str(destination.relative_to(WORK)), source=str(source), bytes=destination.stat().st_size, sha256=digest)) print('VERIFIED', destination.relative_to(WORK), flush=True) for name in ('evaluate.py','metrics.py','tracking_common.py','video_common.py', 'video_metrics.py','video_motion.py','scripts/common.py'): copy(a.peer/'OmniHM_bench'/name, target/'OmniHM_bench'/name) for name in ('src','assets','models/t5-3b-local', 'models/HoloMotion/HoloMotion_v1.2/holomotion_v1.2_motion_tracking_model/exported/model.onnx'): copy(a.peer/'OMG'/name, target/'OMG'/name) copy(a.peer/'omnihm_eval_encoder/runs/finetune_v13_20260920/best.pt', target/'evaluator_v13.pt') for repo in ('OMG', 'OmniHM_bench'): for name in ('LICENSE', 'LICENSE.md', 'NOTICE', 'pyproject.toml'): if (a.peer/repo/name).is_file(): copy(a.peer/repo/name, target/repo/name) write_json(target/'manifest.json', dict(files=files, total_bytes=sum(x['bytes'] for x in files), note='Unmodified reference implementation and local evaluator weights; preserve upstream licenses.')) if __name__ == '__main__': main()