Skip to content

Open-source evaluation toolkit of large vision-language models (LVLMs), support GPT-4v, Gemini, QwenVLPlus, 30+ HF models, 15+ benchmarks

Notifications You must be signed in to change notification settings

huggingface/VLMEvalKit

 
 

Repository files navigation

LOGO

A Toolkit for Evaluating Large Vision-Language Models.

VLMEvalKit (the python package name is vlmeval) is an open-source evaluation toolkit of large vision-language models (LVLMs). It enables one-command evaluation of LVLMs on various benchmarks, without the heavy workload of data preparation under multiple repositories. In VLMEvalKit, we adopt generation-based evaluation for all LVLMs (obtain the answer via generate / chat interface), and provide the evaluation results obtained with both exact matching and LLM-based answer extraction.

🆕 News

  • [2024-03-28] Now you can use local OpenSource LLMs as the answer extractor or judge (see #132 for details). Great thanks to StarCycle 🔥🔥🔥
  • [2024-03-22] We have supported LLaVA-NeXT 🔥🔥🔥
  • [2024-03-21] We have supported DeepSeek-VL 🔥🔥🔥
  • [2024-03-20] We have supported users to use a .env file to manage all environment variables used in VLMEvalKit, see Quickstart for more details
  • [2024-03-17] We have added an API wrapper for Step-1V 🔥🔥🔥
  • [2024-03-15] We have updated the LLaVA class be compatible with the latest version of LLaVA. All LLaVA series models have been re-evaluated with temperature=0, and the new results have been updated to the leaderboard 🔥🔥🔥
  • [2024-02-27] We have fixed the evaluation results of Yi-VL-34B, check the updated results here 🔥🔥🔥
  • [2024-02-25] We have supported OCRBench🔥🔥🔥
  • [2024-02-24] We have supported InternVL-Chat Series. The models achieve over 80% Top-1 accuracies on MMBench v1.0 [Blog] 🔥🔥🔥
  • [2024-02-07] We have supported two new models: MiniCPM-V and OmniLMM-12B 🔥🔥🔥

📊 Datasets, Models, and Evaluation Results

The performance numbers on our official multi-modal leaderboards can be downloaded from here!

OpenCompass Multi-Modal Leaderboard: Download All DETAILED Results.

Supported Dataset

Dataset Dataset Names (for run.py) Task Inference Evaluation Results
MMBench Series:
MMBench, MMBench-CN, CCBench
MMBench-DEV-[EN/CN]
MMBench-TEST-[EN/CN]
CCBench
Multi-choice MMBench Leaderboard
MME MME Yes or No Open_VLM_Leaderboard
SEEDBench_IMG SEEDBench_IMG Multi-choice Open_VLM_Leaderboard
MM-Vet MMVet VQA Open_VLM_Leaderboard
MMMU MMMU_DEV_VAL/MMMU_TEST Multi-choice Open_VLM_Leaderboard
MathVista MathVista_MINI VQA Open_VLM_Leaderboard
ScienceQA_IMG ScienceQA_[VAL/TEST] Multi-choice Open_VLM_Leaderboard
COCO Caption COCO_VAL Caption Open_VLM_Leaderboard
HallusionBench HallusionBench Yes or No Open_VLM_Leaderboard
OCRVQA OCRVQA_[TESTCORE/TEST] VQA TBD.
TextVQA TextVQA_VAL VQA TBD.
ChartQA ChartQA_TEST VQA TBD.
AI2D AI2D_TEST Multi-choice Open_VLM_Leaderboard
LLaVABench LLaVABench VQA Open_VLM_Leaderboard
DocVQA DocVQA_VAL VQA TBD.
OCRBench OCRBench VQA Open_VLM_Leaderboard
Core-MM CORE_MM VQA N/A

VLMEvalKit will use an judge LLM to extract answer from the output if you set the key, otherwise it uses the exact matching mode (find "Yes", "No", "A", "B", "C"... in the output strings). The exact matching can only be applied to the Yes-or-No tasks and the Multi-choice tasks.

There are some known issues with VQA tasks like OCRVQA, TextVQA, ChartQA, etc. We will fix them asap.

Supported API Models

GPT-4-Vision-Preview🎞️🚅 GeminiProVision🎞️🚅 QwenVLPlus🎞️🚅 QwenVLMax🎞️🚅 Step-1V🎞️🚅

Supported PyTorch / HF Models

IDEFICS-[9B/80B]-Instruct🎞️🚅 InstructBLIP-[7B/13B] LLaVA-[v1-7B/v1.5-7B/v1.5-13B] MiniGPT-4-[v1-7B/v1-13B/v2-7B]
mPLUG-Owl2🎞️ OpenFlamingo-v2🎞️ PandaGPT-13B Qwen-VL🎞️🚅, Qwen-VL-Chat🎞️🚅
VisualGLM-6B🚅 InternLM-XComposer-7B🚅🎞️ ShareGPT4V-[7B/13B]🚅 TransCore-M
LLaVA (XTuner)🚅 CogVLM-17B-Chat🚅 SharedCaptioner🚅 CogVLM-Grounding-Generalist🚅
Monkey🚅 EMU2 / EMU2-Chat🚅🎞️ Yi-VL-[6B/34B] MMAlaya🚅
InternLM-XComposer2-7B🚅🎞️ MiniCPM-V🚅 OmniLMM-12B InternVL-Chat Series🚅
DeepSeek-VL🎞️ LLaVA-NeXT🚅

🎞️: Support multiple images as inputs, via the interleave_generate interface.

🚅: Model can be used without any additional configuration / operation.

**Transformers Version Recommendation: **

Note that some VLMs may not be able to run under certain transformer versions, we recommend the following settings to evaluate each VLM:

  • Please use transformers==4.33.0 for: Qwen series, Monkey series, InternVL series, InternLM-XComposer Series, mPLUG-Owl2, OpenFlamingo v2, IDEFICS series, VisualGLM, MMAlaya, SharedCaptioner, MiniGPT-4 series, InstructBLIP series, PandaGPT.
  • Please use transformers==4.37.0 for: LLaVA series, ShareGPT4V series, TransCore-M, LLaVA (XTuner), CogVLM Series, EMU2 Series, Yi-VL Series, MiniCPM-V, OmniLMM-12B, DeepSeek-VL series.
  • Please use transformers==4.39.0 for: LLaVA-Next series.
# Demo
from vlmeval.config import supported_VLM
model = supported_VLM['idefics_9b_instruct']()
# Forward Single Image
ret = model.generate('assets/apple.jpg', 'What is in this image?')
print(ret)  # The image features a red apple with a leaf on it.
# Forward Multiple Images
ret = model.interleave_generate(['assets/apple.jpg', 'assets/apple.jpg', 'How many apples are there in the provided images? '])
print(ret)  # There are two apples in the provided images.

🏗️ QuickStart

See QuickStart for a quick start guide.

🛠️ Development Guide

To develop custom benchmarks, VLMs, or simply contribute other codes to VLMEvalKit, please refer to Development_Guide.

🎯 The Goal of VLMEvalKit

The codebase is designed to:

  1. Provide an easy-to-use, opensource evaluation toolkit to make it convenient for researchers & developers to evaluate existing LVLMs and make evaluation results easy to reproduce.
  2. Make it easy for VLM developers to evaluate their own models. To evaluate the VLM on multiple supported benchmarks, one just need to implement a single generate function, all other workloads (data downloading, data preprocessing, prediction inference, metric calculation) are handled by the codebase.

The codebase is not designed to:

  1. Reproduce the exact accuracy number reported in the original papers of all 3rd party benchmarks. The reason can be two-fold:
    1. VLMEvalKit uses generation-based evaluation for all VLMs (and optionally with LLM-based answer extraction). Meanwhile, some benchmarks may use different approaches (SEEDBench uses PPL-based evaluation, eg.). For those benchmarks, we compare both scores in the corresponding result. We encourage developers to support other evaluation paradigms in the codebase.
    2. By default, we use the same prompt template for all VLMs to evaluate on a benchmark. Meanwhile, some VLMs may have their specific prompt templates (some may not covered by the codebase at this time). We encourage VLM developers to implement their own prompt template in VLMEvalKit, if that is not covered currently. That will help to improve the reproducibility.

🖊️ Citation

If you use VLMEvalKit in your research or wish to refer to the published OpenSource evaluation results, please use the following BibTeX entry and the BibTex entry corresponding to the specific VLM / benchmark you used.

@misc{2023opencompass,
    title={OpenCompass: A Universal Evaluation Platform for Foundation Models},
    author={OpenCompass Contributors},
    howpublished = {\url{https://github.com/open-compass/opencompass}},
    year={2023}
}

💻 Other Projects in OpenCompass

  • opencompass: An LLM evaluation platform, supporting a wide range of models (LLaMA, LLaMa2, ChatGLM2, ChatGPT, Claude, etc) over 50+ datasets.
  • MMBench: Official Repo of "MMBench: Is Your Multi-modal Model an All-around Player?"
  • BotChat: Evaluating LLMs' multi-round chatting capability.
  • LawBench: Benchmarking Legal Knowledge of Large Language Models.

About

Open-source evaluation toolkit of large vision-language models (LVLMs), support GPT-4v, Gemini, QwenVLPlus, 30+ HF models, 15+ benchmarks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.3%
  • Jupyter Notebook 5.6%
  • Shell 0.1%