Image-Text-to-Text
Transformers
PyTorch
multilingual
internvl_chat
feature-extraction
internvl
custom_code
conversational
Instructions to use OpenGVLab/InternVL2-40B-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL2-40B-AWQ with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL2-40B-AWQ", 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-40B-AWQ", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use OpenGVLab/InternVL2-40B-AWQ with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL2-40B-AWQ" # 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-AWQ", "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-AWQ
- SGLang
How to use OpenGVLab/InternVL2-40B-AWQ 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-AWQ" \ --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-AWQ", "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-AWQ" \ --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-AWQ", "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-AWQ with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL2-40B-AWQ
Upload folder using huggingface_hub
Browse files- README.md +1 -1
- conversation.py +3 -3
README.md
CHANGED
|
@@ -7,7 +7,7 @@ pipeline_tag: image-text-to-text
|
|
| 7 |
|
| 8 |
[\[📂 GitHub\]](https://github.com/OpenGVLab/InternVL) [\[🆕 Blog\]](https://internvl.github.io/blog/) [\[📜 InternVL 1.0 Paper\]](https://arxiv.org/abs/2312.14238) [\[📜 InternVL 1.5 Report\]](https://arxiv.org/abs/2404.16821)
|
| 9 |
|
| 10 |
-
[\[🗨️ Chat Demo\]](https://internvl.opengvlab.com/) [\[🤗 HF Demo\]](https://huggingface.co/spaces/OpenGVLab/InternVL) [\[🚀 Quick Start\]](#quick-start) [\[📖 中文解读\]](https://zhuanlan.zhihu.com/p/706547971) \[
|
| 11 |
|
| 12 |
## Introduction
|
| 13 |
|
|
|
|
| 7 |
|
| 8 |
[\[📂 GitHub\]](https://github.com/OpenGVLab/InternVL) [\[🆕 Blog\]](https://internvl.github.io/blog/) [\[📜 InternVL 1.0 Paper\]](https://arxiv.org/abs/2312.14238) [\[📜 InternVL 1.5 Report\]](https://arxiv.org/abs/2404.16821)
|
| 9 |
|
| 10 |
+
[\[🗨️ Chat Demo\]](https://internvl.opengvlab.com/) [\[🤗 HF Demo\]](https://huggingface.co/spaces/OpenGVLab/InternVL) [\[🚀 Quick Start\]](#quick-start) [\[📖 中文解读\]](https://zhuanlan.zhihu.com/p/706547971) [\[📖 Documents\]](https://internvl.readthedocs.io/en/latest/)
|
| 11 |
|
| 12 |
## Introduction
|
| 13 |
|
conversation.py
CHANGED
|
@@ -339,7 +339,7 @@ register_conv_template(
|
|
| 339 |
name='Hermes-2',
|
| 340 |
system_template='<|im_start|>system\n{system_message}',
|
| 341 |
# note: The new system prompt was not used here to avoid changes in benchmark performance.
|
| 342 |
-
# system_message='我是书生·万象,英文名是InternVL,是由上海人工智能实验室及多家合作单位联合开发的多模态大语言模型。',
|
| 343 |
system_message='你是由上海人工智能实验室联合商汤科技开发的书生多模态大模型,英文名叫InternVL, 是一个有用无害的人工智能助手。',
|
| 344 |
roles=('<|im_start|>user\n', '<|im_start|>assistant\n'),
|
| 345 |
sep_style=SeparatorStyle.MPT,
|
|
@@ -360,7 +360,7 @@ register_conv_template(
|
|
| 360 |
name='internlm2-chat',
|
| 361 |
system_template='<|im_start|>system\n{system_message}',
|
| 362 |
# note: The new system prompt was not used here to avoid changes in benchmark performance.
|
| 363 |
-
# system_message='我是书生·万象,英文名是InternVL,是由上海人工智能实验室及多家合作单位联合开发的多模态大语言模型。',
|
| 364 |
system_message='你是由上海人工智能实验室联合商汤科技开发的书生多模态大模型,英文名叫InternVL, 是一个有用无害的人工智能助手。',
|
| 365 |
roles=('<|im_start|>user\n', '<|im_start|>assistant\n'),
|
| 366 |
sep_style=SeparatorStyle.MPT,
|
|
@@ -379,7 +379,7 @@ register_conv_template(
|
|
| 379 |
name='phi3-chat',
|
| 380 |
system_template='<|system|>\n{system_message}',
|
| 381 |
# note: The new system prompt was not used here to avoid changes in benchmark performance.
|
| 382 |
-
# system_message='我是书生·万象,英文名是InternVL,是由上海人工智能实验室及多家合作单位联合开发的多模态大语言模型。',
|
| 383 |
system_message='你是由上海人工智能实验室联合商汤科技开发的书生多模态大模型,英文名叫InternVL, 是一个有用无害的人工智能助手。',
|
| 384 |
roles=('<|user|>\n', '<|assistant|>\n'),
|
| 385 |
sep_style=SeparatorStyle.MPT,
|
|
|
|
| 339 |
name='Hermes-2',
|
| 340 |
system_template='<|im_start|>system\n{system_message}',
|
| 341 |
# note: The new system prompt was not used here to avoid changes in benchmark performance.
|
| 342 |
+
# system_message='我是书生·万象,英文名是InternVL,是由上海人工智能实验室、清华大学及多家合作单位联合开发的多模态大语言模型。',
|
| 343 |
system_message='你是由上海人工智能实验室联合商汤科技开发的书生多模态大模型,英文名叫InternVL, 是一个有用无害的人工智能助手。',
|
| 344 |
roles=('<|im_start|>user\n', '<|im_start|>assistant\n'),
|
| 345 |
sep_style=SeparatorStyle.MPT,
|
|
|
|
| 360 |
name='internlm2-chat',
|
| 361 |
system_template='<|im_start|>system\n{system_message}',
|
| 362 |
# note: The new system prompt was not used here to avoid changes in benchmark performance.
|
| 363 |
+
# system_message='我是书生·万象,英文名是InternVL,是由上海人工智能实验室、清华大学及多家合作单位联合开发的多模态大语言模型。',
|
| 364 |
system_message='你是由上海人工智能实验室联合商汤科技开发的书生多模态大模型,英文名叫InternVL, 是一个有用无害的人工智能助手。',
|
| 365 |
roles=('<|im_start|>user\n', '<|im_start|>assistant\n'),
|
| 366 |
sep_style=SeparatorStyle.MPT,
|
|
|
|
| 379 |
name='phi3-chat',
|
| 380 |
system_template='<|system|>\n{system_message}',
|
| 381 |
# note: The new system prompt was not used here to avoid changes in benchmark performance.
|
| 382 |
+
# system_message='我是书生·万象,英文名是InternVL,是由上海人工智能实验室、清华大学及多家合作单位联合开发的多模态大语言模型。',
|
| 383 |
system_message='你是由上海人工智能实验室联合商汤科技开发的书生多模态大模型,英文名叫InternVL, 是一个有用无害的人工智能助手。',
|
| 384 |
roles=('<|user|>\n', '<|assistant|>\n'),
|
| 385 |
sep_style=SeparatorStyle.MPT,
|