Exact reviewed source / 33 of 64
prototype/scripts/verify_model.py
SHA-256 of original bytes
aef1350463bad76a2954c53ade6beaee68214252167328e18be1f6c538cff61d
"""Verify all local model files against the recorded fixed-revision manifest."""
import hashlib,json,pathlib
root=pathlib.Path(__file__).resolve().parents[1]
manifest=json.loads((root/'models/manifest.json').read_text())
assert manifest['repo']=='Xenova/all-MiniLM-L6-v2'
assert manifest['revision']=='751bff37182d3f1213fa05d7196b954e230abad9'
for item in manifest['files']:
data=(root/'models'/manifest['repo']/item['path']).read_bytes()
assert len(data)==item['bytes'],f"Size mismatch: {item['path']}"
assert hashlib.sha256(data).hexdigest()==item['sha256'],f"Hash mismatch: {item['path']}"
print('Verified',len(manifest['files']),'pinned local model artifacts.')