Skip to content

Feat/text multi image eval - #148

Open
camilobrownpinilla wants to merge 4 commits into
multimodal-videofrom
feat/text-multi-image-eval
Open

Feat/text multi image eval#148
camilobrownpinilla wants to merge 4 commits into
multimodal-videofrom
feat/text-multi-image-eval

Conversation

@camilobrownpinilla

@camilobrownpinilla camilobrownpinilla commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Support text benchmarking for image/video models
  • Support multi-image benchmarking for video models
  • Fix LLM Judge benchmarks not running properly

Testing

  • uv run ruff check kempnerforge/ tests/ passes
  • uv run ruff format --check kempnerforge/ tests/ scripts/ passes
  • uv run pyright kempnerforge/ passes (0 errors)
  • uv run pytest tests/unit/ -v --timeout=60 passes

Closes #144

camilobrownpinilla and others added 2 commits July 13, 2026 16:12
Pack N images from a chat request as an ordered clip (a single image is the
1-frame case), reusing the existing video frame/clip machinery. Images past
frames_per_clip are truncated downstream, with a warning surfaced at render.
Image checkpoints still reject multiple images; text-only stays out of scope.

Flips the video-path multi-image test to expect frames and adds coverage for
the truncation warning.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STRsAc9nZjMhkLzYkkYp67
Add a text-only (no-visual) forward path for the generative VLM arches so
generate_until text benchmarks (GSM8K, IFEval, ...) can measure text-backbone
drift on image and video checkpoints, in the same lmms-eval harness as the
multimodal tasks.

Model core (backwards-compatible, no new parameters or state-dict keys):
- vlm.py: widen pixel_values to `Tensor | None` across the ModalityStrategy
  protocol, all four strategies, and VLMWrapper.forward. A None (text-only)
  request yields an empty ModalityContext for joint_decoder/cross_attention/mot
  and is rejected for the non-generative moma arch.
- transformer.py: skip cross-attention blocks when image_features is None; run
  the MoT branch with n_image=0 when there is neither a prefix nor modality_ids.
- mot.py: reshape the MoT projections with explicit head counts so a zero-length
  image stream flows through (bit-identical for the non-empty path).

Only previously-erroring paths change behavior; existing image/video forwards,
checkpoints, and configs are untouched.

Adapter (examples/vlm-evaluation):
- _render_request renders a no-visual request as empty frames on both image and
  video checkpoints.
- _generate_batch accepts pixel_values=None (skip vision, 0 image-token budget,
  device from the prompts).
- generate_until segregates a gen_kwargs chunk into visual and text-only
  sub-batches, decodes each, and scatters results back in original order.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01STRsAc9nZjMhkLzYkkYp67
@camilobrownpinilla
camilobrownpinilla marked this pull request as ready for review July 22, 2026 14:52
@camilobrownpinilla
camilobrownpinilla force-pushed the feat/text-multi-image-eval branch from 955929e to c803dd0 Compare July 22, 2026 17:38
@camilobrownpinilla camilobrownpinilla linked an issue Jul 23, 2026 that may be closed by this pull request

@amazloumi amazloumi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR adding two independent features and one fix. Please break it to three individual smaller PRs.

Base automatically changed from refactor/migrate-eval-to-examples to multimodal-video July 30, 2026 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for text-only and multi-image vlm eval

2 participants