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)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenGVLab/InternVL2-2B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- 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
Commit History
-
Fix task name (#2)
Verified signature- Fix task name (d98fd73b9755e90bb81bb7134d994c6ed7d36b36) Co-authored-by: Merve Noyan <merve@users.noreply.huggingface.co>810c831
-
Upload folder using huggingface_hub
Verified signature8bd275a -
Upload folder using huggingface_hub
Verified signature4313f1b
-
Upload folder using huggingface_hub
Verified signaturef92d66e -
Upload folder using huggingface_hub
Verified signature1d83c94 -
Upload folder using huggingface_hub
Verified signatureb6dd0e1 -
Upload folder using huggingface_hub
Verified signaturea514d8f -
Upload folder using huggingface_hub
Verified signaturee152100 -
Upload folder using huggingface_hub
Verified signaturea603b55 -
Upload folder using huggingface_hub
Verified signature96ba68b
-
Upload folder using huggingface_hub
Verified signature89d8bc6 -
Upload folder using huggingface_hub
Verified signature5868ee9 -
Upload folder using huggingface_hub
Verified signature53d787f -
Upload folder using huggingface_hub
Verified signature45e2af7 -
Upload folder using huggingface_hub
Verified signatureabc9e34 -
Upload folder using huggingface_hub
Verified signature517b085
-
Upload folder using huggingface_hub
Verified signature8e0aa82 -
Upload folder using huggingface_hub
Verified signature568064e -
Upload folder using huggingface_hub
Verified signatureaeae3bd -
Upload folder using huggingface_hub
Verified signaturef654ba4 -
Upload folder using huggingface_hub
Verified signature595cd2e -
Upload folder using huggingface_hub
Verified signaturee34e04c -
Upload folder using huggingface_hub
Verified signatureedbd349 -
Upload folder using huggingface_hub
Verified signatureb66e760 -
Upload folder using huggingface_hub
Verified signature2190e2a -
Upload folder using huggingface_hub
Verified signatureea385fe -
Upload folder using huggingface_hub
Verified signature41d39c4 -
Upload folder using huggingface_hub
Verified signature6eb050d -
Upload folder using huggingface_hub
Verified signaturefa21469 -
Upload folder using huggingface_hub
Verified signature87cab3c -
Upload folder using huggingface_hub
Verified signaturecca2a32 -
Upload folder using huggingface_hub
Verified signature75397cd -
Upload folder using huggingface_hub
Verified signature34544cd -
Upload folder using huggingface_hub
Verified signature9816b63 -
Update README.md
Verified signature555b2dc -
Update README.md
Verified signature9f753db -
Update README.md
Verified signaturec4c2a9a
-
Update README.md
Verified signature3f4a31b -
Update README.md
Verified signature3e5c586 -
Upload folder using huggingface_hub
Verified signature02eb177
-
initial commit
Verified signaturec84378d