agml-bench 1.0.0__tar.gz

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.
Files changed (49) hide show
  1. agml_bench-1.0.0/LICENSE +202 -0
  2. agml_bench-1.0.0/PKG-INFO +203 -0
  3. agml_bench-1.0.0/README.md +168 -0
  4. agml_bench-1.0.0/pyproject.toml +70 -0
  5. agml_bench-1.0.0/pyproject.toml.orig +61 -0
  6. agml_bench-1.0.0/src/agml_bench/__init__.py +0 -0
  7. agml_bench-1.0.0/src/agml_bench/bench.py +387 -0
  8. agml_bench-1.0.0/src/agml_bench/benchmarks/agml-full-v1/bundle.yaml +65 -0
  9. agml_bench-1.0.0/src/agml_bench/benchmarks/agml-full-v1/config.yaml +76 -0
  10. agml_bench-1.0.0/src/agml_bench/benchmarks/agml-full-v1/items.jsonl.gz +0 -0
  11. agml_bench-1.0.0/src/agml_bench/benchmarks/agml-full-v1/manifests.json.gz +0 -0
  12. agml_bench-1.0.0/src/agml_bench/build.py +468 -0
  13. agml_bench-1.0.0/src/agml_bench/catalog.py +212 -0
  14. agml_bench-1.0.0/src/agml_bench/cli.py +405 -0
  15. agml_bench-1.0.0/src/agml_bench/config.py +38 -0
  16. agml_bench-1.0.0/src/agml_bench/eval/__init__.py +17 -0
  17. agml_bench-1.0.0/src/agml_bench/eval/ag_tasks.yaml +263 -0
  18. agml_bench-1.0.0/src/agml_bench/eval/agtask.py +83 -0
  19. agml_bench-1.0.0/src/agml_bench/eval/baselines.py +93 -0
  20. agml_bench-1.0.0/src/agml_bench/eval/check.py +207 -0
  21. agml_bench-1.0.0/src/agml_bench/eval/cli.py +704 -0
  22. agml_bench-1.0.0/src/agml_bench/eval/client.py +162 -0
  23. agml_bench-1.0.0/src/agml_bench/eval/crops.py +44 -0
  24. agml_bench-1.0.0/src/agml_bench/eval/gpu.py +63 -0
  25. agml_bench-1.0.0/src/agml_bench/eval/grade.py +75 -0
  26. agml_bench-1.0.0/src/agml_bench/eval/items.py +365 -0
  27. agml_bench-1.0.0/src/agml_bench/eval/judge.py +86 -0
  28. agml_bench-1.0.0/src/agml_bench/eval/methods.py +88 -0
  29. agml_bench-1.0.0/src/agml_bench/eval/metrics.py +115 -0
  30. agml_bench-1.0.0/src/agml_bench/eval/models.yaml +139 -0
  31. agml_bench-1.0.0/src/agml_bench/eval/profile.py +319 -0
  32. agml_bench-1.0.0/src/agml_bench/eval/prompts.yaml +73 -0
  33. agml_bench-1.0.0/src/agml_bench/eval/report.py +89 -0
  34. agml_bench-1.0.0/src/agml_bench/eval/resources.py +64 -0
  35. agml_bench-1.0.0/src/agml_bench/eval/runner.py +195 -0
  36. agml_bench-1.0.0/src/agml_bench/eval/scoring.py +189 -0
  37. agml_bench-1.0.0/src/agml_bench/eval/seg_classes.yaml +55 -0
  38. agml_bench-1.0.0/src/agml_bench/eval/servers.py +132 -0
  39. agml_bench-1.0.0/src/agml_bench/eval/stats.py +340 -0
  40. agml_bench-1.0.0/src/agml_bench/eval/viewer.py +307 -0
  41. agml_bench-1.0.0/src/agml_bench/eval/yolo.py +298 -0
  42. agml_bench-1.0.0/src/agml_bench/hub.py +188 -0
  43. agml_bench-1.0.0/src/agml_bench/pipeline.py +435 -0
  44. agml_bench-1.0.0/src/agml_bench/progress.py +27 -0
  45. agml_bench-1.0.0/src/agml_bench/sampling.py +149 -0
  46. agml_bench-1.0.0/src/agml_bench/viz/__init__.py +0 -0
  47. agml_bench-1.0.0/src/agml_bench/viz/aggregate.py +170 -0
  48. agml_bench-1.0.0/src/agml_bench/viz/figures.py +132 -0
  49. agml_bench-1.0.0/src/agml_bench/viz/html.py +349 -0
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
@@ -0,0 +1,203 @@
1
+ Metadata-Version: 2.4
2
+ Name: agml-bench
3
+ Version: 1.0.0
4
+ Summary: Benchmark vision-language models on AgML agricultural datasets
5
+ Author: eranario
6
+ Author-email: eranario <ewranario@ucdavis.edu>
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Requires-Dist: datasets>=5.1.0
10
+ Requires-Dist: httpx>=0.28.1
11
+ Requires-Dist: huggingface-hub>=2.2.0
12
+ Requires-Dist: numpy>=2.5.4
13
+ Requires-Dist: nvidia-ml-py>=13.615.71
14
+ Requires-Dist: openai>=3.36.0
15
+ Requires-Dist: pandas>=3.0.6
16
+ Requires-Dist: pillow>=12.3.0
17
+ Requires-Dist: pyarrow>=26.0.0
18
+ Requires-Dist: pyyaml>=6.0.3
19
+ Requires-Dist: rapidfuzz>=3.14.6
20
+ Requires-Dist: requests>=2.34.2
21
+ Requires-Dist: scikit-learn>=1.9.1
22
+ Requires-Dist: scipy>=1.18.1
23
+ Requires-Dist: streamlit>=1.66.0
24
+ Requires-Dist: tabulate>=0.10.0
25
+ Requires-Dist: typer>=0.27.3
26
+ Requires-Dist: matplotlib>=3.11 ; extra == 'viz'
27
+ Requires-Dist: ultralytics>=8.3.0 ; extra == 'yolo'
28
+ Requires-Python: >=3.12
29
+ Project-URL: Repository, https://github.com/Project-AgML/agml-bench
30
+ Project-URL: Issues, https://github.com/Project-AgML/agml-bench/issues
31
+ Project-URL: AgML, https://github.com/Project-AgML/AgML
32
+ Provides-Extra: viz
33
+ Provides-Extra: yolo
34
+ Description-Content-Type: text/markdown
35
+
36
+ # agml-bench
37
+
38
+ Benchmark vision-language models on [AgML](https://github.com/Project-AgML/AgML) agricultural datasets: classification, detection, segmentation and VQA.
39
+
40
+ | Benchmark | Datasets | Items | Hash |
41
+ |---|---|---|---|
42
+ | `agml-full-v1` | 372 | 32,456 | `1876e21c16b413dd` |
43
+
44
+ AgriBench (in `agml-full-v1`) was removed from Hugging Face; `data pull` skips it and runs report it as unavailable.
45
+
46
+ ## Install
47
+
48
+ ```bash
49
+ git clone https://github.com/Project-AgML/agml-bench.git && cd agml-bench
50
+ uv sync
51
+ hf auth login
52
+ uv tool install vllm # to serve models with --model
53
+ ```
54
+
55
+ Without a clone:
56
+
57
+ ```bash
58
+ uv tool install "agml-bench[viz]" # CLI in its own env
59
+ pipx install "agml-bench[viz]" # same, with pipx
60
+ pip install "agml-bench[viz]" # into the current env, for the Python API
61
+ agml-bench bench list
62
+ ```
63
+
64
+ ## Quick start
65
+
66
+ ```bash
67
+ DATA=/path/to/data_dir
68
+
69
+ uv run agml-bench data pull agml-full-v1 --data-dir $DATA
70
+ uv run agml-bench eval run --model my-org/My-VLM --data-dir $DATA --judge
71
+ uv run agml-bench eval report --runs runs
72
+ ```
73
+
74
+ ## Run your model
75
+
76
+ Hugging Face repo or local checkpoint (served with vLLM):
77
+
78
+ ```bash
79
+ uv run agml-bench eval run --model my-org/My-VLM --data-dir $DATA --judge
80
+ uv run agml-bench eval run --model /path/to/checkpoint --data-dir $DATA --judge
81
+ ```
82
+
83
+ Already served (any OpenAI-compatible endpoint):
84
+
85
+ ```bash
86
+ uv run agml-bench eval run --model my-org/My-VLM --endpoint http://localhost:8000 --data-dir $DATA --judge
87
+ ```
88
+
89
+ Hosted API (OpenAI-compatible):
90
+
91
+ ```bash
92
+ export OPENAI_API_KEY=...
93
+ uv run agml-bench eval run --model gpt-5-mini --endpoint https://api.openai.com/v1 --api-key-env OPENAI_API_KEY --concurrency 8 --data-dir $DATA --judge
94
+ uv run agml-bench eval run --model gemini-2.5-flash --endpoint https://generativelanguage.googleapis.com/v1beta/openai --api-key-env GEMINI_API_KEY --data-dir $DATA --judge
95
+ uv run agml-bench eval run --model claude-sonnet-5-5 --endpoint https://api.anthropic.com/v1 --api-key-env ANTHROPIC_API_KEY --data-dir $DATA --judge
96
+ ```
97
+
98
+ Model settings:
99
+
100
+ ```bash
101
+ uv run agml-bench eval run --model my-org/My-VLM --data-dir $DATA --models-file my_models.yaml --judge
102
+ ```
103
+
104
+ ```yaml
105
+ # my_models.yaml (fields as in src/agml_bench/eval/models.yaml)
106
+ my-org/My-VLM:
107
+ serve_args: [--max-model-len, "32768"]
108
+ sampling: {temperature: 0.7, top_p: 0.95}
109
+ thinking: {chat_template_kwargs: {enable_thinking: true}}
110
+ no_thinking: {chat_template_kwargs: {enable_thinking: false}}
111
+ effort: {low: {reasoning_effort: low}, high: {reasoning_effort: high}} # request fields per --reasoning-effort
112
+ box_order: xyxy # box_2d as [x_min, y_min, x_max, y_max]; default yxyx
113
+ bbox_key_format: {bbox_2d: xyxy_px} # other box keys: xyxy_1000 | xyxy_px
114
+ ```
115
+
116
+ Your own method:
117
+
118
+ ```bash
119
+ uv run agml-bench eval run --method mypkg.methods:MyMethod --data-dir $DATA
120
+ ```
121
+
122
+ ```python
123
+ from agml_bench.eval import Benchmark, EvalItem, Method
124
+
125
+ class MyMethod(Method):
126
+ name = "my-method"
127
+ async def predict(self, item: EvalItem) -> str:
128
+ ... # item.images, item.prompt, item.choices, item.task, item.format
129
+
130
+ res = Benchmark(DATA, bench="agml-full-v1", tasks=["classification"]).run(MyMethod(), out_dir="runs/my-method")
131
+ res.metrics
132
+ ```
133
+
134
+ ## Options
135
+
136
+ ```bash
137
+ --task classification # classification | detection | segmentation | image_text_to_text
138
+ --format mcqa_within # mcqa_within | mcqa_across | oeq | grounding | multiple_choice
139
+ --only '^bean_disease_uganda$' # regex on dataset name
140
+ --limit-per-dataset 2 # quick try
141
+ --no-thinking
142
+ --reasoning-effort medium # low (default) | medium | high
143
+ --concurrency 16
144
+ --gen-seed 1 # sampling seed (replicate runs)
145
+ --run-dir runs/<run_dir> # resume
146
+ --benchmark agml-full-v1 # default; 'none' builds items from $DATA
147
+ --strict # exit non-zero if the run check fails or the run is not comparable
148
+ ```
149
+
150
+ ## Results
151
+
152
+ ```bash
153
+ uv run agml-bench eval check runs/<run_dir> # files, schema, items vs benchmark, coverage, comparable
154
+ uv run agml-bench eval judge --run runs/<run_dir>
155
+ uv run agml-bench eval judge --run runs/<run_dir> --judge-model gpt-5-mini --judge-endpoint https://api.openai.com/v1 --judge-api-key-env OPENAI_API_KEY # not comparable
156
+ uv run agml-bench eval report --runs runs
157
+ uv run agml-bench eval report --runs runs --csv reports/scores # scores.csv, ag_tasks.csv, datasets.csv
158
+ uv run agml-bench eval report --runs runs --html reports/report.html # charts, tables, runs; one offline file
159
+ uv sync --extra viz && uv run agml-bench eval report --runs runs --figures reports/figures # paper figures (PNG)
160
+ uv run agml-bench eval report --runs runs --html reports/report.html --label "my-org/My-VLM=My VLM" --label "baseline/chance=Chance"
161
+ uv run agml-bench eval stats --runs runs --out reports/stats
162
+ uv run agml-bench eval view --runs runs # http://localhost:8502
163
+ ```
164
+
165
+ `runs/<run_dir>/run_manifest.json`: agml-bench version, benchmark name and hash, model and sampling, judge, coverage, `comparable`.
166
+
167
+ ## Benchmarks
168
+
169
+ ```bash
170
+ uv run agml-bench bench list
171
+ uv run agml-bench bench show agml-full-v1
172
+ uv run agml-bench data pull agml-full-v1 --data-dir $DATA --task classification
173
+ uv run agml-bench data status agml-full-v1 --data-dir $DATA
174
+ uv run agml-bench data verify agml-full-v1 --data-dir $DATA
175
+ ```
176
+
177
+ ## Baselines
178
+
179
+ ```bash
180
+ uv run agml-bench eval baseline --kind chance --data-dir $DATA --out runs/baselines/chance
181
+ ```
182
+
183
+ ```bash
184
+ uv sync --extra yolo
185
+ uv run agml-bench sample-train --data-dir $DATA --from-manifest
186
+ uv run --extra yolo agml-bench eval yolo-shared --data-dir $DATA --shots 10 --subset 0
187
+ ```
188
+
189
+ ## More
190
+
191
+ - New benchmark versions, catalog, sampling, profiling: [docs/building.md](https://github.com/Project-AgML/agml-bench/blob/main/docs/building.md)
192
+ - Paper experiments: [research/README.md](https://github.com/Project-AgML/agml-bench/blob/main/research/README.md)
193
+ - Evaluation rules: [docs/benchmarking.md](https://github.com/Project-AgML/agml-bench/blob/main/docs/benchmarking.md)
194
+
195
+ ## Tests
196
+
197
+ ```bash
198
+ uv run pytest
199
+ ```
200
+
201
+ ## License
202
+
203
+ Code: Apache-2.0 ([LICENSE](https://github.com/Project-AgML/agml-bench/blob/main/LICENSE)). Images and labels: each dataset's own license (`license` in [catalog/catalog.json](https://github.com/Project-AgML/agml-bench/blob/main/catalog/catalog.json)).
@@ -0,0 +1,168 @@
1
+ # agml-bench
2
+
3
+ Benchmark vision-language models on [AgML](https://github.com/Project-AgML/AgML) agricultural datasets: classification, detection, segmentation and VQA.
4
+
5
+ | Benchmark | Datasets | Items | Hash |
6
+ |---|---|---|---|
7
+ | `agml-full-v1` | 372 | 32,456 | `1876e21c16b413dd` |
8
+
9
+ AgriBench (in `agml-full-v1`) was removed from Hugging Face; `data pull` skips it and runs report it as unavailable.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ git clone https://github.com/Project-AgML/agml-bench.git && cd agml-bench
15
+ uv sync
16
+ hf auth login
17
+ uv tool install vllm # to serve models with --model
18
+ ```
19
+
20
+ Without a clone:
21
+
22
+ ```bash
23
+ uv tool install "agml-bench[viz]" # CLI in its own env
24
+ pipx install "agml-bench[viz]" # same, with pipx
25
+ pip install "agml-bench[viz]" # into the current env, for the Python API
26
+ agml-bench bench list
27
+ ```
28
+
29
+ ## Quick start
30
+
31
+ ```bash
32
+ DATA=/path/to/data_dir
33
+
34
+ uv run agml-bench data pull agml-full-v1 --data-dir $DATA
35
+ uv run agml-bench eval run --model my-org/My-VLM --data-dir $DATA --judge
36
+ uv run agml-bench eval report --runs runs
37
+ ```
38
+
39
+ ## Run your model
40
+
41
+ Hugging Face repo or local checkpoint (served with vLLM):
42
+
43
+ ```bash
44
+ uv run agml-bench eval run --model my-org/My-VLM --data-dir $DATA --judge
45
+ uv run agml-bench eval run --model /path/to/checkpoint --data-dir $DATA --judge
46
+ ```
47
+
48
+ Already served (any OpenAI-compatible endpoint):
49
+
50
+ ```bash
51
+ uv run agml-bench eval run --model my-org/My-VLM --endpoint http://localhost:8000 --data-dir $DATA --judge
52
+ ```
53
+
54
+ Hosted API (OpenAI-compatible):
55
+
56
+ ```bash
57
+ export OPENAI_API_KEY=...
58
+ uv run agml-bench eval run --model gpt-5-mini --endpoint https://api.openai.com/v1 --api-key-env OPENAI_API_KEY --concurrency 8 --data-dir $DATA --judge
59
+ uv run agml-bench eval run --model gemini-2.5-flash --endpoint https://generativelanguage.googleapis.com/v1beta/openai --api-key-env GEMINI_API_KEY --data-dir $DATA --judge
60
+ uv run agml-bench eval run --model claude-sonnet-5-5 --endpoint https://api.anthropic.com/v1 --api-key-env ANTHROPIC_API_KEY --data-dir $DATA --judge
61
+ ```
62
+
63
+ Model settings:
64
+
65
+ ```bash
66
+ uv run agml-bench eval run --model my-org/My-VLM --data-dir $DATA --models-file my_models.yaml --judge
67
+ ```
68
+
69
+ ```yaml
70
+ # my_models.yaml (fields as in src/agml_bench/eval/models.yaml)
71
+ my-org/My-VLM:
72
+ serve_args: [--max-model-len, "32768"]
73
+ sampling: {temperature: 0.7, top_p: 0.95}
74
+ thinking: {chat_template_kwargs: {enable_thinking: true}}
75
+ no_thinking: {chat_template_kwargs: {enable_thinking: false}}
76
+ effort: {low: {reasoning_effort: low}, high: {reasoning_effort: high}} # request fields per --reasoning-effort
77
+ box_order: xyxy # box_2d as [x_min, y_min, x_max, y_max]; default yxyx
78
+ bbox_key_format: {bbox_2d: xyxy_px} # other box keys: xyxy_1000 | xyxy_px
79
+ ```
80
+
81
+ Your own method:
82
+
83
+ ```bash
84
+ uv run agml-bench eval run --method mypkg.methods:MyMethod --data-dir $DATA
85
+ ```
86
+
87
+ ```python
88
+ from agml_bench.eval import Benchmark, EvalItem, Method
89
+
90
+ class MyMethod(Method):
91
+ name = "my-method"
92
+ async def predict(self, item: EvalItem) -> str:
93
+ ... # item.images, item.prompt, item.choices, item.task, item.format
94
+
95
+ res = Benchmark(DATA, bench="agml-full-v1", tasks=["classification"]).run(MyMethod(), out_dir="runs/my-method")
96
+ res.metrics
97
+ ```
98
+
99
+ ## Options
100
+
101
+ ```bash
102
+ --task classification # classification | detection | segmentation | image_text_to_text
103
+ --format mcqa_within # mcqa_within | mcqa_across | oeq | grounding | multiple_choice
104
+ --only '^bean_disease_uganda$' # regex on dataset name
105
+ --limit-per-dataset 2 # quick try
106
+ --no-thinking
107
+ --reasoning-effort medium # low (default) | medium | high
108
+ --concurrency 16
109
+ --gen-seed 1 # sampling seed (replicate runs)
110
+ --run-dir runs/<run_dir> # resume
111
+ --benchmark agml-full-v1 # default; 'none' builds items from $DATA
112
+ --strict # exit non-zero if the run check fails or the run is not comparable
113
+ ```
114
+
115
+ ## Results
116
+
117
+ ```bash
118
+ uv run agml-bench eval check runs/<run_dir> # files, schema, items vs benchmark, coverage, comparable
119
+ uv run agml-bench eval judge --run runs/<run_dir>
120
+ uv run agml-bench eval judge --run runs/<run_dir> --judge-model gpt-5-mini --judge-endpoint https://api.openai.com/v1 --judge-api-key-env OPENAI_API_KEY # not comparable
121
+ uv run agml-bench eval report --runs runs
122
+ uv run agml-bench eval report --runs runs --csv reports/scores # scores.csv, ag_tasks.csv, datasets.csv
123
+ uv run agml-bench eval report --runs runs --html reports/report.html # charts, tables, runs; one offline file
124
+ uv sync --extra viz && uv run agml-bench eval report --runs runs --figures reports/figures # paper figures (PNG)
125
+ uv run agml-bench eval report --runs runs --html reports/report.html --label "my-org/My-VLM=My VLM" --label "baseline/chance=Chance"
126
+ uv run agml-bench eval stats --runs runs --out reports/stats
127
+ uv run agml-bench eval view --runs runs # http://localhost:8502
128
+ ```
129
+
130
+ `runs/<run_dir>/run_manifest.json`: agml-bench version, benchmark name and hash, model and sampling, judge, coverage, `comparable`.
131
+
132
+ ## Benchmarks
133
+
134
+ ```bash
135
+ uv run agml-bench bench list
136
+ uv run agml-bench bench show agml-full-v1
137
+ uv run agml-bench data pull agml-full-v1 --data-dir $DATA --task classification
138
+ uv run agml-bench data status agml-full-v1 --data-dir $DATA
139
+ uv run agml-bench data verify agml-full-v1 --data-dir $DATA
140
+ ```
141
+
142
+ ## Baselines
143
+
144
+ ```bash
145
+ uv run agml-bench eval baseline --kind chance --data-dir $DATA --out runs/baselines/chance
146
+ ```
147
+
148
+ ```bash
149
+ uv sync --extra yolo
150
+ uv run agml-bench sample-train --data-dir $DATA --from-manifest
151
+ uv run --extra yolo agml-bench eval yolo-shared --data-dir $DATA --shots 10 --subset 0
152
+ ```
153
+
154
+ ## More
155
+
156
+ - New benchmark versions, catalog, sampling, profiling: [docs/building.md](https://github.com/Project-AgML/agml-bench/blob/main/docs/building.md)
157
+ - Paper experiments: [research/README.md](https://github.com/Project-AgML/agml-bench/blob/main/research/README.md)
158
+ - Evaluation rules: [docs/benchmarking.md](https://github.com/Project-AgML/agml-bench/blob/main/docs/benchmarking.md)
159
+
160
+ ## Tests
161
+
162
+ ```bash
163
+ uv run pytest
164
+ ```
165
+
166
+ ## License
167
+
168
+ Code: Apache-2.0 ([LICENSE](https://github.com/Project-AgML/agml-bench/blob/main/LICENSE)). Images and labels: each dataset's own license (`license` in [catalog/catalog.json](https://github.com/Project-AgML/agml-bench/blob/main/catalog/catalog.json)).
@@ -0,0 +1,70 @@
1
+ [project]
2
+ name = "agml-bench"
3
+ version = "1.0.0"
4
+ description = "Benchmark vision-language models on AgML agricultural datasets"
5
+ readme = "README.md"
6
+ license = "Apache-2.0"
7
+ license-files = ["LICENSE"]
8
+ requires-python = ">=3.12"
9
+ dependencies = [
10
+ "datasets>=5.1.0",
11
+ "httpx>=0.28.1",
12
+ "huggingface-hub>=2.2.0",
13
+ "numpy>=2.5.4",
14
+ "nvidia-ml-py>=13.615.71",
15
+ "openai>=3.36.0",
16
+ "pandas>=3.0.6",
17
+ "pillow>=12.3.0",
18
+ "pyarrow>=26.0.0",
19
+ "pyyaml>=6.0.3",
20
+ "rapidfuzz>=3.14.6",
21
+ "requests>=2.34.2",
22
+ "scikit-learn>=1.9.1",
23
+ "scipy>=1.18.1",
24
+ "streamlit>=1.66.0",
25
+ "tabulate>=0.10.0",
26
+ "typer>=0.27.3",
27
+ ]
28
+
29
+ [[project.authors]]
30
+ name = "eranario"
31
+ email = "ewranario@ucdavis.edu"
32
+
33
+ [project.urls]
34
+ Repository = "https://github.com/Project-AgML/agml-bench"
35
+ Issues = "https://github.com/Project-AgML/agml-bench/issues"
36
+ AgML = "https://github.com/Project-AgML/AgML"
37
+
38
+ [project.optional-dependencies]
39
+ yolo = ["ultralytics>=8.3.0"]
40
+ viz = ["matplotlib>=3.11"]
41
+
42
+ [project.scripts]
43
+ agml-bench = "agml_bench.cli:app"
44
+
45
+ [build-system]
46
+ requires = ["uv_build>=0.11.8,<0.12.0"]
47
+ build-backend = "uv_build"
48
+
49
+ [dependency-groups]
50
+ dev = ["pytest>=9.1.1"]
51
+
52
+ [tool.ruff]
53
+ line-length = 130
54
+ src = [
55
+ "src",
56
+ "tests",
57
+ ]
58
+
59
+ [tool.ruff.lint]
60
+ select = [
61
+ "E",
62
+ "F",
63
+ "W",
64
+ ]
65
+ ignore = [
66
+ "E501",
67
+ "E702",
68
+ "E731",
69
+ "E741",
70
+ ]