Download scripts/evaluate_demo.py from bastasie/LAMM: direct link, hf CLI and curl.
- Browser
- Download file 781 Bytes
-
https://huggingface.co/spaces/bastasie/LAMM/resolve/main/scripts/evaluate_demo.py
- Command line
-
hf download hf://spaces/bastasie/LAMM/scripts/evaluate_demo.py
-
curl -L -o evaluate_demo.py https://huggingface.co/spaces/bastasie/LAMM/resolve/main/scripts/evaluate_demo.py
781 Bytes
| import json | |
| from lamm.verify import ProofAuditor | |
| from lamm.metrics import summarize | |
| tests = [ | |
| ("algebra_correct", ["STEP 1: 2*x + 3 = 7", "STEP 2: 2*x = 4", "STEP 3: x = 2"], "2"), | |
| ("algebra_wrong", ["STEP 1: 2*x + 3 = 7", "STEP 2: 2*x = 5", "STEP 3: x = 2.5"], "2"), | |
| ("derivative_correct", ["STEP 1: f(x)=x^2", "STEP 2: f'(x)=2*x"], "2*x"), | |
| ("derivative_wrong", ["STEP 1: f(x)=x^2", "STEP 2: f'(x)=x^3"], "2*x"), | |
| ("integral", ["STEP 1: integral x^2 dx = x^3/3 + C"], "x^3/3 + C"), | |
| ] | |
| auditor = ProofAuditor() | |
| rows=[] | |
| for name, steps, target in tests: | |
| a = auditor.audit(steps,target) | |
| rows.append((name,a)) | |
| print(name, a.label, a.score, "ACS=",a.acs_consequence,"terminal=",a.terminal_ok) | |
| print(json.dumps(summarize([a for _,a in rows]), indent=2)) | |