"""Rapport de paramètres (analytique, vérifié par instanciation sur le device 'meta').""" import sys from pathlib import Path sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import torch # noqa: E402 from mouh.model import PRESETS, MouhForCausalLM, estimate_params, preset_config # noqa: E402 def main() -> None: print(f"{'preset':18} {'total':>10} {'actifs/token':>14} {'experts':>10} {'non-experts':>12} {'vérifié':>8}") for name in PRESETS: cfg = preset_config(name) r = estimate_params(cfg) with torch.device("meta"): real = sum(p.numel() for p in MouhForCausalLM(cfg).parameters()) print(f"{name:18} {r.total / 1e6:9.1f}M {r.active / 1e6:13.1f}M {r.expert / 1e6:9.1f}M " f"{r.non_expert / 1e6:11.1f}M {'oui' if real == r.total else 'NON':>8}") if __name__ == "__main__": main()