gnri / README.md
phuayj's picture
Upload README.md with huggingface_hub
44cc95c verified
|
Raw History Blame Contribute Delete
2.04 kB
---
license: mit
library_name: gnri
pipeline_tag: other
tags:
- rule-induction
- neuro-symbolic
- symmetry
- ilp
- interpretability
- zero-shot
- pytorch
---
# G-NRI: Symmetry-Restored Neural Rule Induction
Reference checkpoints for the G-NRI public release. The repository ships the
eight `gnri`-condition training seed checkpoints (seeds 42, 43, 44, 45, 46, 47, 48, 49, one
`checkpoint_last.pt` each), a SHA256 manifest (`manifest_sha256.json`), and
inference-only weights (`model.safetensors` + `config.json`) loadable with
`RuleInducer.from_pretrained`.
## Usage: inference-only weights
```python
import torch
from gnri import RuleInducer
model = RuleInducer.from_pretrained("phuayj/gnri")
model.eval()
```
## Usage: full training checkpoints
```python
from gnri import load_checkpoint_from_hub
# Seeds are stored as s42/... s49/ under checkpoint_last.pt
model = load_checkpoint_from_hub("phuayj/gnri", filename="s42/checkpoint_last.pt")
```
Or download the file directly:
```python
from huggingface_hub import hf_hub_download
path = hf_hub_download("phuayj/gnri", "s42/checkpoint_last.pt")
```
The full checkpoints can be passed to the release evaluation entry points, e.g.
`python evaluate_uci.py --checkpoint <path> --condition eqarch_tta_export --all --data-root data`.
Evaluation conditions may be layered on top of a checkpoint via
`load_checkpoint_from_hub(..., eval_condition="eqarch_tta_export")` or
`RuleInducer.from_pretrained("phuayj/gnri", eval_condition="eqarch_tta_export")`.
## Checkpoints
Shipped checkpoints are the `gnri` training-condition seeds 42, 43, 44, 45, 46, 47, 48, 49. Verify
integrity against `manifest_sha256.json`:
```python
import hashlib, json
from huggingface_hub import hf_hub_download
manifest = json.load(open(hf_hub_download("phuayj/gnri", "manifest_sha256.json")))
for entry in manifest["checkpoints"]:
digest = hashlib.sha256(open(hf_hub_download("phuayj/gnri", entry["path_in_repo"]), "rb").read()).hexdigest()
assert digest == entry["sha256"], entry["path_in_repo"]
```