Card: usage for omni-parse-bench 1.0.0

#5
Files changed (1) hide show
  1. README.md +6 -130
README.md CHANGED
@@ -40,8 +40,7 @@ is built to answer the question you actually have: which parser is best on docum
40
  It has 16,288 tests on 2,937 pages from 2,343 documents over 22 suites, in
41
  92 languages. Omni Parse Bench is developed by Datalab.
42
 
43
- Read more in our [blog post](https://www.datalab.to/blog/omni-parse-bench). Also see the [GitHub](https://github.com/datalab-to/omni_parse_bench) for the scorer and the harness that
44
- runs parsers on the benchmark.
45
 
46
  ## The design
47
 
@@ -190,138 +189,15 @@ An arg is `{"text", "max_diffs"}`, `{"number"}` or `{"latex"}`, and its kind say
190
  compared: text within `max_diffs` edits, a number digit for digit, LaTeX by what it renders (or by its plain
191
  text, when plain text writes it without loss).
192
 
193
- ## Install
194
 
195
  ```bash
196
- uv pip install omni-parse-bench # the scorer: score(), no network, no API keys
197
- uv pip install 'omni-parse-bench[harness]' # + vendor adapters, to predict
198
- uv pip install 'omni-parse-bench[benchmark]' # + dataset access, to run the benchmark
199
  ```
200
 
201
- This revision of the dataset needs omni-parse-bench 0.1.2 or newer. With 0.1.1, use the revision made for
202
- it: `--dataset hf://datasets/datalab-to/omni_parse_bench@1c35a52`.
203
-
204
- ## Run the benchmark
205
-
206
- With `[benchmark]` installed, run parsers on the dataset (5 pages here). It shows the plan and asks before
207
- calling any vendor, since calls cost money; each vendor needs its API key in the environment. A run is
208
- resumable: stop it, and run the same command again to carry on.
209
-
210
- ```bash
211
- opb benchmark --out runs/ --limit 5 --providers datalab openai/gpt-5.6-sol
212
- ```
213
-
214
- Each setting of a provider is its own run; here, two:
215
-
216
- ```bash
217
- opb benchmark --out runs/ --limit 5 --providers datalab --options '{"datalab": [{"mode": "balanced"}, {"mode": "accurate"}]}'
218
- ```
219
-
220
- `--dataset` picks the dataset: a folder, or `hf://datasets/datalab-to/omni_parse_bench@<revision>` (this one, at `main`, by
221
- default). Corrections land on `main` as new commits; pin a revision to reproduce a result. Each run's
222
- `scores.jsonl` has one line per test, with what the test is beside its verdict, so a run can be compared by
223
- tag, suite or test type: see [`docs/API.md`](https://github.com/datalab-to/omni_parse_bench/blob/main/docs/API.md#asking-a-question).
224
-
225
- ## Score
226
-
227
- Use in your own code: one page with three tests, written inline so the gold file's shape is visible
228
- (`gold.read("gold/<page_id>.json")` reads a file).
229
-
230
- ```python
231
- from omni_parse_bench import gold, score, summarize
232
-
233
- tests = gold.parse("example-p1", {"tests": [
234
- {
235
- "id": "t1",
236
- "test_type": "present",
237
- "output_type": "html",
238
- "derivation": "text_layer",
239
- "tags": ["Latn", "eng"],
240
- "args": {"content": {"text": "Quarterly revenue rose 12%", "max_diffs": 1}},
241
- "settings": {},
242
- },
243
- {
244
- "id": "t2",
245
- "test_type": "order",
246
- "output_type": "html",
247
- "derivation": "text_layer",
248
- "tags": ["Latn", "eng", "heading"],
249
- "args": {
250
- "before": {"text": "Summary", "max_diffs": 0},
251
- "after": {"text": "Outlook", "max_diffs": 0},
252
- },
253
- "settings": {},
254
- },
255
- {
256
- "id": "t3",
257
- "test_type": "table_cell",
258
- "output_type": "html",
259
- "derivation": "publisher_markup",
260
- "tags": ["table"],
261
- "args": {
262
- "cell": {"text": "4.2", "max_diffs": 0},
263
- "top_heading": {"text": "Q3", "max_diffs": 0},
264
- },
265
- "settings": {},
266
- },
267
- ]})
268
-
269
- outputs = {
270
- "html": (
271
- "<h2>Summary</h2>"
272
- "<p>Quarterly revenue rose 12% on the year.</p>"
273
- "<table>"
274
- "<tr><th>Q2</th><th>Q3</th></tr>"
275
- "<tr><td>3.9</td><td>4.1</td></tr>"
276
- "</table>"
277
- "<h2>Outlook</h2>"
278
- ),
279
- }
280
- verdicts = score(outputs, tests)
281
- ```
282
-
283
- ```python
284
- >>> verdicts
285
- [Verdict(id='t1', result='pass', why=''),
286
- Verdict(id='t2', result='pass', why=''),
287
- Verdict(id='t3', result='fail', why="no cell matching '4.2' in any table")]
288
-
289
- >>> s = summarize(verdicts, tests)["html"]
290
- >>> s["score"], s["per_test_type"], s["per_tag"]["table"]
291
- (0.6666666666666666, {'present': 1.0, 'order': 1.0, 'table_cell': 0.0}, {'score': 0.0, 'tests': 1, 'pages': 1})
292
- ```
293
-
294
- A verdict is `pass`, `fail`, `unsupported` (the parser can't produce that output) or `error` (grading
295
- raised: a bug in the scorer, not the parser's fault), with `why` saying what went wrong. `unsupported`
296
- and `error` verdicts are left out of every score.
297
-
298
- From the command line, with the outputs in a JSON file:
299
-
300
- ```bash
301
- opb score --pred outputs.json --gold gold/<page_id>.json
302
- ```
303
-
304
- ## Predict
305
-
306
- With `[harness]` installed, predict with our provider adapters:
307
-
308
- ```python
309
- from omni_parse_bench import harness
310
-
311
- record = harness.predict("datalab", "pages/<page_id>.pdf", {"html", "blocks"}, mode="balanced")
312
- record["outputs"] # {"html": "...", "blocks": [...]}
313
- record["errors"] # {output: why} for anything that failed
314
- record["calls"] # what was sent, cost, wall time
315
-
316
- score(record["outputs"], gold.read("gold/<page_id>.json"))
317
- ```
318
-
319
- From the command line:
320
-
321
- ```bash
322
- opb predict --provider openai/gpt-5.6-sol --page pages/<page_id>.pdf --wants html
323
- opb providers # every provider, and its options
324
- ```
325
 
326
  ## How the tests were built
327
 
 
40
  It has 16,288 tests on 2,937 pages from 2,343 documents over 22 suites, in
41
  92 languages. Omni Parse Bench is developed by Datalab.
42
 
43
+ Read more in our [blog post](https://www.datalab.to/blog/omni-parse-bench). **Also see the [GitHub](https://github.com/datalab-to/omni_parse_bench) for how to run the benchmark and use the scorer.**
 
44
 
45
  ## The design
46
 
 
189
  compared: text within `max_diffs` edits, a number digit for digit, LaTeX by what it renders (or by its plain
190
  text, when plain text writes it without loss).
191
 
192
+ ## Use
193
 
194
  ```bash
195
+ uv pip install 'omni-parse-bench[benchmark]'
 
 
196
  ```
197
 
198
+ How to run the benchmark on this dataset, grade a run, score a page on its own, and use the adapters: the
199
+ [omni-parse-bench README on GitHub](https://github.com/datalab-to/omni_parse_bench). This dataset needs
200
+ omni-parse-bench 1.0.0 or newer.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
 
202
  ## How the tests were built
203