Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: gnri
|
| 4 |
+
pipeline_tag: other
|
| 5 |
+
tags:
|
| 6 |
+
- rule-induction
|
| 7 |
+
- neuro-symbolic
|
| 8 |
+
- symmetry
|
| 9 |
+
- ilp
|
| 10 |
+
- interpretability
|
| 11 |
+
- zero-shot
|
| 12 |
+
- pytorch
|
| 13 |
+
---
|
| 14 |
+
|
| 15 |
+
# G-NRI: Symmetry-Restored Neural Rule Induction
|
| 16 |
+
|
| 17 |
+
Reference checkpoints for the G-NRI public release. The repository ships the
|
| 18 |
+
eight `gnri`-condition training seed checkpoints (seeds 42, 43, 44, 45, 46, 47, 48, 49, one
|
| 19 |
+
`checkpoint_last.pt` each), a SHA256 manifest (`manifest_sha256.json`), and
|
| 20 |
+
inference-only weights (`model.safetensors` + `config.json`) loadable with
|
| 21 |
+
`RuleInducer.from_pretrained`.
|
| 22 |
+
|
| 23 |
+
## Usage: inference-only weights
|
| 24 |
+
|
| 25 |
+
```python
|
| 26 |
+
import torch
|
| 27 |
+
from gnri import RuleInducer
|
| 28 |
+
|
| 29 |
+
model = RuleInducer.from_pretrained("phuayj/gnri")
|
| 30 |
+
model.eval()
|
| 31 |
+
```
|
| 32 |
+
|
| 33 |
+
## Usage: full training checkpoints
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
from gnri import load_checkpoint_from_hub
|
| 37 |
+
|
| 38 |
+
# Seeds are stored as s42/... s49/ under checkpoint_last.pt
|
| 39 |
+
model = load_checkpoint_from_hub("phuayj/gnri", filename="s42/checkpoint_last.pt")
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
Or download the file directly:
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
from huggingface_hub import hf_hub_download
|
| 46 |
+
|
| 47 |
+
path = hf_hub_download("phuayj/gnri", "s42/checkpoint_last.pt")
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
The full checkpoints can be passed to the release evaluation entry points, e.g.
|
| 51 |
+
`python evaluate_uci.py --checkpoint <path> --condition eqarch_tta_export --all --data-root data`.
|
| 52 |
+
Evaluation conditions may be layered on top of a checkpoint via
|
| 53 |
+
`load_checkpoint_from_hub(..., eval_condition="eqarch_tta_export")` or
|
| 54 |
+
`RuleInducer.from_pretrained("phuayj/gnri", eval_condition="eqarch_tta_export")`.
|
| 55 |
+
|
| 56 |
+
## Checkpoints
|
| 57 |
+
|
| 58 |
+
Shipped checkpoints are the `gnri` training-condition seeds 42, 43, 44, 45, 46, 47, 48, 49. Verify
|
| 59 |
+
integrity against `manifest_sha256.json`:
|
| 60 |
+
|
| 61 |
+
```python
|
| 62 |
+
import hashlib, json
|
| 63 |
+
from huggingface_hub import hf_hub_download
|
| 64 |
+
|
| 65 |
+
manifest = json.load(open(hf_hub_download("phuayj/gnri", "manifest_sha256.json")))
|
| 66 |
+
for entry in manifest["checkpoints"]:
|
| 67 |
+
digest = hashlib.sha256(open(hf_hub_download("phuayj/gnri", entry["path_in_repo"]), "rb").read()).hexdigest()
|
| 68 |
+
assert digest == entry["sha256"], entry["path_in_repo"]
|
| 69 |
+
```
|