The shared core of the omni benchmarks. Measuring a system on documents is always one loop: send each row of a dataset to the system, save its answer, and grade the answers against the gold. A task package (omni-parse-bench, omni-extract-bench, or your own) writes the parts that differ, and this package runs the loop.
from omni_bench_core import benchmark
b = benchmark.Benchmark(SomeTask(), "hf://datasets/<org>/<name>", [SomeScorer()])
b.run(SomeAdapter(mode="accurate"), out="runs", sample=20) # plan, predict, grade
b.grade("mine/") # a folder of your own predictionsWhat you write, from least to most:
| to | write |
|---|---|
| run a benchmark | Benchmark(task, dataset, scorers).run(SomeAdapter(...), out), once per system |
| add a system | an Adapter: a frozen dataclass of its options, and call(input) -> Call (or raise SystemFailed) |
| add a way of grading | a Scorer: a frozen dataclass with headline, the key of its summary runs are compared by; gold(row), score(pred, gold) -> Score (or raise Unscored), score_failure(gold) -> Score and summarize(lines) |
| add a task | a Task: rows(dataset) and input(row), a row type, and its adapters and scorers |
Where to read next:
OVERVIEW.md: the pieces one at a time, with diagrams. Start here if you are new;tests/test_core.py: a whole toy task, with a test of every rule (from a clone:PYTHONPATH=. python tests/test_core.py); and- the class docstrings in
omni_bench_core/: what each method is for, and when you would write it.
Two limits are deliberate:
- a dataset is a folder or an
hf://address, never rows made in code, because a run folder records which dataset its answers are for; and - an adapter calls one row at a time; a model that batches is served, and its adapter calls the server.