Astheral / release_tools /postprocess.py
SEE7's picture
Publish release evaluation and inference tools
2b66baf verified
Raw History Blame Contribute Delete
981 Bytes
"""CPU-only postprocessing of a completed v2 model release."""
import subprocess,sys,json
from pathlib import Path
from huggingface_hub import HfApi,hf_hub_download
ROOT=Path(__file__).resolve().parent
for script in ["evaluate.py","rescore.py","finalize_release.py","inference.py"]:
compile((ROOT/script).read_text(),script,"exec")
subprocess.run([sys.executable,str(ROOT/"rescore.py")],check=True)
metrics=json.loads(Path(hf_hub_download("SEE7/Astheral","evaluation.json",force_download=True)).read_text())
if not metrics["quality_gate_passed"]:
print("CORRECTED_GATE_REQUIRES_REPAIR",json.dumps(metrics["merged_scores"]),flush=True)
raise SystemExit(6)
HfApi().upload_folder(repo_id="SEE7/Astheral",folder_path=ROOT,path_in_repo="release_tools",ignore_patterns=["__pycache__/*"],commit_message="Publish release evaluation and inference tools")
subprocess.run([sys.executable,str(ROOT/"finalize_release.py")],check=True)
print("V2_CORRECTED_RELEASE_READY",flush=True)