diff --git a/README.md b/README.md index 162ff22..878368b 100644 --- a/README.md +++ b/README.md @@ -1,154 +1,51 @@ -# AGgentic-benchmarks +# agml-benchmarks -Agricultural benchmarks for evaluating agentic systems. +Benchmark vision-language models on AgML agricultural datasets: classification, detection, segmentation and VQA. -## Setup +## Install ```bash +git clone git@github.com:Project-AgML/agml-benchmarks.git && cd agml-benchmarks uv sync hf auth login +uv tool install vllm # to serve models with --model ``` -## Catalog - -```bash -uv run agbench catalog sync # fetch latest AgML catalog, print what changed -uv run agbench catalog diff # show upstream changes without saving -uv run agbench catalog list # eligible datasets -uv run agbench catalog list --all # include excluded datasets with reason -uv run agbench catalog list --task image_text_to_text -``` - -## base-data - -Sampling rules: [docs/subsampling.md](docs/subsampling.md) +## Quick start ```bash DATA=/path/to/data_dir -uv run agbench status --data-dir $DATA -uv run agbench sample --data-dir $DATA -``` - -Filter: - -```bash -uv run agbench sample --data-dir $DATA --task classification -uv run agbench sample --data-dir $DATA --only '^AgroBench$' -``` - -Update after a catalog sync: - -```bash -uv run agbench catalog sync -uv run agbench sample --data-dir $DATA -``` - -Other options: - -```bash -uv run agbench sample --data-dir $DATA --refresh # resample datasets already done -uv run agbench sample --data-dir $DATA --skip-failed # do not retry failed datasets -uv run agbench sample --data-dir $DATA --timeout 1800 # seconds per dataset -uv run agbench sample --data-dir $DATA --from-manifest # re-download exact samples in manifests/ -``` - -## Viewer - -```bash -uv run agbench view --data-dir $DATA -``` - -## Benchmark - -Rules: [docs/benchmarking.md](docs/benchmarking.md) - -Setup: - -```bash -git clone git@github.com:plant-ai-biophysics-lab/AGgentic-benchmarks.git && cd AGgentic-benchmarks -uv sync -hf auth login -uv tool install vllm -vllm download-kernels -``` - -llama.cpp (Nemotron GGUF): - -```bash -git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp -cmake -B build -DGGML_CUDA=ON && cmake --build build -j 8 --target llama-server -export LLAMA_SERVER_BIN=$PWD/build/bin/llama-server -``` - -```bash -uv run agbench eval models -uv run agbench eval run --model Qwen/Qwen3.6-35B-A3B-FP8 --data-dir $DATA --judge -uv run agbench eval run --model Qwen/Qwen3.6-35B-A3B-FP8 --data-dir $DATA --task classification --format mcqa_within -uv run agbench eval run --model Qwen/Qwen3.6-35B-A3B-FP8 --data-dir $DATA --endpoint http://localhost:8000 -uv run agbench eval judge --run runs/ -uv run agbench eval judge --run runs/ --redo # re-judge everything (after editing the judge prompts) +uv run agbench data pull agml-full-v1 --data-dir $DATA +uv run agbench eval run --model my-org/My-VLM --data-dir $DATA --judge uv run agbench eval report --runs runs -uv run agbench eval report --runs runs/full --csv reports/scores/full_low # scores.csv, ag_tasks.csv, datasets.csv -uv run agbench eval stats --runs runs/exp/seeds --out reports/stats/seeds -uv run agbench eval view --runs runs --profile reports/profile ``` -Options: - -```bash ---only '^AgroBench$' # regex on dataset name ---limit-per-dataset 5 ---no-thinking ---reasoning-effort medium # low (default) | medium | high ---concurrency 16 ---gen-seed 1 # sampling seed (replicate runs) ---order-seed 1 --nota-position random # MCQA: shuffle option order, NOTA/IDK anywhere ---nota-rate 0.5 # MCQA: share of items whose true class is removed ---no-idk # MCQA: drop "I don't know" ---run-dir runs/ # resume (with --judge: judge whatever is left) -``` +## Run your model -Compute profile: +Hugging Face repo or local checkpoint (served with vLLM): ```bash -uv run agbench eval run --model openbmb/MiniCPM-V-4.7-35B-A3B-FP8 --data-dir $DATA --limit-per-dataset 2 --only '^(bean_disease_uganda|almond_bloom_2023|apple_flower_segmentation|AgriBench)$' -uv run agbench eval profile --data-dir $DATA --models google/gemma-4-12B-it --per-task 5 -uv run agbench eval profile --data-dir $DATA --models all -uv run agbench eval profile --data-dir $DATA --models all --redo # re-profile models already done -research/scripts/profile_all_models.sh $DATA # same, deleting each model's weights after +uv run agbench eval run --model my-org/My-VLM --data-dir $DATA --judge +uv run agbench eval run --model /path/to/checkpoint --data-dir $DATA --judge ``` -Resume: +Already served (any OpenAI-compatible endpoint): ```bash -uv run agbench eval run --model Qwen/Qwen3.6-35B-A3B-FP8 --data-dir $DATA --judge --run-dir runs/ -uv run agbench eval judge --run runs/ -uv run agbench eval judge --run runs/ --redo # re-judge everything (after editing the judge prompts) -uv run agbench eval profile --data-dir $DATA --models all # keeps models already in reports/profile/profile.json -``` - -View results (http://localhost:8502): - -```bash -uv run agbench eval view --runs reports/profile --profile reports/profile -uv run agbench eval view --runs reports/profile --profile reports/profile --data-dir $DATA # images under another base-data/ copy +uv run agbench eval run --model my-org/My-VLM --endpoint http://localhost:8000 --data-dir $DATA --judge ``` -Your own model (any HF repo or local path; vLLM by default): +Model settings: ```bash -uv run agbench eval run --model my-org/My-VLM --data-dir $DATA -uv run agbench eval run --model /path/to/checkpoint --data-dir $DATA -uv run agbench eval run --model my-org/My-VLM --data-dir $DATA --models-file my_models.yaml -uv run agbench eval profile --models my-org/My-VLM --data-dir $DATA --models-file my_models.yaml -uv run agbench eval run --model my-org/My-VLM --data-dir $DATA --endpoint http://localhost:8000 +uv run agbench eval run --model my-org/My-VLM --data-dir $DATA --models-file my_models.yaml --judge ``` ```yaml -# my_models.yaml (same fields as src/agbench/eval/models.yaml) +# my_models.yaml (fields as in src/agbench/eval/models.yaml) my-org/My-VLM: - serve_args: [--reasoning-parser, qwen3, --quantization, awq] + serve_args: [--max-model-len, "32768"] sampling: {temperature: 0.7, top_p: 0.95} thinking: {chat_template_kwargs: {enable_thinking: true}} no_thinking: {chat_template_kwargs: {enable_thinking: false}} @@ -156,82 +53,79 @@ my-org/My-VLM: bbox_key_format: {bbox_2d: xyxy_px} # other box keys: xyxy_1000 | xyxy_px ``` -Custom method: +Your own method: ```bash -uv add "agbench @ git+ssh://git@github.com/plant-ai-biophysics-lab/AGgentic-benchmarks" +uv run agbench eval run --method mypkg.methods:MyMethod --data-dir $DATA ``` ```python -from agbench.eval import Benchmark, Method, EvalItem +from agbench.eval import Benchmark, EvalItem, Method class MyMethod(Method): name = "my-method" async def predict(self, item: EvalItem) -> str: - ... # item.images, item.prompt, item.choices, item.task, item.format, item.crop, item.ag_task + ... # item.images, item.prompt, item.choices, item.task, item.format -res = Benchmark("/path/to/data_dir", tasks=["classification"]).run(MyMethod(), out_dir="runs/my-method") -res = Benchmark("/path/to/data_dir", tasks=["detection"]).run(MyMethod(), out_dir="runs/my-method-det", key_formats={"box_2d": "xyxy_1000"}) +res = Benchmark(DATA, bench="agml-full-v1", tasks=["classification"]).run(MyMethod(), out_dir="runs/my-method") res.metrics ``` -```bash -uv run agbench eval run --method mypkg.methods:MyMethod --data-dir $DATA -uv run agbench eval check-agtasks # ag-task mapping gaps after a catalog sync -``` - -## Tests +## Options ```bash -uv run pytest +--task classification # classification | detection | segmentation | image_text_to_text +--format mcqa_within # mcqa_within | mcqa_across | oeq | grounding | multiple_choice +--only '^bean_disease_uganda$' # regex on dataset name +--limit-per-dataset 2 # quick try +--no-thinking +--reasoning-effort medium # low (default) | medium | high +--concurrency 16 +--gen-seed 1 # sampling seed (replicate runs) +--run-dir runs/ # resume +--benchmark agml-full-v1 # default; 'none' builds items from $DATA ``` -## Layout +## Results -``` -configs/base_data.yaml sampling settings and per-dataset overrides -catalog/catalog.json normalized AgML catalog -catalog/CHANGES.md catalog changes per sync -manifests/base-data//.json sampled ids, labels, HF revision -src/agbench/eval/*.yaml prompts, model registry, ag tasks, segmentation class names -runs/_