Repository navigation
Add Molmo2-4B image-QA + PixMo-Cap dense-caption eval support - #219
Merged
Merged
Conversation
…e-push # Conflicts: # src/olmo_eval/common/image_qa/vqa_normalization.py # src/olmo_eval/common/scorers/dense_caption_judge.py # src/olmo_eval/common/scorers/image_qa.py # src/olmo_eval/evals/tasks/countbench_qa.py # src/olmo_eval/evals/tasks/dense_caption.py # src/olmo_eval/evals/tasks/vqa2.py # tests/core/test_dense_caption_judge.py
Evaluate the released HF allenai/Molmo2-4B (11 image-QA benchmarks + PixMo-Cap dense caption) inside olmo-eval, aligned to the mm_olmo reference. No uv env / version changes beyond declaring Molmo2 remote-code deps (einops, torchvision) in the existing `hf` extra. - huggingface provider: transformers-5 load shims for Molmo2 remote code (strip optional-attribute processor kwargs; recover generation cache_position) + fp32-weights/bf16-autocast path (autocast_dtype) to match mm_olmo's amp_bf16 numerics; pickle-safe lazy HF image decode. - molmo2-4b preset: dtype=float32 + autocast_dtype=bfloat16, max_crops=24. - math_vista: default to the official gpt-4-0613 extraction; add math_vista:offline for the API-free heuristic. - dense_caption: faithful per-example seeded long_caption prompt (23 templates) instead of a single hardcoded question; auto-create GPT cache. - ai2d: add the transparent-label variant alongside opaque (primary). - evals/suites/molmo2.py: molmo2_imageqa (11) + molmo2_imageqa_caption (12). - tests for the multimodal provider, image-QA requests, and prompt parity. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Adds a separate image-pointing eval family for the released HF Molmo2-4B, distinct from the 11 image-QA tasks (its own base class, scorer, metrics, suite, and doc; the image-QA modules are untouched). Ports two mm_olmo benchmarks run on the HF checkpoint: - pixmo_points_eval (mm_olmo PixMoPointsEval3Config / SegmentionPointingEval) - sa_co_gold_subset (mm_olmo SACoGoldSubset / SACoGoldPointEvaluator) Both ask "Point to <thing>." and score point-in-mask precision/recall/f1 by maximum bipartite matching, bucketed by GT instance count; SACoGold takes the max over 3 annotators with weighted primaries. New modules: common/pointing.py (COCO-RLE mask decode + bipartite scoring), common/scorers/pointing.py, evals/tasks/common/pointing_base.py (PointingTask + PointingMetric + pointing_metrics), the two task modules, the molmo2_pointing suite, and CPU-only tests. pycocotools (+ explicit scipy) added to the hf extra; the uv.lock diff is only pycocotools. Reuses generic helpers by import only. Verified vs mm_olmo (Molmo2-4B, fp32+bf16 autocast, max_crops=24): SACoGold weighted f1 0.6909 vs 0.6922 (all 18 metrics within 0.0025); PixMo-Points f1 0.8314 vs 0.8290. Full suite: 1755 passed, 5 skipped. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_017rWjjwFXMM556pd4ixrQ96
jason718
marked this pull request as ready for review
June 22, 2026 20:38
jason718
pushed a commit
that referenced
this pull request
Jun 23, 2026
* new vision tasks * Add Molmo2-4B image-QA + PixMo-Cap dense-caption eval support Evaluate the released HF allenai/Molmo2-4B (11 image-QA benchmarks + PixMo-Cap dense caption) inside olmo-eval, aligned to the mm_olmo reference. No uv env / version changes beyond declaring Molmo2 remote-code deps (einops, torchvision) in the existing `hf` extra. - huggingface provider: transformers-5 load shims for Molmo2 remote code (strip optional-attribute processor kwargs; recover generation cache_position) + fp32-weights/bf16-autocast path (autocast_dtype) to match mm_olmo's amp_bf16 numerics; pickle-safe lazy HF image decode. - molmo2-4b preset: dtype=float32 + autocast_dtype=bfloat16, max_crops=24. - math_vista: default to the official gpt-4-0613 extraction; add math_vista:offline for the API-free heuristic. - dense_caption: faithful per-example seeded long_caption prompt (23 templates) instead of a single hardcoded question; auto-create GPT cache. - ai2d: add the transparent-label variant alongside opaque (primary). - evals/suites/molmo2.py: molmo2_imageqa (11) + molmo2_imageqa_caption (12). - tests for the multimodal provider, image-QA requests, and prompt parity. * Add image-pointing eval family (PixMo-Points-Eval v3 + SACoGold) Adds a separate image-pointing eval family for the released HF Molmo2-4B, distinct from the 11 image-QA tasks (its own base class, scorer, metrics, suite, and doc; the image-QA modules are untouched). Ports two mm_olmo benchmarks run on the HF checkpoint: - pixmo_points_eval (mm_olmo PixMoPointsEval3Config / SegmentionPointingEval) - sa_co_gold_subset (mm_olmo SACoGoldSubset / SACoGoldPointEvaluator) Both ask "Point to <thing>." and score point-in-mask precision/recall/f1 by maximum bipartite matching, bucketed by GT instance count; SACoGold takes the max over 3 annotators with weighted primaries. New modules: common/pointing.py (COCO-RLE mask decode + bipartite scoring), common/scorers/pointing.py, evals/tasks/common/pointing_base.py (PointingTask + PointingMetric + pointing_metrics), the two task modules, the molmo2_pointing suite, and CPU-only tests. pycocotools (+ explicit scipy) added to the hf extra; the uv.lock diff is only pycocotools. Reuses generic helpers by import only. Verified vs mm_olmo (Molmo2-4B, fp32+bf16 autocast, max_crops=24): SACoGold weighted f1 0.6909 vs 0.6922 (all 18 metrics within 0.0025); PixMo-Points f1 0.8314 vs 0.8290. Full suite: 1755 passed, 5 skipped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds evaluation support for the released HF checkpoint
allenai/Molmo2-4Bin olmo-eval —the 11 image-QA benchmarks (ChartQA, VQA2, DocVQA, InfoVQA, TextVQA, RealWorldQA, MMMU,
MathVista, CountBench, PixMo-Count, AI2D), PixMo-Cap dense captioning, and a separate
image-pointing family (PixMo-Points-Eval v3 + SACoGold) — aligned to the official
mm_olmoreference so the framework reproduces mm_olmo / the Molmo2 paper numbers on the sameweights. Draft: more launch/convenience scripts will follow in subsequent commits.
The model weights are identical to mm_olmo's, so this work targets only the eval pipeline
(load, precision, prompts, metrics).
Reproduction vs. Molmo2-4B (paper)
Real GPU runs of this branch against the Molmo2-4B line of the paper table. Reproduced
metrics come from each run's
metrics.jsonprimary metric (all values in %):All directly-scored benchmarks land within ~0.7 pt of the paper. Notes:
stricter opaque variant scores 85.43.
(https://rrc.cvc.uab.es). † DocVQA submission = 0.92 overall ANLS (0.87 on the
Figure/Diagram category); InfoVQA submission = 0.78 overall ANLS.
Image-pointing family (vs.
mm_olmo)Point-in-mask scoring (
f1, 0–1) reproduced against mm_olmo's own Molmo2-4B runs(fp32 + bf16 autocast,
max_crops=24):All 18 SACoGold metrics (precision/recall/f1 × all/single/low/med/high-freq buckets + weighted
primaries) land within 0.0025 of mm_olmo.
Changes
inference/providers/huggingface.py)optional-attribute kwargs, and recover a missing
cache_positionduring generation(Molmo2's remote code targets transformers 4.57.x). Both are import-defensive and scoped
to the model load — no effect on other models.
autocast_dtypearg) to match mm_olmo'samp_bf16numerics; defensively guarded so mocked-torchCPU tests stay green.functools.partial) so themultimodal path works under the multiprocess runner.
LMRequest.imagesfield, forwarded through the harness(
harness/harness.py) and consumed only by the multimodal provider.molmo2-4bpreset (common/constants/models.py):dtype=float32,autocast_dtype=bfloat16,max_crops=24.evals/tasks/math_vista.py): default to the officialgpt-4-0613answerextraction (matching mm_olmo);
math_vista:offlineretains the API-free heuristic.evals/tasks/dense_caption.py,common/image_qa/): faithfulper-example seeded
long_captionprompt (the 23GENERAL_PROMPTS_V1templates, pickedby the same RNG mm_olmo uses) instead of one hardcoded question; GPT judge unchanged.
common/pointing.py,common/scorers/pointing.py,evals/tasks/common/pointing_base.py,evals/tasks/pixmo_points_eval.py,evals/tasks/sa_co_gold.py): two mm_olmo pointing benchmarks(
pixmo_points_eval←PixMoPointsEval3Config/SegmentionPointingEval,sa_co_gold_subset←SACoGoldSubset/SACoGoldPointEvaluator) run on the HF checkpoint.Both ask "Point to <thing>." and score point-in-mask precision/recall/f1 by maximum
bipartite matching over decoded COCO-RLE masks, bucketed by GT instance count; SACoGold takes
the max over 3 annotators with weighted primaries. Distinct base class / scorer / metrics —
the image-QA modules are untouched.
evals/tasks/ai2d.py): add thetransparent-label variant alongsideopaque(opaque stays primary).
common/scorers/dense_caption_judge.py): auto-create the cache dirbefore the atomic write (fixes a crash on a fresh
MATHVISTA_GPT_CACHE_DIR).evals/suites/molmo2.py):molmo2_imageqa(11 tasks, averaged),molmo2_imageqa_caption(12, display-only), andmolmo2_pointing(2 pointing tasks,averaged on f1).
pyproject.toml/uv.lock): declare Molmo2's remote-code depseinopsandtorchvision, pluspycocotools(+ an explicitscipypin) for the pointing scorer, in theexisting
hfextra (no version bumps, no other group touched; the only newuv.lockresolveis
pycocotools).and CPU-only pointing tests (mask geometry, bipartite scoring, metric buckets, prompt
builders); existing scorer/harness tests updated to match.
Verification
ruff check/ruff format --checkclean;ty checkclean (pre-existing residuals only);pytest tests/ --ignore=tests/integration→ 1755 passed, 5 skipped.