Shorten usage
Browse files
README.md
CHANGED
|
@@ -102,40 +102,11 @@ Seven of the eight short documents are single plotter sheets 13 to 17 feet long
|
|
| 102 |
|
| 103 |
## Usage
|
| 104 |
|
| 105 |
-
|
| 106 |
|
| 107 |
-
```
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
ds = load_dataset("llamaindex/ExtractBenchPro", split="charts_inside_documents")
|
| 112 |
-
case = ds[0]
|
| 113 |
-
schema = json.loads(case["data_schema"])
|
| 114 |
-
expected = json.loads(case["expected_output"])
|
| 115 |
-
```
|
| 116 |
-
|
| 117 |
-
The rows use the same format as ExtractBench, so the [evaluation framework](https://github.com/run-llama/ExtractBench) scores them unchanged. To rebuild the `<stem>.pdf` + `<stem>.test.json` layout that the framework reads:
|
| 118 |
-
|
| 119 |
-
```python
|
| 120 |
-
import json, shutil
|
| 121 |
-
from pathlib import Path
|
| 122 |
-
from huggingface_hub import snapshot_download
|
| 123 |
-
|
| 124 |
-
root = Path(snapshot_download("llamaindex/ExtractBenchPro", repo_type="dataset"))
|
| 125 |
-
out = Path("data/extract_bench_pro")
|
| 126 |
-
for split in ["document_conventions", "house_vocabulary", "house_counting_rules", "drawn_relations", "charts_inside_documents", "long_chart_sheets"]:
|
| 127 |
-
for line in (root / f"{split}.jsonl").read_text().splitlines():
|
| 128 |
-
row = json.loads(line)
|
| 129 |
-
stem = Path(row["pdf"]).stem
|
| 130 |
-
(out / split).mkdir(parents=True, exist_ok=True)
|
| 131 |
-
shutil.copyfile(root / row["pdf"], out / split / f"{stem}.pdf")
|
| 132 |
-
sidecar = {
|
| 133 |
-
"tags": row["tags"],
|
| 134 |
-
"data_schema": json.loads(row["data_schema"]),
|
| 135 |
-
"expected_output": json.loads(row["expected_output"]),
|
| 136 |
-
"_field_rules": json.loads(row["field_rules"]),
|
| 137 |
-
}
|
| 138 |
-
(out / split / f"{stem}.test.json").write_text(json.dumps(sidecar))
|
| 139 |
```
|
| 140 |
|
| 141 |
Scoring follows ExtractBench and is fully deterministic:
|
|
|
|
| 102 |
|
| 103 |
## Usage
|
| 104 |
|
| 105 |
+
Download the dataset and run a system with the [ExtractBench evaluation framework](https://github.com/run-llama/ExtractBench#extractbench-pro):
|
| 106 |
|
| 107 |
+
```bash
|
| 108 |
+
uv run extract-bench download --dataset pro
|
| 109 |
+
uv run extract-bench run llamaextract_agentic --dataset pro
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
```
|
| 111 |
|
| 112 |
Scoring follows ExtractBench and is fully deterministic:
|