Kernels
Safetensors
PyTorch
kernel
governance
lambda
gate
provenance
torch
surrogate
doi:10.5281/zenodo.19944926
Instructions to use SZLHOLDINGS/szl-lambda-gate with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Kernels
How to use SZLHOLDINGS/szl-lambda-gate with Kernels:
# !pip install kernels from kernels import get_kernel kernel = get_kernel("SZLHOLDINGS/szl-lambda-gate") - Notebooks
- Google Colab
- Kaggle
surrogate v1: REAL trained torch MLP Λ-gate-decision surrogate (fidelity 0.967 MEASURED) + config + receipt + scripts + honest card/provenance
e5522a6 verified | #!/usr/bin/env python3 | |
| """Re-verify the torch surrogate: sha256 the shipped model.safetensors against | |
| TRAINING_RECEIPT.json, then deterministically regenerate the seeded dataset via | |
| scripts/forge.py and compare re-measured fidelity to the receipt (tolerance 0.02). | |
| Run from repo root: python scripts/eval.py""" | |
| import hashlib, json, subprocess, sys, tempfile, os, shutil | |
| root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | |
| receipt = json.load(open(f"{root}/TRAINING_RECEIPT.json")) | |
| got = hashlib.sha256(open(f"{root}/model.safetensors", "rb").read()).hexdigest() | |
| want = receipt["model"]["sha256"] | |
| print(f"model.safetensors sha256 {'MATCHES receipt' if got==want else 'MISMATCH — refuse'}: {got[:16]}…") | |
| if got != want: | |
| sys.exit(1) | |
| with tempfile.TemporaryDirectory() as td: | |
| shutil.copy(f"{root}/scripts/forge.py", f"{td}/forge.py") | |
| out = subprocess.run([sys.executable, f"{td}/forge.py"], capture_output=True, text=True, cwd=td) | |
| print(out.stdout[-400:] if out.returncode == 0 else out.stderr[-600:]) | |
| if out.returncode: | |
| sys.exit(1) | |
| re_receipt = json.load(open(f"{td}/TRAINING_RECEIPT.json")) | |
| d = abs(re_receipt["metrics_MEASURED"]["fidelity_vs_kernel_heldout"] | |
| - receipt["metrics_MEASURED"]["fidelity_vs_kernel_heldout"]) | |
| print(f"re-measured fidelity delta vs receipt: {d:.4f} ({'OK ≤0.02' if d<=0.02 else 'FAIL'})") | |
| sys.exit(0 if d <= 0.02 else 1) | |