[Feat] Add VLMEvalKit integration for nanoVLM evaluation#206
Open
khurramHashmi wants to merge 1 commit into
Open
[Feat] Add VLMEvalKit integration for nanoVLM evaluation#206khurramHashmi wants to merge 1 commit into
khurramHashmi wants to merge 1 commit into
Conversation
- Add eval/vlmevalkit_adapter.py: VLMEvalKit BaseModel adapter that uses nanoVLM's own tokenizer, image processor, and VisionLanguageModel. Supports per-dataset prompt formatting (MMBench, MMMU, MathVista, ChartQA, DocVQA, TextVQA, MCQ) and handles both image-splitting and non-splitting model variants. - Add eval/setup_vlmevalkit.sh: idempotent setup script that initialises the VLMEvalKit submodule, installs it in editable mode, copies the adapter, and patches VLMEvalKit's __init__.py and config.py to register nanoVLM-460M-8k and nanoVLM-230M-8k. - Add eval/eval_vlmevalkit.sh: launcher script (default: nanoVLM-460M-8k, MMStar). Passes optional LLM-judge env vars for benchmarks like MMBench. - Add eval/test_vlmevalkit.py: smoke test covering text-only, image+text, and MCQ inference paths. - Modify models/vision_language_model.py: filter unknown keys from old checkpoint configs for backward compatibility; expose _saved_config_keys so adapters can detect which optional fields were actually saved. - Add VLMEvalKit as a git submodule (khurramHashmi/VLMEvalKit fork, commit 23d51dc) with the nanoVLM adapter already registered. - Update README.md: --recurse-submodules clone note, VLMEvalKit eval section, roadmap item marked done.
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.
This PR integrates VLMEvalKit into nanoVLM as a second evaluation framework alongside the existing lmms-eval integration, enabling evaluation across a broader set of multimodal benchmarks with minimal setup.
What's added
VLMEvalKit adapter (
eval/vlmevalkit_adapter.py): ABaseModelsubclass that wires nanoVLM's tokenizer, image processor, andVisionLanguageModelinto the VLMEvalKit inference API. Handles per-datasetprompt formatting (MMBench, MMMU, MathVista, ChartQA, DocVQA, TextVQA, MCQ) and supports both image-splitting and non-splitting model variants.
Setup script (
eval/setup_vlmevalkit.sh): Idempotent script that initialises the VLMEvalKit submodule, installs it in editable mode, copies the adapter, and patches VLMEvalKit's__init__.pyandconfig.pyto registernanoVLM-460M-8kandnanoVLM-230M-8k.Launcher script (
eval/eval_vlmevalkit.sh): Convenience wrapper with sensible defaults (nanoVLM-460M-8kon MMStar). Accepts custom model and benchmark arguments, and forwards optional LLM-judge envvars for benchmarks like MMBench.
Smoke test (
eval/test_vlmevalkit.py): Covers text-only, image+text, and MCQ inference paths.Usage
Other changes
persisted.
Acknowledgments
This integration builds upon the excellent work of the https://github.com/open-compass/VLMEvalKit project from OpenCompass, which provides a unified framework for evaluating large vision-language models
across a wide range of multimodal benchmarks.
Note
This PR maintains nanoVLM's philosophy of simplicity and minimal dependencies while complementing the existing lmms-eval integration. VLMEvalKit and lmms-eval serve overlapping but distinct benchmark ecosystems, and having both lowers friction for researchers who prefer one over the other. The integration is designed to be entirely opt-in and non-intrusive to existing training and inference workflows.