Spaces:
Sleeping

File size: 1,428 Bytes
73bd12f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Compare existing pinned CPU/MPS probe outputs without additional inference."""

import json
from pathlib import Path

cpu = [json.loads(line) for line in Path("reports/local-probes.jsonl").read_text().splitlines()]
mps = [json.loads(line) for line in Path("reports/mps-cli-probes.jsonl").read_text().splitlines()]
agreements = heads = 0
max_delta = 0.0
for a, b in zip(cpu, mps):
    assert (a["fixture_id"], a["schema_hash"], a["input_hash"], a["revision"]) == (
        b["fixture_id"],
        b["schema_hash"],
        b["input_hash"],
        b["revision"],
    )
    assert not a["error"] and not b["error"]
    for name, head in a["heads"].items():
        heads += 1
        agreements += head["selected_label"] == b["heads"][name]["selected_label"]
        max_delta = max(
            max_delta,
            max(
                abs(p - b["heads"][name]["probabilities"][label])
                for label, p in head["probabilities"].items()
            ),
        )
result = {
    "fixture_count": len(cpu),
    "head_comparisons": heads,
    "label_agreements": agreements,
    "max_absolute_probability_difference": max_delta,
    "timing_conclusion": "not estimated here; fresh-shape compile costs and background CPU run make these provisional timings unsuitable for a warm-speed claim",
}
Path("reports/mps-probe-parity.json").write_text(json.dumps(result, indent=2) + "\n")
print(json.dumps(result, indent=2))