#!/usr/bin/env python3 """Count real parameters per TRACE-VLA component and compare with the spec v1.1 parameter budget (approximately 246M total; the per-module budget lines are carried over from the v1.0 specification section 4.3, which v1.1 does not revise). Run from the project root on CPU.""" import sys from pathlib import Path import torch sys.path.insert(0, str(Path(__file__).resolve().parent.parent)) from trace_vla.config import TraceConfig from trace_vla.model import TraceVLA def n(mod): return sum(p.numel() for p in mod.parameters()) def main(): torch.manual_seed(0) model = TraceVLA(TraceConfig(), load_anchor=True) rows = [ ("ANCHOR vision", n(model.anchor.tips.vision_encoder), 86.3), ("ANCHOR text", n(model.anchor.tips.text_encoder), 109.6), ("DELTA", n(model.delta), 6.5), ("SYNC", n(model.sync), 8.5), ("NEXUS", n(model.nexus), 25.5), ("FLUX and ECHO", n(model.flux) + n(model.echo), 5.0), ("State, history, PULSE, projections", n(model.heads) + n(model.pulse), 4.5), ] total = n(model) trainable = sum(p.numel() for p in model.parameters() if p.requires_grad) print(f"{'component':38s} {'actual':>14s} {'budget':>10s} {'diff':>10s}") for name, actual, budget in rows: print(f"{name:38s} {actual:14,d} {budget:9.1f}M " f"{actual / 1e6 - budget:+9.2f}M") print(f"{'TOTAL':38s} {total:14,d} {245.9:9.1f}M " f"{total / 1e6 - 245.9:+9.2f}M") print(f"trainable (non-ANCHOR): {trainable:,d} " f"({trainable / 1e6:.2f}M)") print(f"frozen (ANCHOR): {total - trainable:,d}") if __name__ == "__main__": main()