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
-
fix the runtimeError of in-place operation when use transformers for training
Verified signaturealign the `input_embeds` with internvl2 original code [Line 167](https://github.com/OpenGVLab/InternVL/blob/74126371d0190a316109ddb22e4f2ca4405a7991/internvl_chat/internvl/model/internvl_chat/modeling_internvl_chat.py#L167), which may lead in a runtime error when using hf version code for training.d050322
-
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 -
Upload folder using huggingface_hub
Verified signature9082859 -
Fix InternLM2ForCausalLM does not support Flash Attention 2.0 yet (#3)
Verified signature- Fix InternLM2ForCausalLM does not support Flash Attention 2.0 yet (6b6271256e90d4f97f1aa954ad3a046313b5f5d9) Co-authored-by: kosung <kosung@users.noreply.huggingface.co>743a544 -
Update README.md (#4)
Verified signature- Update README.md (8306875fe567ca2a0392fe370950db7e094bee95) Co-authored-by: Merve Noyan <merve@users.noreply.huggingface.co>8e8fba2
-
Upload folder using huggingface_hub
Verified signature48bb98c -
Upload folder using huggingface_hub
Verified signature2f33adf
-
Upload folder using huggingface_hub
Verified signaturebb437c0 -
Upload folder using huggingface_hub
Verified signature2ec0ee5 -
Upload folder using huggingface_hub
Verified signatureef7a32d -
Upload folder using huggingface_hub
Verified signature4012170 -
Upload folder using huggingface_hub
Verified signature5175cd6 -
Upload folder using huggingface_hub
Verified signatureb08541a -
Upload folder using huggingface_hub
Verified signature6d68017