Direct fix/workaround:
There is no public API for SHA256 lookup on Hugging Face as of now.
As a workaround, build a local SHA256-to-path index for your model directory:
import hashlib
import os
def sha256sum(filename):
h = hashlib.sha256()
with open(filename, “rb”) as f:
for chunk in iter(lambda: f.read(8192), b""):
h.update(chunk)
return h.hexdigest()
lookup = {}
for root, dirs, files in os.walk(“/path/to/models”):
for file in files:
path = os.path.join(root, file)
lookup[sha256sum(path)] = path
Usage:
query = “d99e39955c9d3d0350d8fb7c75e40c64a2b2eaeb003883d7c941fd2e8747b28c”
print(lookup.get(query, “Not found”))
Solution provided by Triskel Data Deterministic AI.