Image-Text-to-Text
Transformers
Safetensors
multilingual
internvl_chat
feature-extraction
internvl
custom_code
conversational
Instructions to use OpenGVLab/InternVL2-8B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL2-8B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL2-8B", 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-8B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenGVLab/InternVL2-8B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL2-8B" # 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-8B", "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-8B
- SGLang
How to use OpenGVLab/InternVL2-8B 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-8B" \ --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-8B", "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-8B" \ --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-8B", "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-8B with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL2-8B
Commit History
-
Add supports_gradient_checkpointing
Verified signature6fb9ad6
-
Fix device_map
Verified signature6f6d72b
-
Update README.md
Verified signature939880e
-
Update README.md
Verified signature25f5671
-
Apply Github PR #127 to all HF models
Verified signaturecf5b9bd -
Update README.md
Verified signature9c42ea1
-
Update README.md
Verified signature42b7cef
-
fix compatibility issue for transformers 4.46+
Verified signaturee706259
-
fix compatibility issue for transformers 4.46+
Verified signatureedaa746 -
fix compatibility issue for transformers 4.46+
Verified signature94d38c0
-
Fix Error while `get_input_embeddings()` (#17)
Verified signature- Fix Error while `get_input_embeddings()` (71ba3fb875f60f667345a84647e0605f177a0ef5) Co-authored-by: marko1616 <marko1616@users.noreply.huggingface.co>c527cd3 -
fix the runtimeError of in-place operation when use transformers for training (#18)
Verified signature- fix the runtimeError of in-place operation when use transformers for training (d050322463df340386bfcb61100b8403a9e32f08) Co-authored-by: Dongdong Kuang <kingsley01@users.noreply.huggingface.co>82c7bc9
-
Upload folder using huggingface_hub
Verified signature8f6bbf9
-
Upload folder using huggingface_hub
Verified signature357996b -
Upload folder using huggingface_hub
Verified signaturea749d32 -
Upload folder using huggingface_hub
Verified signaturee429101 -
Upload folder using huggingface_hub
Verified signature900d017 -
Upload folder using huggingface_hub
Verified signaturebf5df27 -
Upload folder using huggingface_hub
Verified signature2d325bf
-
Upload folder using huggingface_hub
Verified signaturee848588 -
Upload folder using huggingface_hub
Verified signaturede7c127 -
feat: add eos_token_id to generation_config.json (needed by vllm infer) (#12)
Verified signature- feat: add eos_token_id to generation_config.json (needed by vllm infer) (1c19c18d6cb9a29d583f211378915444620efe3f) Co-authored-by: guokairui <wxsm@users.noreply.huggingface.co>989a689 -
norm function changes dtypes (#13)
Verified signature- convert norm function output to original dtype (771117017599deb36494828a10d72790c69929f6)4b3bcd0 -
Upload folder using huggingface_hub
Verified signaturedb62f28
-
Delete internvl_v2.zip
Verified signature3bfd366 -
Upload folder using huggingface_hub
Verified signature7c84c28
-
Upload internvl_v2.zip with huggingface_hub
Verified signature23ea7f5
-
Upload folder using huggingface_hub
Verified signaturef71474a
-
Upload folder using huggingface_hub
Verified signaturee110c56 -
Upload folder using huggingface_hub
Verified signature9c22dd0
-
Upload folder using huggingface_hub
Verified signature277b5e2 -
Upload folder using huggingface_hub
Verified signature2e6227d
-
Upload folder using huggingface_hub
Verified signatureea5d0cd
-
Upload folder using huggingface_hub
Verified signature2645855
-
Upload folder using huggingface_hub
Verified signature5d3649a -
Upload folder using huggingface_hub
Verified signature705d04a
-
Upload folder using huggingface_hub
Verified signaturedadf36e
-
Upload folder using huggingface_hub
Verified signature7939a50
-
Upload folder using huggingface_hub
Verified signature1b908db -
Upload folder using huggingface_hub
Verified signatureecae910 -
Upload folder using huggingface_hub
Verified signature581c716 -
Upload folder using huggingface_hub
Verified signaturea580b1b -
Upload folder using huggingface_hub
Verified signature0b8333d -
Upload folder using huggingface_hub
Verified signature21629e3
-
Upload folder using huggingface_hub
Verified signaturec446b09
-
Upload folder using huggingface_hub
Verified signature0e6d592
-
Upload folder using huggingface_hub
Verified signature0223f73 -
Upload folder using huggingface_hub
Verified signature71efac5
-
Upload folder using huggingface_hub
Verified signaturef750157 -
Upload folder using huggingface_hub
Verified signature6c1b71c