ganesh-review / src /verify_artifacts.py
adminspec's picture
Publish validated ganesh-review safetensors and adapters
9c4b5c1 verified
Raw History Blame Contribute Delete
1.19 kB
"""Verify original release artifacts without importing a model framework."""
import hashlib
from pathlib import Path
HASHES = {
"adapter.safetensors": "39a20fb38e31c307351fc4eb8035c1f50833f687ff9d3da2e0282120a7cbafd9",
"model-config.json": "dfeaa5769ef784456ed522ef6a6ff96ed82b76298b5aedbcebb90d3c5cc5b093",
"inference-config.json": "81f65e76e54cea15e16d3b139c418fecd18ad5f863cd7f9923beb2a85247150c",
"training-public.json": "5f9ec6b362eae7c8fc2d92bec34c050a42aa15e1d14f8c3dfdc15c174cdaf82a",
}
def sha256(path):
digest = hashlib.sha256()
with Path(path).open("rb") as stream:
for chunk in iter(lambda: stream.read(1024 * 1024), b""):
digest.update(chunk)
return digest.hexdigest()
def verify(root=None):
root = Path(root) if root is not None else Path(__file__).parent / "artifacts"
for name, expected in HASHES.items():
path = root / name
if path.is_symlink() or not path.is_file() or sha256(path) != expected:
raise ValueError(f"Artifact identity mismatch: {name}")
return dict(HASHES)
if __name__ == "__main__":
for name, digest in verify().items():
print(f"{digest} {name}")