AsianPlayer's picture
download
raw
1.91 kB
"""cwm3/models/budget.py — build every stage variant (seed 0) and print / record parameter counts (plan §3 budget: V 1.5 M,
U 0.2 M, E 0.7 M; frozen: V-JEPA2, YOLO-pose, PCA). --json appends a record to results/budget_<utc>.json.
python models/budget.py [--json]
"""
from __future__ import annotations
import argparse
import json
import sys
import time
from pathlib import Path
CWM3 = Path(__file__).resolve().parents[1]
sys.path.insert(0, str(CWM3))
from models import build_branch, params_by_module # noqa: E402
VARIANTS = {
"V0/can4s": ("V", {}), "V0/can8s": ("V", {}),
"U0/kin_can": ("U", {"cabin": "none"}), "U0/kin_can_vc": ("U", {"cabin": "vc256"}), "U0/kin_can_crop": ("U", {"cabin": "crop256"}),
"E0/pooled": ("E", {"tokens": "pooled", "n_slots": 16}), "E0/tok4s": ("E", {"tokens": "region", "n_slots": 8}),
"E0/tok8s": ("E", {"tokens": "region", "n_slots": 16}), "E0/spat256": ("E", {"tokens": "spat256", "n_slots": 16}),
}
PLAN = {"V": 1.5e6, "U": 0.2e6, "E": 0.7e6}
def main():
ap = argparse.ArgumentParser()
ap.add_argument("--seed", type=int, default=0)
ap.add_argument("--json", action="store_true")
a = ap.parse_args()
rows = {}
for name, (branch, kw) in VARIANTS.items():
m = build_branch(branch, a.seed, **kw)
pb = params_by_module(m)
rows[name] = {"branch": branch, "kwargs": kw, "params": pb}
print(f"{name:16s} total {pb['total']:>9,d} (plan {PLAN[branch] / 1e6:.1f} M -> {pb['total'] / PLAN[branch] - 1:+.0%})")
for k, v in pb.items():
if k != "total":
print(f" {k:10s} {v:>9,d}")
if a.json:
out = CWM3 / "results" / f"budget_{time.strftime('%Y%m%dT%H%M%SZ', time.gmtime())}.json"
out.write_text(json.dumps({"seed": a.seed, "variants": rows, "plan": PLAN}, indent=1))
print(f"written {out}")
if __name__ == "__main__":
main()

Xet Storage Details

Size:
1.91 kB
·
Xet hash:
ff0ef2548b4c33c2890a8b2064f9c19342f22008d0be5810935da32fd3cfc55a

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.