Image-Text-to-Text
Transformers
Safetensors
multilingual
internvl_chat
feature-extraction
internvl
custom_code
conversational
Instructions to use OpenGVLab/InternVL2-40B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL2-40B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL2-40B", 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-40B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenGVLab/InternVL2-40B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL2-40B" # 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-40B", "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-40B
- SGLang
How to use OpenGVLab/InternVL2-40B 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-40B" \ --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-40B", "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-40B" \ --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-40B", "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-40B with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL2-40B
Commit History
-
Add supports_gradient_checkpointing
Verified signature5b8643b
-
Fix device_map
Verified signature8540fe2
-
Update README.md
Verified signature87411dc
-
Update README.md
Verified signature91a952d
-
Apply Github PR #127 to all HF models
Verified signaturee7d90da -
Update README.md
Verified signature79c0c57
-
Update README.md
Verified signaturefc807c9
-
fix compatibility issue for transformers 4.46+
Verified signature9a9ef7c
-
fix compatibility issue for transformers 4.46+
Verified signature46bbe53 -
fix compatibility issue for transformers 4.46+
Verified signaturef27f63c
-
Upload folder using huggingface_hub
Verified signaturebac0f9d
-
Upload folder using huggingface_hub
Verified signatureb52a031 -
Upload folder using huggingface_hub
Verified signature23351eb -
Upload folder using huggingface_hub
Verified signaturee2d18c0 -
Upload folder using huggingface_hub
Verified signature70a3c2a -
Upload folder using huggingface_hub
Verified signature9d8a071
-
Upload folder using huggingface_hub
Verified signature3bd2608 -
Upload folder using huggingface_hub
Verified signature53c4ea2 -
Upload folder using huggingface_hub
Verified signaturefcae3bb
-
Delete internvl_v2.zip
Verified signature725a120 -
Upload folder using huggingface_hub
Verified signature1da47c8
-
Upload internvl_v2.zip with huggingface_hub
Verified signature3a3da7e
-
Upload folder using huggingface_hub
Verified signatureb9cd80e
-
Upload folder using huggingface_hub
Verified signature00b90e0 -
Upload folder using huggingface_hub
Verified signature9669ae1
-
Upload folder using huggingface_hub
Verified signature17a1cb6 -
Upload folder using huggingface_hub
Verified signature33ddb3c
-
Upload folder using huggingface_hub
Verified signature11fbba7
-
Upload folder using huggingface_hub
Verified signature4a92d0a
-
Upload folder using huggingface_hub
Verified signature50905da -
Upload folder using huggingface_hub
Verified signatured8e8d88
-
Upload folder using huggingface_hub
Verified signature14e0ba5
-
Upload folder using huggingface_hub
Verified signature3a095fd
-
Upload folder using huggingface_hub
Verified signature0b03681 -
Upload folder using huggingface_hub
Verified signaturee209aac -
Upload folder using huggingface_hub
Verified signature7aabdc1 -
Upload folder using huggingface_hub
Verified signature052d2b6 -
Upload folder using huggingface_hub
Verified signature71fc9f4 -
Upload folder using huggingface_hub
Verified signature4177355
-
Upload folder using huggingface_hub
Verified signaturee1bd7d6
-
Upload folder using huggingface_hub
Verified signaturedd939e8
-
Upload folder using huggingface_hub
Verified signaturee507646 -
Update README.md
Verified signaturee16b887 -
Upload folder using huggingface_hub
Verified signaturebf990d5 -
Upload folder using huggingface_hub
Verified signature979f6ba -
Upload folder using huggingface_hub
Verified signaturec9be6a0
-
initial commit
Verified signaturea257b0d