Image-Text-to-Text
Transformers
Safetensors
multilingual
internvl_chat
feature-extraction
internvl
custom_code
conversational
Instructions to use OpenGVLab/InternVL2-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL2-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL2-2B", 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-2B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use OpenGVLab/InternVL2-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL2-2B" # 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-2B", "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-2B
- SGLang
How to use OpenGVLab/InternVL2-2B 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-2B" \ --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-2B", "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-2B" \ --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-2B", "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-2B with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL2-2B
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -19,26 +19,26 @@ InternVL 2.0 is trained with an 8k context window and utilizes training data con
|
|
| 19 |
|
| 20 |
## Performance
|
| 21 |
|
| 22 |
-
|
|
| 23 |
-
| :-----------------------: | :----------: | :----------: | :------------------: | :----------: |
|
| 24 |
-
|
|
| 25 |
-
|
|
| 26 |
-
|
|
| 27 |
-
|
|
| 28 |
-
|
|
| 29 |
-
|
|
| 30 |
-
|
|
| 31 |
-
|
|
| 32 |
-
|
|
| 33 |
-
|
|
| 34 |
-
|
|
| 35 |
-
|
|
| 36 |
-
|
|
| 37 |
-
|
|
| 38 |
-
|
|
| 39 |
-
|
|
| 40 |
-
|
|
| 41 |
-
| MathVista<sub>
|
| 42 |
|
| 43 |
- We simultaneously use InternVL and VLMEvalKit repositories for model evaluation. Specifically, the results reported for DocVQA, ChartQA, InfoVQA, TextVQA, MME, AI2D, MMBench, CCBench, MMVet, and SEED-Image were tested using the InternVL repository. MMMU, OCRBench, RealWorldQA, HallBench, and MathVista were evaluated using the VLMEvalKit.
|
| 44 |
|
|
|
|
| 19 |
|
| 20 |
## Performance
|
| 21 |
|
| 22 |
+
| Benchmark | PaliGemma-3B | Phi-3-Vision | Mini-InternVL-2B-1.5 | InternVL2-2B |
|
| 23 |
+
| :--------------------------: | :----------: | :----------: | :------------------: | :----------: |
|
| 24 |
+
| Model Size | 2.9B | 4.2B | 2.2B | 2.2B |
|
| 25 |
+
| | | | | |
|
| 26 |
+
| DocVQA<sub>test</sub> | - | - | 85.0 | 86.9 |
|
| 27 |
+
| ChartQA<sub>test</sub> | - | 81.4 | 74.8 | 76.2 |
|
| 28 |
+
| InfoVQA<sub>test</sub> | - | - | 55.4 | 58.9 |
|
| 29 |
+
| TextVQA<sub>val</sub> | 68.1 | 70.9 | 70.5 | 73.4 |
|
| 30 |
+
| OCRBench | 614 | 639 | 654 | 784 |
|
| 31 |
+
| MME<sub>sum</sub> | 1686.1 | 1508.0 | 1901.5 | 1876.8 |
|
| 32 |
+
| RealWorldQA | 55.2 | 58.8 | 57.9 | 57.3 |
|
| 33 |
+
| AI2D<sub>test</sub> | 68.3 | 76.7 | 69.8 | 74.1 |
|
| 34 |
+
| MMMU<sub>val</sub> | 34.9 | 40.4 | 34.6 | 34.3 |
|
| 35 |
+
| MMBench-EN<sub>test</sub> | 71.0 | 73.6 | 70.9 | 73.2 |
|
| 36 |
+
| MMBench-CN<sub>test</sub> | 63.6 | - | 66.2 | 70.9 |
|
| 37 |
+
| CCBench<sub>dev</sub> | 29.6 | 24.1 | 63.5 | 74.7 |
|
| 38 |
+
| MMVet<sub>GPT-4-0613</sub> | 33.1 | - | 39.3 | 44.6 |
|
| 39 |
+
| SEED-Image | 69.6 | 70.9 | 69.8 | 71.6 |
|
| 40 |
+
| HallBench<sub>avg</sub> | 32.2 | 39.0 | 37.5 | 37.9 |
|
| 41 |
+
| MathVista<sub>testmini</sub> | 28.7 | 44.5 | 41.1 | 46.3 |
|
| 42 |
|
| 43 |
- We simultaneously use InternVL and VLMEvalKit repositories for model evaluation. Specifically, the results reported for DocVQA, ChartQA, InfoVQA, TextVQA, MME, AI2D, MMBench, CCBench, MMVet, and SEED-Image were tested using the InternVL repository. MMMU, OCRBench, RealWorldQA, HallBench, and MathVista were evaluated using the VLMEvalKit.
|
| 44 |
|