Seal Phase4AE same-precision GPU numerical gate and audit limits
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import hashlib
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
MODEL=Path(__file__).resolve().parent
|
||||
ROOT=Path('/data/digital-drosophila')
|
||||
EXP=ROOT/'experiments/phase4ae-author-runtime'
|
||||
AD=ROOT/'experiments/phase4ad-author-semantics'
|
||||
CFG=json.loads((MODEL/'config.json').read_text())
|
||||
|
||||
def digest(path):
|
||||
h=hashlib.sha256()
|
||||
with Path(path).open('rb') as f:
|
||||
for b in iter(lambda:f.read(8<<20),b''):h.update(b)
|
||||
return h.hexdigest()
|
||||
|
||||
def save(path,value):
|
||||
path=Path(path);path.parent.mkdir(parents=True,exist_ok=True)
|
||||
with path.open('x',encoding='utf-8') as f:json.dump(value,f,indent=2,ensure_ascii=False,allow_nan=False);f.write('\n')
|
||||
|
||||
def sources():
|
||||
return {p.name:digest(p) for p in sorted(MODEL.iterdir()) if p.is_file() and p.name not in ('manifest.json','checksums.sha256')}
|
||||
|
||||
def check():
|
||||
p=json.loads((EXP/'protocol/preregistered.json').read_text())
|
||||
assert sources()==p['sources'],'Source changed after preregistration'
|
||||
for row in p['inputs']:assert digest(ROOT/row['path'])==row['sha256'],row['path']
|
||||
for row in json.loads((EXP/'protocol/case-hashes.json').read_text()):assert digest(EXP/row['path'])==row['sha256'],row['path']
|
||||
return p
|
||||
|
||||
def integrity():
|
||||
import sys
|
||||
sys.path.insert(0,str(ROOT/'models/male-cns-lif/lif-semantics-audit-v1'))
|
||||
import audit_semantics as old
|
||||
r=old.integrity()
|
||||
for rel in ('models/male-cns-lif/lif-semantics-audit-v1','experiments/phase4ac-lif-semantics',
|
||||
'registry/feedback-context-review-20260930','models/male-cns-lif/author-semantics-lab-v1','experiments/phase4ad-author-semantics'):
|
||||
r[rel]=old.manifest_check(ROOT/rel,digest)
|
||||
assert all(x['pass'] for x in r.values())
|
||||
return r
|
||||
Reference in New Issue
Block a user