File size: 690 Bytes
d79d0d5
 
 
 
 
 
 
 
7d5cddd
d79d0d5
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
"""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())