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)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenGVLab/InternVL2-26B", trust_remote_code=True, dtype="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
HF Demo broken
Hi, HF Demo broken its not working
Hello, thank you for your attention. For some special reason, we will restore the demo in the next few days.
@czczup I'm confused I did some visual answering with the 26b model and it performs very badly in that. The only model that passes that question are Gemini 1.5 pro/flash, gpt4-o, and Claude.
Then how InternVL2-26B was evaluated that it outperforms gpt4-v?
Thanks for your feedback. Could you give me some examples to reproduce this issue?
@czczup It was visual answering task, Can you tell me how to prompt this model to get the most accurate answer with human-like reasoning skills?
@czczup I'm confused I did some visual answering with the 26b model and it performs very badly in that. The only model that passes that question are Gemini 1.5 pro/flash, gpt4-o, and Claude.
Then how InternVL2-26B was evaluated that it outperforms gpt4-v?
Thank you for this question.
We've achieved comparable performance to GPT-4V in many single-turn QA benchmarks. However, these results don't reflect other capabilities such as multi-turn conversation and instruction-following. (Of course, I think OpenAI also hasn't put their utmost effort into improving these academic benchmarks.)
For example, on the recently released ConvBench, which evaluates multi-turn dialogue, there is still a significant gap between our model and GPT-4V. This is mainly because most of our training data is sourced from open data. Despite our best efforts in data cleaning, the quality of our data is not as high as that of commercial companies.
As a non-profit research organization, OpenGVLab does not have the same funding as OpenAI for manually annotated data. Nevertheless, we still hope to do our best to improve the performance of open-source MLLMs.
We have recently open-sourced a 78B version, available at https://huggingface.co/OpenGVLab/InternVL2-Llama3-76B. This version achieves performance similar to InternVL2-Pro on most metrics. InternVL2-Pro is still undergoing our internal lab approval process, so it might take some time before it's available.
@czczup The 78B version also didn't perform too well it can't get the answer that I get with GPT-4o, Gemini.
Thoughts?