#!/usr/bin/env python3 """TERMS_ST2=check over the whole model (OPT round 4 R4.1): load (the eager warm-ups run every TermsConv as three convs AND as the stacked ST2 conv and compare the halves bit for bit), then print the per-conv report and the ST2_EXCLUDE list (the convs whose stacked form is not bit-identical). METEOR_TERMS_ST2=check bin/devrun -t 2400 -- python -u code/scripts/st2_check.py --json out.json """ from __future__ import annotations import argparse import json import os from tt_meteor import METEOR def main() -> None: ap = argparse.ArgumentParser() ap.add_argument("--json", default="") a = ap.parse_args() if os.environ.get("METEOR_TERMS_ST2") != "check": raise SystemExit("run with METEOR_TERMS_ST2=check") from tt_meteor.tt.layers import st2_report with METEOR.from_pretrained() as model: rep = st2_report() bad = sorted(n for n, recs in rep.items() if not all(r[0] for r in recs)) for n, recs in rep.items(): print(f"{n}: {'IDENTICAL' if all(r[0] for r in recs) else 'DIFFERENT'} " f"{[(r[0], round(r[1], 6), r[2], r[3]) for r in recs]}") print(f"{len(rep)} stacked convs checked, {len(bad)} not bit-identical") print("ST2_EXCLUDE =", tuple(bad)) if a.json: with open(a.json, "w") as f: json.dump({"report": rep, "exclude": bad}, f, indent=1) _ = model if __name__ == "__main__": main()