Improve dataset card: Add main paper link, task categories, tags, GitHub link, project page, and sample usage
#1
by nielsr HF Staff - opened
1234567896 unmodified lines161718192021222324252627282930313212 unmodified lines4546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394---license: mittask_categories:- visual-question-answeringlanguage:- enpretty_name: MMPRnew_version: OpenGVLab/MMPR-v1.1dataset_info:6 unmodified linesdtype: string- name: rejecteddtype: stringsize_categories:- 1M<n<10Mconfigs:- config_name: defaultdata_files:- split: trainpath: "annotations.zip"---# MMPR[\[📂 GitHub\]](https://github.com/OpenGVLab/InternVL/tree/main/internvl_chat/shell/internvl2.0_mpo) [\[🆕 Blog\]](https://internvl.github.io/blog/2024-11-14-InternVL-2.0-MPO/) [\[📜 Paper\]](https://arxiv.org/abs/2411.10442) [\[📖 Documents\]](https://internvl.readthedocs.io/en/latest/internvl2.0/preference_optimization.html)***`2025/04/11:` We release a new version of MMPR (i.e., [MMPR-v1.2](https://huggingface.co/datasets/OpenGVLab/MMPR-v1.2)), which greatly enhances the overall performance of InternVL3.***12 unmodified linesThese results demonstrate the effectiveness of our preference optimization approach in enhancing multimodal reasoning capabilities.Additionally, on the POPE benchmark, our model exhibits a 1.2-point improvement over InterVL2-8B, demonstrating the effectiveness of the perception data contained in our MMPR dataset to mitigate hallucinations.Furthermore, our model also shows superior performance compared to the InternVL2-8B on complex VQA benchmarks, indicating that the general abilities of our model are also improved, benefiting from enhanced reasoning abilities and mitigated hallucinations.Please refer to our [paper](https://internvl.github.io/blog/2024-11-14-InternVL-2.0-MPO/) for more details.| Model Name | M3CoT | MathVista | MathVision MINI | MMVet (GPT4-Turbo) | LLaVA-Bench | POPE | CRPE | MMHalBench || ----------------------- | :---: | :-------: | :-------------: | :----------------: | :---------: | :---: | :---: | :--------: || Gemini-1.5-Pro | - | 63.9 | 19.2 | - | - | - | - | - || GPT-4o | 64.3 | 63.8 | 30.4 | 69.1 | 97.6 | 86.9 | 76.6 | 4.0 || GPT-4o-Mini | 61.9 | 52.4 | 27.3 | 66.9 | 95.4 | 85.1 | 73.1 | 3.6 || LLaVA-1.5-13B | 39.5 | 27.6 | 11.1 | 36.3 | 70.7 | 85.9 | 55.6 | 2.4 || Qwen2-VL-7B | 57.8 | 58.2 | 21.1 | 60.6 | 67.7 | 88.1 | 74.4 | 3.4 || MiniCPM-V-2-6-8B | 56.0 | 60.6 | 23.4 | 57.4 | 83.4 | 87.3 | 75.2 | 3.6 || LLaVA-OneVision-7B | 52.3 | 63.2 | 18.4 | 51.4 | 79.9 | 88.4 | 73.7 | 3.1 || InternVL2-26B | 58.2 | 59.4 | 23.4 | 62.1 | 92.3 | 88.0 | 75.6 | 3.7 || InternVL2-40B | 63.6 | 63.7 | 21.4 | 65.5 | 100.5 | 88.4 | 77.3 | 3.9 || InternVL2-76B | 65.4 | 67.5 | 23.7 | 65.7 | 99.3 | 89.0 | 77.8 | 3.8 || InternVL2-Pro | 65.6 | 66.3 | 18.8 | 69.4 | 99.5 | 88.2 | 77.6 | 3.7 || InternVL2-8B | 59.3 | 58.3 | 20.4 | 54.2 | 73.2 | 86.9 | 75.0 | 3.3 || InternVL2-8B-MPO (ours) | 79.2 | 67.0 | 25.7 | 56.2 | 76.7 | 88.1 | 75.4 | 3.5 |## UsagePlease refer to [our document](https://internvl.readthedocs.io/en/latest/internvl2.0/preference_optimization.html).## Data fields| Key | Description || ---------- | ----------------------------------- || `image` | Image path. || `question` | Input query. || `chosen` | Chosen response for the question. || `rejected` | Rejected response for the question. |## CitationIf you find this project useful in your research, please consider citing:```BibTeX@article{wang2024mpo,title={Enhancing the Reasoning Ability of Multimodal Large Language Models via Mixed Preference Optimization},author={Wang, Weiyun and Chen, Zhe and Wang, Wenhai and Cao, Yue and Liu, Yangzhou and Gao, Zhangwei and Zhu, Jinguo and Zhu, Xizhou and Lu, Lewei and Qiao, Yu and Dai, Jifeng},journal={arXiv preprint arXiv:2411.10442},year={2024}}@article{chen2023internvl,title={InternVL: Scaling up Vision Foundation Models and Aligning for Generic Visual-Linguistic Tasks},author={Chen, Zhe and Wu, Jiannan and Wang, Wenhai and Su, Weijie and Chen, Guo and Xing, Sen and Zhong, Muyan and Zhang, Qinglong and Zhu, Xizhou and Lu, Lewei and Li, Bin and Luo, Ping and Lu, Tong and Qiao, Yu and Dai, Jifeng},journal={arXiv preprint arXiv:2312.14238},year={2023}}@article{chen2024far,title={How Far Are We to GPT-4V? Closing the Gap to Commercial Multimodal Models with Open-Source Suites},author={Chen, Zhe and Wang, Weiyun and Tian, Hao and Ye, Shenglong and Gao, Zhangwei and Cui, Erfei and Tong, Wenwen and Hu, Kongzhi and Luo, Jiapeng and Ma, Zheng and others},journal={arXiv preprint arXiv:2404.16821},year={2024}}```12345678910111213141516171819206 unmodified lines27282930313233343536373839404142434412 unmodified lines57585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388---language:- enlicense: mitsize_categories:- 1M<n<10Mtask_categories:- visual-question-answering- image-text-to-texttags:- multimodal- mllm- reasoning- document-understanding- video-understanding- visual-grounding- preference-optimizationpretty_name: MMPRnew_version: OpenGVLab/MMPR-v1.1dataset_info:6 unmodified linesdtype: string- name: rejecteddtype: stringconfigs:- config_name: defaultdata_files:- split: trainpath: annotations.zip---# MMPRThis dataset, MMPR, is utilized in the paper [Expanding Performance Boundaries of Open-Source Multimodal Models with Model, Data, and Test-Time Scaling](https://huggingface.co/papers/2412.05271).[\[📜 Paper (InternVL 2.5)\]](https://huggingface.co/papers/2412.05271) | [\[📂 GitHub\]](https://github.com/OpenGVLab/InternVL) | [\[🚀 Demo (HF Space)\]](https://huggingface.co/spaces/OpenGVLab/InternVL) | [\[🆕 Blog (MPO)\]](https://internvl.github.io/blog/2024-11-14-InternVL-2.0-MPO/) | [\[📜 Paper (MPO)\]](https://arxiv.org/abs/2411.10442) | [\[📖 Documents\]](https://internvl.readthedocs.io/en/latest/internvl2.0/preference_optimization.html)***`2025/04/11:` We release a new version of MMPR (i.e., [MMPR-v1.2](https://huggingface.co/datasets/OpenGVLab/MMPR-v1.2)), which greatly enhances the overall performance of InternVL3.***12 unmodified linesThese results demonstrate the effectiveness of our preference optimization approach in enhancing multimodal reasoning capabilities.Additionally, on the POPE benchmark, our model exhibits a 1.2-point improvement over InterVL2-8B, demonstrating the effectiveness of the perception data contained in our MMPR dataset to mitigate hallucinations.Furthermore, our model also shows superior performance compared to the InternVL2-8B on complex VQA benchmarks, indicating that the general abilities of our model are also improved, benefiting from enhanced reasoning abilities and mitigated hallucinations.Please refer to our [paper](https://arxiv.org/abs/2411.10442) for more details.| Model Name | M3CoT | MathVista | MathVision MINI | MMVet (GPT4-Turbo) | LLaVA-Bench | POPE | CRPE | MMHalBench || :----------------------- | :---: | :-------: | :-------------: | :----------------: | :---------: | :---: | :---: | :--------: || Gemini-1.5-Pro | - | 63.9 | 19.2 | - | - | - | - | - || GPT-4o | 64.3 | 63.8 | 30.4 | 69.1 | 97.6 | 86.9 | 76.6 | 4.0 || GPT-4o-Mini | 61.9 | 52.4 | 27.3 | 66.9 | 95.4 | 85.1 | 73.1 | 3.6 || LLaVA-1.5-13B | 39.5 | 27.6 | 11.1 | 36.3 | 70.7 | 85.9 | 55.6 | 2.4 || Qwen2-VL-7B | 57.8 | 58.2 | 21.1 | 60.6 | 67.7 | 88.1 | 74.4 | 3.4 || MiniCPM-V-2-6-8B | 56.0 | 60.6 | 23.4 | 57.4 | 83.4 | 87.3 | 75.2 | 3.6 || LLaVA-OneVision-7B | 52.3 | 63.2 | 18.4 | 51.4 | 79.9 | 88.4 | 73.7 | 3.1 || InternVL2-26B | 58.2 | 59.4 | 23.4 | 62.1 | 92.3 | 88.0 | 75.6 | 3.7 || InternVL2-40B | 63.6 | 63.7 | 21.4 | 65.5 | 100.5 | 88.4 | 77.3 | 3.9 || InternVL2-76B | 65.4 | 67.5 | 23.7 | 65.7 | 99.3 | 89.0 | 77.8 | 3.8 || InternVL2-Pro | 65.6 | 66.3 | 18.8 | 69.4 | 99.5 | 88.2 | 77.6 | 3.7 || InternVL2-8B | 59.3 | 58.3 | 20.4 | 54.2 | 73.2 | 86.9 | 75.0 | 3.3 || InternVL2-8B-MPO (ours) | 79.2 | 67.0 | 25.7 | 56.2 | 76.7 | 88.1 | 75.4 | 3.5 |## UsagePlease refer to [our document](https://internvl.readthedocs.io/en/latest/internvl2.0/preference_optimization.html).## Sample Usage (using InternVL 2.5 for multimodal chat)Here, we take the smaller `OpenGVLab/InternVL2_5-8B` as an example:```pythonimport numpy as npimport torchimport torchvision.transforms as Tfrom decord import VideoReader, cpufrom PIL import Imagefrom torchvision.transforms.functional import InterpolationModefrom transformers import AutoModel, AutoTokenizerIMAGENET_MEAN = (0.485, 0.456, 0.406)IMAGENET_STD = (0.229, 0.224, 0.225)def build_transform(input_size):MEAN, STD = IMAGENET_MEAN, IMAGENET_STDtransform = T.Compose([T.Lambda(lambda img: img.convert('RGB') if img.mode != 'RGB' else img),T.Resize((input_size, input_size), interpolation=InterpolationMode.BICUBIC),T.ToTensor(),T.Normalize(mean=MEAN, std=STD)])return transformdef find_closest_aspect_ratio(aspect_ratio, target_ratios, width, height, image_size):best_ratio_diff = float('inf')best_ratio = (1, 1)area = width * heightfor ratio in target_ratios:target_aspect_ratio = ratio[0] / ratio[1]ratio_diff = abs(aspect_ratio - target_aspect_ratio)if ratio_diff < best_ratio_diff:best_ratio_diff = ratio_diffbest_ratio = ratioelif ratio_diff == best_ratio_diff:if area > 0.5 * image_size * image_size * ratio[0] * ratio[1]:best_ratio = ratioreturn best_ratiodef dynamic_preprocess(image, min_num=1, max_num=12, image_size=448, use_thumbnail=False):orig_width, orig_height = image.sizeaspect_ratio = orig_width / orig_height# calculate the existing image aspect ratiotarget_ratios = set((i, j) for n in range(min_num, max_num + 1) for i in range(1, n + 1) for j in range(1, n + 1) ifi * j <= max_num and i * j >= min_num)target_ratios = sorted(target_ratios, key=lambda x: x[0] * x[1])# find the closest aspect ratio to the targettarget_aspect_ratio = find_closest_aspect_ratio(aspect_ratio, target_ratios, orig_width, orig_height, image_size)# calculate the target width and heighttarget_width = image_size * target_aspect_ratio[0]target_height = image_size * target_aspect_ratio[1]blocks = target_aspect_ratio[0] * target_aspect_ratio[1]# resize the imageresized_img = image.resize((target_width, target_height))processed_images = []for i in range(blocks):box = ((i % (target_width // image_size)) * image_size,(i // (target_width // image_size)) * image_size,((i % (target_width // image_size)) + 1) * image_size,((i // (target_width // image_size)) + 1) * image_size)# split the imagesplit_img = resized_img.crop(box)processed_images.append(split_img)assert len(processed_images) == blocksif use_thumbnail and len(processed_images) != 1:thumbnail_img = image.resize((image_size, image_size))processed_images.append(thumbnail_img)return processed_imagesdef load_image(image_file, input_size=448, max_num=12):image = Image.open(image_file).convert('RGB')transform = build_transform(input_size=input_size)images = dynamic_preprocess(image, image_size=input_size, use_thumbnail=True, max_num=max_num)pixel_values = [transform(image) for image in images]pixel_values = torch.stack(pixel_values)return pixel_values# If you have an 80G A100 GPU, you can put the entire model on a single GPU.# Otherwise, you need to load a model using multiple GPUs, please refer to the `Multiple GPUs` section.path = 'OpenGVLab/InternVL2_5-8B'model = AutoModel.from_pretrained(path,torch_dtype=torch.bfloat16,low_cpu_mem_usage=True,trust_remote_code=True).eval().cuda()tokenizer = AutoTokenizer.from_pretrained(path, trust_remote_code=True, use_fast=False)# set the max number of tiles in `max_num`pixel_values = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()generation_config = dict(max_new_tokens=1024, do_sample=False)# pure-text conversation (纯文本对话)question = 'Hello, who are you?'response, history = model.chat(tokenizer, None, question, generation_config, history=None, return_history=True)print(f'User: {question}Assistant: {response}')question = 'Can you tell me a story?'response, history = model.chat(tokenizer, None, question, generation_config, history=history, return_history=True)print(f'User: {question}Assistant: {response}')# single-image single-round conversation (单图单轮对话)question = '<image>Please describe the image shortly.'response = model.chat(tokenizer, pixel_values, question, generation_config)print(f'User: {question}Assistant: {response}')# single-image multi-round conversation (单图多轮对话)question = '<image>Please describe the image in detail.'response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=None, return_history=True)print(f'User: {question}Assistant: {response}')question = 'Please write a poem according to the image.'response, history = model.chat(tokenizer, pixel_values, question, generation_config, history=history, return_history=True)print(f'User: {question}Assistant: {response}')# multi-image multi-round conversation, combined images (多图多轮对话,拼接图像)pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)question = '<image>Describe the two images in detail.'response, history = model.chat(tokenizer, pixel_values, question, generation_config,history=None, return_history=True)print(f'User: {question}Assistant: {response}')question = 'What are the similarities and differences between these two images.'response, history = model.chat(tokenizer, pixel_values, question, generation_config,history=history, return_history=True)print(f'User: {question}Assistant: {response}')# multi-image multi-round conversation, separate images (多图多轮对话,独立图像)pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]question = 'Image-1: <image>Image-2: <image>Describe the two images in detail.'response, history = model.chat(tokenizer, pixel_values, question, generation_config,num_patches_list=num_patches_list,history=None, return_history=True)print(f'User: {question}Assistant: {response}')question = 'What are the similarities and differences between these two images.'response, history = model.chat(tokenizer, pixel_values, question, generation_config,num_patches_list=num_patches_list,history=history, return_history=True)print(f'User: {question}Assistant: {response}')# batch inference, single image per sample (单图批处理)pixel_values1 = load_image('./examples/image1.jpg', max_num=12).to(torch.bfloat16).cuda()pixel_values2 = load_image('./examples/image2.jpg', max_num=12).to(torch.bfloat16).cuda()num_patches_list = [pixel_values1.size(0), pixel_values2.size(0)]pixel_values = torch.cat((pixel_values1, pixel_values2), dim=0)questions = ['<image>Describe the image in detail.'] * len(num_patches_list)responses = model.batch_chat(tokenizer, pixel_values,num_patches_list=num_patches_list,questions=questions,generation_config=generation_config)for question, response in zip(questions, responses):print(f'User: {question}Assistant: {response}')# video multi-round conversation (视频多轮对话)def get_index(bound, fps, max_frame, first_idx=0, num_segments=32):if bound:start, end = bound[0], bound[1]else:start, end = -100000, 100000start_idx = max(first_idx, round(start * fps))end_idx = min(round(end * fps), max_frame)seg_size = float(end_idx - start_idx) / num_segmentsframe_indices = np.array([int(start_idx + (seg_size / 2) + np.round(seg_size * idx))for idx in range(num_segments)])return frame_indicesdef load_video(video_path, bound=None, input_size=448, max_num=1, num_segments=32):vr = VideoReader(video_path, ctx=cpu(0), num_threads=1)max_frame = len(vr) - 1fps = float(vr.get_avg_fps())pixel_values_list, num_patches_list = [], []transform = build_transform(input_size=input_size)frame_indices = get_index(bound, fps, max_frame, first_idx=0, num_segments=num_segments)for frame_index in frame_indices:img = Image.fromarray(vr[frame_index].asnumpy()).convert('RGB')img = dynamic_preprocess(img, image_size=input_size, use_thumbnail=True, max_num=max_num)pixel_values = [transform(tile) for tile in img]pixel_values = torch.stack(pixel_values)num_patches_list.append(pixel_values.shape[0])pixel_values_list.append(pixel_values)pixel_values = torch.cat(pixel_values_list)return pixel_values, num_patches_listvideo_path = './examples/red-panda.mp4'pixel_values, num_patches_list = load_video(video_path, num_segments=8, max_num=1)pixel_values = pixel_values.to(torch.bfloat16).cuda()video_prefix = ''.join([f'Frame-{i+1}: <image>' for i in range(len(num_patches_list))])question = video_prefix + 'What is the red panda doing?'# Frame1: <image>Frame2: <image>...Frame8: <image>{question}response, history = model.chat(tokenizer, pixel_values, question, generation_config,num_patches_list=num_patches_list, history=None, return_history=True)print(f'User: {question}Assistant: {response}')question = 'Describe this video in detail.'response, history = model.chat(tokenizer, pixel_values, question, generation_config,num_patches_list=num_patches_list, history=history, return_history=True)print(f'User: {question}Assistant: {response}')```## Data fields| Key | Description || :---------- | :----------------------------------- || `image` | Image path. || `question` | Input query. || `chosen` | Chosen response for the question. || `rejected` | Rejected response for the question. |## CitationIf you find this project useful in your research, please consider citing:```BibTeX@article{wang2025internvl3_5,title={InternVL3.5: Advancing Open-Source Multimodal Models in Versatility, Reasoning, and Efficiency},author={Wang, Weiyun and Gao, Zhangwei and Gu, Lixin and Pu, Hengjun and Cui, Long and Wei, Xingguang and Liu, Zhaoyang and Jing, Linglin and Ye, Shenglong and Shao, Jie and others},journal={arXiv preprint arXiv:2508.18265},year={2025}}@article{zhu2025internvl3,title={Internvl3: Exploring advanced training and test-time recipes for open-source multimodal models},author={Zhu, Jinguo and Wang, Weiyun and Chen, Zhe and Liu, Zhaoyang and Ye, Shenglong and Gu, Lixin and Tian, Hao and Duan, Yuchen and Su, Weijie and Shao, Jie and others},journal={arXiv preprint arXiv:2504.10479},year={2025}}@article{chen2024expanding,title={Expanding Performance Boundaries of Open-Source Multimodal Models with Model, Data, and Test-Time Scaling},author={Chen, Zhe and Wang, Weiyun and Cao, Yue and Liu, Yangzhou and Gao, Zhangwei and Cui, Erfei and Zhu, Jinguo and Ye, Shenglong and Tian, Hao and Liu, Zhaoyang and others},journal={arXiv preprint arXiv:2412.05271},year={2024}}@article{wang2024mpo,title={Enhancing the Reasoning Ability of Multimodal Large Language Models via Mixed Preference Optimization},author={Wang, Weiyun and Chen, Zhe and Wang, Wenhai and Cao, Yue and Liu, Yangzhou and Gao, Zhangwei and Zhu, Jinguo and Zhu, Xizhou and Lu, Lewei and Qiao, Yu and Dai, Jifeng},journal={arXiv preprint arXiv:2411.10442},year={2024}}@article{gao2024mini,title={Mini-InternVL: a flexible-transfer pocket multi-modal model with 5\% parameters and 90\% performance},author={Gao, Zhangwei and Chen, Zhe and Cui, Erfei and Ren, Yiming and Wang, Weiyun and Zhu, Jinguo and Tian, Hao and Ye, Shenglong and He, Junjun and Zhu, Xizhou and others},journal={Visual Intelligence},volume={2},number={1},pages={1--17},year={2024},publisher={Springer}}@article{chen2024far,title={How far are we to gpt-4v? closing the gap to commercial multimodal models with open-source suites},author={Chen, Zhe and Wang, Weiyun and Tian, Hao and Ye, Shenglong and Gao, Zhangwei and Cui, Erfei and Tong, Wenwen and Hu, Kongzhi and Luo, Jiapeng and Ma, Zheng and others},journal={Science China Information Sciences},volume={67},number={12},pages={220101},year={2024},publisher={Springer}}@inproceedings{chen2024internvl,title={Internvl: Scaling up vision foundation models and aligning for generic visual-linguistic tasks},author={Chen, Zhe and Wu, Jiannan and Wang, Wenhai and Su, Weijie and Chen, Guo and Xing, Sen and Zhong, Muyan and Zhang, Qinglong and Zhu, Xizhou and Lu, Lewei and others},booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},pages={24185--24198},year={2024}}```## AcknowledgementInternVL is built with reference to the code of the following projects: [OpenAI CLIP](https://github.com/openai/CLIP), [Open CLIP](https://github.com/mlfoundations/open_clip), [CLIP Benchmark](https://github.com/LAION-AI/CLIP_benchmark), [EVA](https://github.com/baaivision/EVA/tree/master), [InternImage](https://github.com/OpenGVLab/InternImage), [ViT-Adapter](https://github.com/czczup/ViT-Adapter), [MMSegmentation](https://github.com/open-mmlab/mmsegmentation), [Transformers](https://github.com/huggingface/transformers), [DINOv2](https://github.com/facebookresearch/dinov2), [BLIP-2](https://github.com/salesforce/LAVIS/tree/main/projects/blip2), [Qwen-VL](https://github.com/QwenLM/Qwen-VL/tree/master/eval_mm), and [LLaVA-1.5](https://github.com/haotian-liu/LLaVA). Thanks for their awesome work!
README.md+329-35