SPB Git

spb/modelmap Public License

Internal cartography of local LLMs on Apple Silicon — registered, gated, negative-first. Public atlas at modelmap.io.

Python 66.3% JavaScript 24.5% CSS 8.1% Shell 0.7%
1.9 KB · 62 lines python
Raw Blame History
1#!/usr/bin/env python32# =============================================================================3#  Project   : modelmap4#  File      : benchmarks/harness.py5#  Purpose   : Benchmark harness skeleton — runs experiments, embeds manifests6#  Author    : Simon-Pierre Boucher7#  Contact   : contact@spboucher.ai8#  Website   : https://modelmap.io9#  Created   : 2026-08-1210#  Modified  : 2026-08-1211#  Platform  : macOS / Apple Silicon (arm64)12#  License   : All rights reserved (research code)13# =============================================================================14"""Experiment harness (skeleton — finalized during Phase 5).1516Contract established by the charter: every result JSON written under17results/<experiment_id>/<UTC timestamp>/ embeds the hardware manifest, the18git commit, the config, and the seed(s) used, so any map is reproducible from19commit + config + model hash + seed + manifest.20"""2122from __future__ import annotations2324import datetime25import json26import subprocess27from pathlib import Path2829from hardware_manifest import manifest3031ROOT = Path(__file__).resolve().parent.parent323334def git_commit() -> str:35    try:36        return subprocess.run(37            ["git", "rev-parse", "HEAD"], cwd=ROOT, capture_output=True, text=True, check=True38        ).stdout.strip()39    except subprocess.CalledProcessError:40        return "unknown"414243def result_dir(experiment_id: str) -> Path:44    ts = datetime.datetime.now(datetime.UTC).strftime("%Y%m%dT%H%M%SZ")45    out = ROOT / "results" / experiment_id / ts46    out.mkdir(parents=True)47    return out484950def write_result(experiment_id: str, payload: dict, config: dict | None = None) -> Path:51    out = result_dir(experiment_id)52    doc = {53        "experiment": experiment_id,54        "commit": git_commit(),55        "config": config or {},56        "manifest": manifest(),57        **payload,58    }59    path = out / "results.json"60    path.write_text(json.dumps(doc, indent=2) + "\n")61    return path62