Image-Text-to-Text
Transformers
Safetensors
multilingual
internvl_chat
feature-extraction
internvl
custom_code
conversational
Instructions to use OpenGVLab/InternVL2-26B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL2-26B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL2-26B", 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenGVLab/InternVL2-26B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenGVLab/InternVL2-26B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL2-26B" # 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-26B", "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-26B
- SGLang
How to use OpenGVLab/InternVL2-26B 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-26B" \ --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-26B", "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-26B" \ --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-26B", "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-26B with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL2-26B
Upload folder using huggingface_hub
Browse files26 unmodified lines27282930313233343536373839404142434445463031323334353637383940414243444546474849213 unmodified lines26326426526626726826927027127227327427527627727827928028128228328428526626726826927027127227327427527627727827928028128228328428528628728828926 unmodified lines| :--------------------------: | :-------------: | :------------: | :----------------: | :-----------: || Model Size | - | - | 25.5B | 25.5B || | | | | || DocVQA<sub>test</sub> | 87.2 | 86.5 | 90.9 | || ChartQA<sub>test</sub> | 78.1 | 81.3 | 83.8 | || InfoVQA<sub>test</sub> | - | 72.7 | 72.5 | || TextVQA<sub>val</sub> | - | 73.5 | 80.6 | || OCRBench | 678 | 754 | 724 | || MME<sub>sum</sub> | 2070.2 | - | 2187.8 | || RealWorldQA | 68.0 | 67.5 | 66.0 | || AI2D<sub>test</sub> | 89.4 | 80.3 | 80.7 | || MMMU<sub>val</sub> | 63.1 | 58.5 | 45.2 | || MMBench-EN<sub>test</sub> | 81.0 | 73.9 | 82.2 | || MMBench-CN<sub>test</sub> | 80.2 | 73.8 | 82.0 | || CCBench<sub>dev</sub> | 57.3 | 28.4 | 69.8 | || MMVet<sub>GPT-4-0613</sub> | - | - | 62.8 | || MMVet<sub>GPT-4-Turbo</sub> | 67.5 | 64.0 | 55.4 | || SEED-Image | - | - | 76.0 | || HallBench<sub>avg</sub> | 43.9 | 45.6 | 49.3 | || MathVista<sub>testmini</sub> | 58.1 | 57.7 | 53.5 | || DocVQA<sub>test</sub> | 87.2 | 86.5 | 90.9 | 92.9 || ChartQA<sub>test</sub> | 78.1 | 81.3 | 83.8 | 84.9 || InfoVQA<sub>test</sub> | - | 72.7 | 72.5 | 75.9 || TextVQA<sub>val</sub> | - | 73.5 | 80.6 | 82.3 || OCRBench | 678 | 754 | 724 | 825 || MME<sub>sum</sub> | 2070.2 | 2110.6 | 2187.8 | 2260.7 || RealWorldQA | 68.0 | 67.5 | 66.0 | 68.3 || AI2D<sub>test</sub> | 89.4 | 80.3 | 80.7 | 84.5 || MMMU<sub>val</sub> | 63.1 | 58.5 | 45.2 | 48.3 || MMBench-EN<sub>test</sub> | 81.0 | 73.9 | 82.2 | 83.4 || MMBench-CN<sub>test</sub> | 80.2 | 73.8 | 82.0 | 82.0 || CCBench<sub>dev</sub> | 57.3 | 28.4 | 69.8 | 73.5 || MMVet<sub>GPT-4-0613</sub> | - | - | 62.8 | 64.2 || MMVet<sub>GPT-4-Turbo</sub> | 67.5 | 64.0 | 55.4 | 62.1 || SEED-Image | - | - | 76.0 | 76.8 || HallBench<sub>avg</sub> | 43.9 | 45.6 | 49.3 | 50.7 || MathVista<sub>testmini</sub> | 58.1 | 57.7 | 53.5 | 59.4 |
- 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.
213 unmodified lines
## 性能测试
| 评测数据集 | MiniCPM-Llama3-V-2_5 | InternVL-Chat-V1-5 | InternVL2-26B || :--------------------------: | :------------------: | :----------------: | :-----------: || 模型大小 | 8.5B | 25.5B | 25.5B || | | | || DocVQA<sub>test</sub> | 84.8 | 90.9 | || ChartQA<sub>test</sub> | - | 83.8 | || InfoVQA<sub>test</sub> | - | 72.5 | || TextVQA<sub>val</sub> | 76.6 | 80.6 | || OCRBench | 725 | 724 | || MME<sub>sum</sub> | 2024.6 | 2187.8 | || RealWorldQA | 63.5 | 66.0 | || AI2D<sub>test</sub> | 78.4 | 80.7 | || MMMU<sub>val</sub> | 45.8 | 45.2 | || MMBench-EN<sub>test</sub> | 77.2 | 82.2 | || MMBench-CN<sub>test</sub> | 74.2 | 82.0 | || CCBench<sub>dev</sub> | 45.9 | 69.8 | || MMVet<sub>GPT-4-0613</sub> | - | 62.8 | || SEED-Image | 72.3 | 76.0 | || HallBench<sub>avg</sub> | 42.4 | 49.3 | || MathVista<sub>testmini</sub> | 54.3 | 53.5 | || 评测数据集 | GPT-4T-20240409 | Gemini-1.5-Pro | InternVL-Chat-V1-5 | InternVL2-26B || :--------------------------: | :-------------: | :------------: | :----------------: | :-----------: || 模型大小 | - | - | 25.5B | 25.5B || | | | | || DocVQA<sub>test</sub> | 87.2 | 86.5 | 90.9 | 92.9 || ChartQA<sub>test</sub> | 78.1 | 81.3 | 83.8 | 84.9 || InfoVQA<sub>test</sub> | - | 72.7 | 72.5 | 75.9 || TextVQA<sub>val</sub> | - | 73.5 | 80.6 | 82.3 || OCRBench | 678 | 754 | 724 | 825 || MME<sub>sum</sub> | 2070.2 | 2110.6 | 2187.8 | 2260.7 || RealWorldQA | 68.0 | 67.5 | 66.0 | 68.3 || AI2D<sub>test</sub> | 89.4 | 80.3 | 80.7 | 84.5 || MMMU<sub>val</sub> | 63.1 | 58.5 | 45.2 | 48.3 || MMBench-EN<sub>test</sub> | 81.0 | 73.9 | 82.2 | 83.4 || MMBench-CN<sub>test</sub> | 80.2 | 73.8 | 82.0 | 82.0 || CCBench<sub>dev</sub> | 57.3 | 28.4 | 69.8 | 73.5 || MMVet<sub>GPT-4-0613</sub> | - | - | 62.8 | 64.2 || MMVet<sub>GPT-4-Turbo</sub> | 67.5 | 64.0 | 55.4 | 62.1 || SEED-Image | - | - | 76.0 | 76.8 || HallBench<sub>avg</sub> | 43.9 | 45.6 | 49.3 | 50.7 || MathVista<sub>testmini</sub> | 58.1 | 57.7 | 53.5 | 59.4 |
- 我们同时使用 InternVL 和 VLMEvalKit 仓库进行模型评估。具体来说,DocVQA、ChartQA、InfoVQA、TextVQA、MME、AI2D、MMBench、CCBench、MMVet 和 SEED-Image 的结果是使用 InternVL 仓库测试的。MMMU、OCRBench、RealWorldQA、HallBench 和 MathVista 是使用 VLMEvalKit 进行评估的。
README.md+38-37