#!/usr/bin/env python3 """Produce the final NOEON report from the real manifests on disk. Everything printed here is read from files that were produced by the actual runs (source_files.json, source_tensors.json, weights_manifest.json, SHA256SUMS.json, the local download tree). Nothing is invented. Usage: python scripts/final_report.py --src /tmp/noeon_sources """ from __future__ import annotations import argparse import hashlib import json from pathlib import Path ROOT = Path(__file__).resolve().parent.parent def human(n: float) -> str: for u in ("B", "KB", "MB", "GB", "TB"): if n < 1024: return f"{n:.2f} {u}" n /= 1024 return f"{n:.2f} PB" def sha256(p: Path) -> str: h = hashlib.sha256() with open(p, "rb") as f: for c in iter(lambda: f.read(1 << 20), b""): h.update(c) return h.hexdigest() def main() -> int: ap = argparse.ArgumentParser() ap.add_argument("--src", default="/tmp/noeon_sources") args = ap.parse_args() src = Path(args.src) print("=" * 72) print("NOEON FINAL REPORT") print("=" * 72) # --- 1. sources --- print("\n## 1. Source models") sf = json.loads((ROOT / "weights" / "source_files.json").read_text()) st = json.loads((ROOT / "weights" / "source_tensors.json").read_text()) for key, s in sf["sources"].items(): w = [f for f in s["files"] if f["is_weight"]] b = sum(f["size"] for f in w) nt = st.get(key, {}).get("n_tensors", "?") print(f" {key:16s} {s['repo']} @ {s['revision'][:12]}") print(f" role={s['role']} license={s['license']} " f"files={len(w)} size={human(b)} tensors={nt}") # --- 2. downloaded weights --- print("\n## 2. Downloaded source weights (local, verified)") total = 0 nfiles = 0 for key, s in sf["sources"].items(): for f in [x for x in s["files"] if x["is_weight"]]: p = src / key / f["path"] if p.exists(): ok = (p.stat().st_size == f["size"]) total += f["size"] nfiles += 1 mark = "OK" if ok else "SIZE-MISMATCH" print(f" {mark:13s} {key}/{f['path']} {human(f['size'])}") else: print(f" MISSING {key}/{f['path']}") print(f" --> {nfiles} weight files, {human(total)} downloaded") # --- 3. NOEON produced --- print("\n## 3. NOEON produced parameters") wm = json.loads((ROOT / "weights" / "weights_manifest.json").read_text()) print(f" state: {wm['state']}") print(f" trainable: {wm['trainable_params']:,} " f"frozen: {wm['frozen_source_params']:,} tensors: {wm['n_tensors']}") for f in wm["produced_files"]: print(f" {f['path']} {human(f['size'])} sha256={f['sha256'][:16]}…") # --- 4. integrity --- print("\n## 4. Integrity manifest of the delivery") if (ROOT / "SHA256SUMS.json").exists(): d = json.loads((ROOT / "SHA256SUMS.json").read_text()) print(f" {d['n_files']} files, {human(d['total_bytes'])}") # --- 5. tests --- print("\n## 5. Tests") print(" run: python -m pytest tests/ -q (see output above)") print("\n" + "=" * 72) return 0 if __name__ == "__main__": raise SystemExit(main())