Image-Text-to-Text
Transformers
Safetensors
multilingual
internvl_chat
feature-extraction
internvl
vision
custom_code
reasoning
multimodal-reasoning
conversational
Instructions to use OpenGVLab/InternVL2-8B-MPO with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL2-8B-MPO with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL2-8B-MPO", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenGVLab/InternVL2-8B-MPO", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use OpenGVLab/InternVL2-8B-MPO with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL2-8B-MPO" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/InternVL2-8B-MPO", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/OpenGVLab/InternVL2-8B-MPO
- SGLang
How to use OpenGVLab/InternVL2-8B-MPO with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "OpenGVLab/InternVL2-8B-MPO" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/InternVL2-8B-MPO", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "OpenGVLab/InternVL2-8B-MPO" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/InternVL2-8B-MPO", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use OpenGVLab/InternVL2-8B-MPO with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL2-8B-MPO
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -16,24 +16,20 @@ tags:
|
|
| 16 |
---
|
| 17 |
# InternVL2-8B-MPO
|
| 18 |
|
| 19 |
-
[\[๐ GitHub\]](https://github.com/OpenGVLab/InternVL) [\[๐ Blog\]](https://internvl.github.io/blog/2024-11-14-InternVL-2.0-MPO/) [\[๐ Paper\]](https://internvl.github.io/blog/2024-11-14-InternVL-2.0-MPO/) [\[๐ Documents\]](https://internvl.readthedocs.io/en/latest/internvl2.0/preference_optimization.html)
|
| 20 |
|
| 21 |
[ๅๆข่ณไธญๆ็](#็ฎไป)
|
| 22 |
|
| 23 |
-
 generally follow a training process involving pre-training and supervised fine-tuning. However, these models suffer from distribution shifts, which limit their multimodal reasoning, particularly in the Chain-of-Thought (CoT) performance.
|
| 28 |
|
| 29 |
-
To address this, we introduce a preference optimization (PO) process to enhance the multimodal reasoning capabilities of MLLMs.
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
and (2) on the model side, we explore integrating PO with MLLMs, developing a simple yet effective method, termed Mixed Preference Optimization (MPO), that boosts multimodal CoT performance.
|
| 33 |
|
| 34 |
-
Our approach demonstrates improved performance across multiple benchmarks, particularly in multimodal reasoning tasks.
|
| 35 |
-
Notably, our model, [InternVL2-8B-MPO](https://huggingface.co/OpenGVLab/InternVL2-8B), achieves an accuracy of 67.0 on MathVista, outperforming InternVL2-8B by 8.7 points and achieving performance comparable to the 10$\times$ larger InternVL2-76B.
|
| 36 |
-
We hope this study could inspire further advancements in MLLMs.
|
| 37 |
|
| 38 |
## Model Details
|
| 39 |
|
|
|
|
| 16 |
---
|
| 17 |
# InternVL2-8B-MPO
|
| 18 |
|
| 19 |
+
[\[๐ 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://internvl.github.io/blog/2024-11-14-InternVL-2.0-MPO/) [\[๐ Documents\]](https://internvl.readthedocs.io/en/latest/internvl2.0/preference_optimization.html)
|
| 20 |
|
| 21 |
[ๅๆข่ณไธญๆ็](#็ฎไป)
|
| 22 |
|
| 23 |
+

|
| 24 |
|
| 25 |
## Introduction
|
| 26 |
|
| 27 |
Existing open-source multimodal large language models (MLLMs) generally follow a training process involving pre-training and supervised fine-tuning. However, these models suffer from distribution shifts, which limit their multimodal reasoning, particularly in the Chain-of-Thought (CoT) performance.
|
| 28 |
|
| 29 |
+
To address this, we introduce a preference optimization (PO) process to enhance the multimodal reasoning capabilities of MLLMs. Specifically, (1) on the data side, we design an automated preference data construction pipeline to create [MMPR](https://huggingface.co/datasets/OpenGVLab/MMPR), a high-quality, large-scale multimodal reasoning preference dataset. and (2) on the model side, we explore integrating PO with MLLMs, developing a simple yet effective method, termed Mixed Preference Optimization (MPO), which boosts multimodal CoT performance.
|
| 30 |
+
|
| 31 |
+
Our approach demonstrates improved performance across multiple benchmarks, particularly in multimodal reasoning tasks. Notably, our model, [InternVL2-8B-MPO](https://huggingface.co/OpenGVLab/InternVL2-8B), achieves an accuracy of 67.0 on MathVista, outperforming InternVL2-8B by 8.7 points and achieving performance comparable to the 10$\times$ larger InternVL2-76B. We hope this study could inspire further advancements in MLLMs.
|
|
|
|
| 32 |
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
## Model Details
|
| 35 |
|