betterwithage commited on
Commit
52ef368
·
verified ·
1 Parent(s): 1628e62

fix: make receipt evaluation portable

Browse files

Copy the complete repository into the isolated re-forge directory so packaged kernels and doctrine inputs resolve on fresh checkouts. Avoid privileged symlinks and non-ASCII status output on Windows.

Files changed (1) hide show
  1. scripts/eval.py +6 -7
scripts/eval.py CHANGED
@@ -12,15 +12,14 @@ want = receipt["model"]["sha256"]
12
  print(f"model.joblib sha256 {'MATCHES receipt' if got==want else 'MISMATCH — refuse'}: {got[:16]}…")
13
  if got != want: sys.exit(1)
14
  with tempfile.TemporaryDirectory() as td:
15
- os.makedirs(f"{td}/repo/scripts")
16
- os.symlink(f"{root}/build", f"{td}/repo/build")
17
- shutil.copy(f"{root}/scripts/forge.py", f"{td}/repo/scripts/forge.py")
18
- out = subprocess.run([sys.executable, f"{td}/repo/scripts/forge.py"],
19
- capture_output=True, text=True)
20
  print(out.stdout[-500:] if out.returncode == 0 else out.stderr[-500:])
21
  if out.returncode: sys.exit(1)
22
- re_receipt = json.load(open(f"{td}/repo/scripts/TRAINING_RECEIPT.json"))
23
  d = abs(re_receipt["metrics_MEASURED"]["held_out_R2"]
24
  - receipt["metrics_MEASURED"]["held_out_R2"])
25
- print(f"re-measured delta vs receipt: {d:.4f} ({'OK 0.02' if d<=0.02 else 'FAIL'})")
26
  sys.exit(0 if d <= 0.02 else 1)
 
12
  print(f"model.joblib sha256 {'MATCHES receipt' if got==want else 'MISMATCH — refuse'}: {got[:16]}…")
13
  if got != want: sys.exit(1)
14
  with tempfile.TemporaryDirectory() as td:
15
+ copy = f"{td}/repo"
16
+ shutil.copytree(root, copy, ignore=shutil.ignore_patterns(".cache"))
17
+ out = subprocess.run([sys.executable, f"{copy}/scripts/forge.py"],
18
+ capture_output=True, text=True, cwd=copy)
 
19
  print(out.stdout[-500:] if out.returncode == 0 else out.stderr[-500:])
20
  if out.returncode: sys.exit(1)
21
+ re_receipt = json.load(open(f"{copy}/scripts/TRAINING_RECEIPT.json"))
22
  d = abs(re_receipt["metrics_MEASURED"]["held_out_R2"]
23
  - receipt["metrics_MEASURED"]["held_out_R2"])
24
+ print(f"re-measured R2 delta vs receipt: {d:.4f} ({'OK <=0.02' if d<=0.02 else 'FAIL'})")
25
  sys.exit(0 if d <= 0.02 else 1)