From 5deec138c85572e4c6ab6a4b56c77269a3f40450 Mon Sep 17 00:00:00 2001 From: Ronald Tse Date: Sun, 30 Aug 2026 14:46:13 +0200 Subject: [PATCH] =?UTF-8?q?chore:=20zip=5Fmeta=20probe=20=E2=80=94=20read?= =?UTF-8?q?=20a=20volume=20zip's=20metadata=20without=20GB-scale=20downloa?= =?UTF-8?q?ds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gpu/modal_export.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/gpu/modal_export.py b/src/gpu/modal_export.py index 513931e..988a686 100644 --- a/src/gpu/modal_export.py +++ b/src/gpu/modal_export.py @@ -510,3 +510,33 @@ def rebuild_int8_head32(model_id: str, limit: int = 0) -> dict: def rebuild_int8(model: str, limit: int = 0) -> None: print(rebuild_int8_head32.remote(model, limit)) + + +@app.function( + cpu=1, + memory=1024, + timeout=600, + volumes={"/outputs": MODELS_VOLUME}, +) +def zip_meta(model_id: str, precision: str) -> dict: + """Read metadata.yaml out of a zip on the volume — one-shot provenance + check (parity block, precision) without multi-GB downloads.""" + import sys + import zipfile + + import yaml + + sys.path.insert(0, "/root/interscript-ml/src") + out_dir = Path("/outputs/imf") / model_id + meta_path = Path("/root/interscript-ml", MODELS[model_id]["metadata"]) + mid = re.search(r"^id:\s*(\S+)", meta_path.read_text(encoding="utf-8"), re.M).group(1) + with zipfile.ZipFile(out_dir / f"{mid}-{precision}.zip") as zf: + m = yaml.safe_load(zf.read("metadata.yaml")) + return {"id": m["id"], "precision": m.get("precision"), + "parity": m.get("parity"), "sha_members": len(m.get("sha256", {}))} + + +@app.local_entrypoint() +def zmeta(model: str, precisions: str = "fp32,fp16,int8") -> None: + for precision in precisions.split(","): + print(precision, zip_meta.remote(model, precision))