import hashlib,json,time from pathlib import Path from huggingface_hub import HfApi root=Path('/home/user/models/qwen-image-2.1-b3179ad') info=HfApi().model_info('Qwen/Qwen-Image-2.1',revision='b3179ad355be050328e483a9dfdd9e60cd62adfa',files_metadata=True) rows=[] for f in info.siblings: p=root/f.rfilename assert p.exists(),f.rfilename h=hashlib.sha256() with p.open('rb') as stream: while b:=stream.read(8<<20):h.update(b) digest=h.hexdigest() if f.size is not None:assert p.stat().st_size==f.size if f.lfs:assert digest==f.lfs.sha256,(f.rfilename,digest) rows.append({'file':f.rfilename,'bytes':p.stat().st_size,'sha256':digest,'upstream_lfs_sha256_matched':bool(f.lfs)}) receipt={'model':info.id,'revision':info.sha,'files':rows,'total_bytes':sum(r['bytes'] for r in rows),'verified_at':time.time()} out=Path(__file__).parent/'base_integrity.json';out.write_text(json.dumps(receipt,indent=2)) print('BASE_VERIFIED',len(rows),receipt['total_bytes'])