FACTPROP / load_graph.py
factprop's picture
Name graph release factprop_graph_v1.pkl
7d5cddd verified
Raw History Blame Contribute Delete
690 Bytes
"""Download, verify, and load the trusted original FACTPROP checkpoint."""
import hashlib
import pickle
from huggingface_hub import hf_hub_download
SHA256 = "437a434260edbb019c85575d65b4775cb2461f145e17966ee3acc8e4625ce7c8"
def load_graph():
path = hf_hub_download("factprop/FACTPROP", "factprop_graph_v1.pkl", repo_type="dataset")
with open(path, "rb") as stream:
content = stream.read()
if hashlib.sha256(content).hexdigest() != SHA256:
raise ValueError("Graph checksum mismatch")
return pickle.loads(content)["graph"]
if __name__ == "__main__":
graph = load_graph()
print(type(graph).__name__, graph.number_of_nodes(), graph.number_of_edges())