strict-score-record / loader.py
STRICT-APT's picture
strict_score_record_v3
fd13782
Raw History Blame Contribute Delete
598 Bytes
"""Minimal reader for one score file of the STRICT record (a PIDSMaker evaluation output written by torch.save,
despite its .pkl name). Needs PyTorch; weights_only=False because the file holds Python objects, so load only files whose
hash matches a manifest."""
import sys, torch
d = torch.load(sys.argv[1], map_location="cpu", weights_only=False)
print({k: (getattr(v, "shape", None) or (len(v) if hasattr(v, "__len__") else v)) for k, v in d.items()})
# keys: pred_scores (per node), y_preds (alert at the native threshold), y_truth (label), nodes (node ids), node2attacks (node -> campaign ids)