benchkit-cli 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- benchkit/__init__.py +1 -0
- benchkit/_pi_proxy.py +219 -0
- benchkit/answer_key_guard.ts +49 -0
- benchkit/artifacts.py +87 -0
- benchkit/benchmarks/__init__.py +105 -0
- benchkit/benchmarks/aider_polyglot.py +405 -0
- benchkit/benchmarks/arc.py +52 -0
- benchkit/benchmarks/banking77.py +149 -0
- benchkit/benchmarks/base.py +19 -0
- benchkit/benchmarks/boolq.py +49 -0
- benchkit/benchmarks/chartqa.py +133 -0
- benchkit/benchmarks/code_verifier.py +77 -0
- benchkit/benchmarks/downloads.py +166 -0
- benchkit/benchmarks/evalplus.py +288 -0
- benchkit/benchmarks/git_surgery.py +485 -0
- benchkit/benchmarks/gpqa.py +56 -0
- benchkit/benchmarks/gsm8k.py +97 -0
- benchkit/benchmarks/hellaswag.py +49 -0
- benchkit/benchmarks/humaneval.py +103 -0
- benchkit/benchmarks/ifeval.py +56 -0
- benchkit/benchmarks/ifeval_instructions.py +477 -0
- benchkit/benchmarks/mbpp.py +60 -0
- benchkit/benchmarks/mc_arena.py +479 -0
- benchkit/benchmarks/mcq.py +94 -0
- benchkit/benchmarks/medfailbench.py +537 -0
- benchkit/benchmarks/mmlu.py +54 -0
- benchkit/benchmarks/mmlu_pro.py +62 -0
- benchkit/benchmarks/mmvp.py +115 -0
- benchkit/benchmarks/ocrbench.py +96 -0
- benchkit/benchmarks/openbookqa.py +52 -0
- benchkit/benchmarks/patcheval.py +929 -0
- benchkit/benchmarks/piqa.py +52 -0
- benchkit/benchmarks/ruler.py +172 -0
- benchkit/benchmarks/ruler_generator.py +535 -0
- benchkit/benchmarks/sanity.py +174 -0
- benchkit/benchmarks/treejs_arena.py +268 -0
- benchkit/benchmarks/truthfulqa.py +52 -0
- benchkit/benchmarks/utils.py +25 -0
- benchkit/benchmarks/vision.py +230 -0
- benchkit/benchmarks/vstar.py +108 -0
- benchkit/benchmarks/winogrande.py +52 -0
- benchkit/benchmarks/xstest.py +116 -0
- benchkit/browser.py +429 -0
- benchkit/catalog.py +121 -0
- benchkit/cli.py +1000 -0
- benchkit/client.py +1413 -0
- benchkit/controls.py +87 -0
- benchkit/datasets/MMLU_LICENSE.txt +21 -0
- benchkit/datasets/README.md +142 -0
- benchkit/datasets/arc_challenge.jsonl +1172 -0
- benchkit/datasets/banking77.jsonl +3080 -0
- benchkit/datasets/banking77_intents.json +79 -0
- benchkit/datasets/boolq.jsonl +3270 -0
- benchkit/datasets/code_verifier.jsonl +500 -0
- benchkit/datasets/gpqa_diamond.jsonl +198 -0
- benchkit/datasets/gsm8k.jsonl +1319 -0
- benchkit/datasets/hellaswag.jsonl +1000 -0
- benchkit/datasets/humaneval.jsonl +164 -0
- benchkit/datasets/ifeval.jsonl +541 -0
- benchkit/datasets/mbpp.jsonl +500 -0
- benchkit/datasets/mc_blocks_1_20_1.jsonl +1003 -0
- benchkit/datasets/medfailbench_hard30.jsonl +30 -0
- benchkit/datasets/medfailbench_hard30.md +13 -0
- benchkit/datasets/openbookqa.jsonl +500 -0
- benchkit/datasets/piqa.jsonl +1838 -0
- benchkit/datasets/sanity_code.jsonl +6 -0
- benchkit/datasets/truthfulqa.jsonl +817 -0
- benchkit/datasets/winogrande.jsonl +1267 -0
- benchkit/datasets/xstest.csv +451 -0
- benchkit/decision.py +194 -0
- benchkit/demo.py +451 -0
- benchkit/dockerfiles.py +247 -0
- benchkit/engine.py +1270 -0
- benchkit/evaluation.py +195 -0
- benchkit/events.py +141 -0
- benchkit/executor.py +96 -0
- benchkit/git_surgery/backport-release-stack/setup.sh +328 -0
- benchkit/git_surgery/backport-release-stack/verify.sh +119 -0
- benchkit/git_surgery/bisect-the-regression/setup.sh +49 -0
- benchkit/git_surgery/bisect-the-regression/verify.sh +34 -0
- benchkit/git_surgery/rebase-conflict-chain/setup.sh +65 -0
- benchkit/git_surgery/rebase-conflict-chain/verify.sh +43 -0
- benchkit/git_surgery/recover-complex-stash/setup.sh +152 -0
- benchkit/git_surgery/recover-complex-stash/verify.sh +95 -0
- benchkit/git_surgery/recover-lost-work/setup.sh +40 -0
- benchkit/git_surgery/recover-lost-work/verify.sh +36 -0
- benchkit/git_surgery/repair-force-pushed-remote/setup.sh +171 -0
- benchkit/git_surgery/repair-force-pushed-remote/verify.sh +83 -0
- benchkit/git_surgery/revert-merge-with-followups/setup.sh +198 -0
- benchkit/git_surgery/revert-merge-with-followups/verify.sh +98 -0
- benchkit/git_surgery/secret-in-history/README.md +27 -0
- benchkit/git_surgery/secret-in-history/setup.sh +107 -0
- benchkit/git_surgery/secret-in-history/verify.sh +106 -0
- benchkit/git_surgery/split-the-mega-commit/setup.sh +50 -0
- benchkit/git_surgery/split-the-mega-commit/verify.sh +48 -0
- benchkit/git_surgery/untangle-nested-submodules/setup.sh +193 -0
- benchkit/git_surgery/untangle-nested-submodules/verify.sh +90 -0
- benchkit/history.py +474 -0
- benchkit/jobs.py +332 -0
- benchkit/leakage.py +51 -0
- benchkit/looping.py +873 -0
- benchkit/mc_render.py +274 -0
- benchkit/mc_viewer/dist/atlas.png +0 -0
- benchkit/mc_viewer/dist/blockStates.json.gz +0 -0
- benchkit/mc_viewer/dist/version.json +4 -0
- benchkit/mc_viewer/dist/viewer.html +23 -0
- benchkit/mc_viewer/dist/viewer.js +2 -0
- benchkit/mc_viewer/dist/viewer.js.LICENSE.txt +25 -0
- benchkit/mc_viewer/dist/worker.js +2 -0
- benchkit/mc_viewer/dist/worker.js.LICENSE.txt +19 -0
- benchkit/metrics.py +100 -0
- benchkit/ollama.py +60 -0
- benchkit/perf.py +353 -0
- benchkit/perf_report.py +207 -0
- benchkit/perturbations.py +208 -0
- benchkit/pi_agent.py +476 -0
- benchkit/pi_package/package-lock.json +1827 -0
- benchkit/pi_package/package.json +8 -0
- benchkit/report.py +142 -0
- benchkit/report_markdown.py +645 -0
- benchkit/results.py +688 -0
- benchkit/retry.py +163 -0
- benchkit/runner.py +769 -0
- benchkit/sandbox.py +1167 -0
- benchkit/template_check.py +291 -0
- benchkit/templates/arena.html +504 -0
- benchkit/templates/history.html +58 -0
- benchkit/templates/perf.html +509 -0
- benchkit/templates/report.html +769 -0
- benchkit/tui/__init__.py +5 -0
- benchkit/tui/app.py +87 -0
- benchkit/tui/app.tcss +512 -0
- benchkit/tui/formatting.py +84 -0
- benchkit/tui/screens/__init__.py +1 -0
- benchkit/tui/screens/connect.py +191 -0
- benchkit/tui/screens/detail.py +288 -0
- benchkit/tui/screens/help.py +84 -0
- benchkit/tui/screens/modals.py +544 -0
- benchkit/tui/screens/results.py +361 -0
- benchkit/tui/screens/run.py +988 -0
- benchkit/tui/screens/setup.py +733 -0
- benchkit/tui/theme.py +135 -0
- benchkit/tui/widgets.py +120 -0
- benchkit_cli-0.1.0.dist-info/METADATA +294 -0
- benchkit_cli-0.1.0.dist-info/RECORD +149 -0
- benchkit_cli-0.1.0.dist-info/WHEEL +5 -0
- benchkit_cli-0.1.0.dist-info/entry_points.txt +3 -0
- benchkit_cli-0.1.0.dist-info/licenses/LICENSE +201 -0
- benchkit_cli-0.1.0.dist-info/top_level.txt +1 -0
benchkit/report.py
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"""Save benchmark results to disk."""
|
|
2
|
+
|
|
3
|
+
import csv
|
|
4
|
+
import json
|
|
5
|
+
import os
|
|
6
|
+
from datetime import datetime
|
|
7
|
+
from importlib.resources import files
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from benchkit import artifacts
|
|
11
|
+
from benchkit.report_markdown import render_markdown
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _safe_json(data: object) -> str:
|
|
15
|
+
"""Serialize data for an HTML script element without allowing tag breakout."""
|
|
16
|
+
return (
|
|
17
|
+
json.dumps(data, ensure_ascii=False)
|
|
18
|
+
.replace("&", "\\u0026")
|
|
19
|
+
.replace("<", "\\u003c")
|
|
20
|
+
.replace(">", "\\u003e")
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def render_html(
|
|
25
|
+
results: list[dict],
|
|
26
|
+
generated_at: str,
|
|
27
|
+
provider: str = "",
|
|
28
|
+
host: str = "",
|
|
29
|
+
hardware: str = "",
|
|
30
|
+
) -> str:
|
|
31
|
+
"""Render the packaged HTML template with embedded report data."""
|
|
32
|
+
payload = _safe_json(
|
|
33
|
+
{
|
|
34
|
+
"generated_at": generated_at,
|
|
35
|
+
"provider": provider,
|
|
36
|
+
"host": host,
|
|
37
|
+
"hardware": hardware,
|
|
38
|
+
"results": results,
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
template = (
|
|
42
|
+
files("benchkit").joinpath("templates/report.html").read_text(encoding="utf-8")
|
|
43
|
+
)
|
|
44
|
+
return template.replace("__BENCHKIT_REPORT_DATA__", payload)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def arena_results(results: list[dict]) -> list[dict]:
|
|
48
|
+
"""Result rows scored by rendering, whether or not a page ever loaded.
|
|
49
|
+
|
|
50
|
+
Selection is by suite, not by outcome: a run whose tasks all timed out
|
|
51
|
+
still gets a gallery, and it still shows those tasks.
|
|
52
|
+
"""
|
|
53
|
+
return [
|
|
54
|
+
result
|
|
55
|
+
for result in results
|
|
56
|
+
if result.get("scoring") in {"render-only", "build-metrics"}
|
|
57
|
+
or any(
|
|
58
|
+
isinstance(task.get("workspace"), dict)
|
|
59
|
+
and (
|
|
60
|
+
task["workspace"].get("render_status")
|
|
61
|
+
or task["workspace"].get("build_status")
|
|
62
|
+
)
|
|
63
|
+
for task in result.get("tasks") or []
|
|
64
|
+
)
|
|
65
|
+
]
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def render_arena_html(
|
|
69
|
+
results: list[dict],
|
|
70
|
+
generated_at: str,
|
|
71
|
+
provider: str = "",
|
|
72
|
+
host: str = "",
|
|
73
|
+
hardware: str = "",
|
|
74
|
+
) -> str:
|
|
75
|
+
"""Render the screenshot gallery for the render-scored suites.
|
|
76
|
+
|
|
77
|
+
The gallery lives beside the screenshots and generated pages it links to,
|
|
78
|
+
so a preview opens the model's own page in a new tab instead of a picture
|
|
79
|
+
of it.
|
|
80
|
+
"""
|
|
81
|
+
payload = _safe_json(
|
|
82
|
+
{
|
|
83
|
+
"generated_at": generated_at,
|
|
84
|
+
"provider": provider,
|
|
85
|
+
"host": host,
|
|
86
|
+
"hardware": hardware,
|
|
87
|
+
"results": results,
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
template = (
|
|
91
|
+
files("benchkit").joinpath("templates/arena.html").read_text(encoding="utf-8")
|
|
92
|
+
)
|
|
93
|
+
return template.replace("__BENCHKIT_ARENA_DATA__", payload)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def save(
|
|
97
|
+
results: list[dict],
|
|
98
|
+
provider: str = "",
|
|
99
|
+
host: str = "",
|
|
100
|
+
hardware: str | None = None,
|
|
101
|
+
) -> Path:
|
|
102
|
+
ts = datetime.now().strftime("%Y-%m-%d_%H-%M-%S")
|
|
103
|
+
out = Path("results") / ts
|
|
104
|
+
out.mkdir(parents=True, exist_ok=True)
|
|
105
|
+
hardware = (
|
|
106
|
+
hardware if hardware is not None else os.environ.get("BENCHKIT_HARDWARE", "")
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
# Screenshots and generated pages staged during the run move in here first,
|
|
110
|
+
# so every path written below is relative to the report directory.
|
|
111
|
+
artifacts.collect(out, results)
|
|
112
|
+
|
|
113
|
+
# Full JSON (includes per-task details)
|
|
114
|
+
with open(out / "results.json", "w") as f:
|
|
115
|
+
json.dump(results, f, indent=2)
|
|
116
|
+
|
|
117
|
+
# Summary CSV (one row per model×benchmark, no tasks column)
|
|
118
|
+
summary = [{k: v for k, v in r.items() if k != "tasks"} for r in results]
|
|
119
|
+
if summary:
|
|
120
|
+
with open(out / "results.csv", "w", newline="") as f:
|
|
121
|
+
fieldnames = list(
|
|
122
|
+
dict.fromkeys(key for result in summary for key in result)
|
|
123
|
+
)
|
|
124
|
+
writer = csv.DictWriter(f, fieldnames=fieldnames)
|
|
125
|
+
writer.writeheader()
|
|
126
|
+
writer.writerows(summary)
|
|
127
|
+
|
|
128
|
+
# Markdown table and task-level details.
|
|
129
|
+
with open(out / "results.md", "w") as f:
|
|
130
|
+
f.write(render_markdown(results, ts))
|
|
131
|
+
|
|
132
|
+
with open(out / "results.html", "w") as f:
|
|
133
|
+
f.write(render_html(results, ts, provider, host, hardware))
|
|
134
|
+
|
|
135
|
+
# Rendered suites get their own gallery: big previews that open the
|
|
136
|
+
# generated page itself, next to the pass rate.
|
|
137
|
+
if gallery := arena_results(results):
|
|
138
|
+
with open(out / "arena.html", "w") as f:
|
|
139
|
+
f.write(render_arena_html(gallery, ts, provider, host, hardware))
|
|
140
|
+
|
|
141
|
+
artifacts.cleanup()
|
|
142
|
+
return out
|