"""Register a mounted, licensed GVHMR installation without downloads.""" import argparse from pathlib import Path import subprocess from baseball_batting.motion_adapters import GVHMR_REVISION from baseball_batting.storage import atomic_json,sha256_file from tools.prepare_gvhmr_assets import WEIGHTS,link def main(): parser=argparse.ArgumentParser() for name in ('worker-python','gvhmr-repo','gvhmr-checkpoint','hmr2-checkpoint','vitpose-checkpoint','smplx-model','output'): parser.add_argument('--'+name,required=True) args=parser.parse_args();record={key:str(Path(value).resolve()) for key,value in vars(args).items() if key!='output'} if not all(Path(value).exists() for value in record.values()):raise ValueError('Configured GVHMR assets are missing') revision=subprocess.check_output(['git','-C',record['gvhmr_repo'],'rev-parse','HEAD'],text=True).strip() if revision!=GVHMR_REVISION:raise ValueError('GVHMR source differs from the pinned adapter') repo=Path(record['gvhmr_repo']) for key,filename in WEIGHTS.items():link(record[key],repo/'inputs/checkpoints'/filename) link(record['smplx_model'],repo/'inputs/checkpoints/body_models/smplx/SMPLX_NEUTRAL.npz') record.update(source_revision=revision,status='installed_requires_inference', artifact_hashes={key:sha256_file(record[key]) for key in (*WEIGHTS,'smplx_model')}) atomic_json(args.output,record) if __name__=='__main__':main()