Image-Text-to-Text
Transformers
PyTorch
multilingual
internvl_chat
feature-extraction
internvl
custom_code
Instructions to use OpenGVLab/InternVL-Chat-V1-1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL-Chat-V1-1 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL-Chat-V1-1", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenGVLab/InternVL-Chat-V1-1", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenGVLab/InternVL-Chat-V1-1 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL-Chat-V1-1" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/InternVL-Chat-V1-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/OpenGVLab/InternVL-Chat-V1-1
- SGLang
How to use OpenGVLab/InternVL-Chat-V1-1 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/InternVL-Chat-V1-1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/InternVL-Chat-V1-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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/InternVL-Chat-V1-1" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGVLab/InternVL-Chat-V1-1", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use OpenGVLab/InternVL-Chat-V1-1 with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL-Chat-V1-1
Update conversation.py
Browse files- conversation.py +0 -43
conversation.py
CHANGED
|
@@ -1211,46 +1211,3 @@ register_conv_template(
|
|
| 1211 |
sep2='</s>',
|
| 1212 |
)
|
| 1213 |
)
|
| 1214 |
-
|
| 1215 |
-
|
| 1216 |
-
if __name__ == '__main__':
|
| 1217 |
-
from fastchat.conversation import get_conv_template
|
| 1218 |
-
|
| 1219 |
-
print('-- Vicuna template --')
|
| 1220 |
-
conv = get_conv_template('vicuna_v1.1')
|
| 1221 |
-
conv.append_message(conv.roles[0], 'Hello!')
|
| 1222 |
-
conv.append_message(conv.roles[1], 'Hi!')
|
| 1223 |
-
conv.append_message(conv.roles[0], 'How are you?')
|
| 1224 |
-
conv.append_message(conv.roles[1], None)
|
| 1225 |
-
print(conv.get_prompt())
|
| 1226 |
-
|
| 1227 |
-
print('\n')
|
| 1228 |
-
|
| 1229 |
-
print('-- Llama-2 template --')
|
| 1230 |
-
conv = get_conv_template('llama-2')
|
| 1231 |
-
conv.set_system_message('You are a helpful, respectful and honest assistant.')
|
| 1232 |
-
conv.append_message(conv.roles[0], 'Hello!')
|
| 1233 |
-
conv.append_message(conv.roles[1], 'Hi!')
|
| 1234 |
-
conv.append_message(conv.roles[0], 'How are you?')
|
| 1235 |
-
conv.append_message(conv.roles[1], None)
|
| 1236 |
-
print(conv.get_prompt())
|
| 1237 |
-
|
| 1238 |
-
print('\n')
|
| 1239 |
-
|
| 1240 |
-
print('-- ChatGPT template --')
|
| 1241 |
-
conv = get_conv_template('chatgpt')
|
| 1242 |
-
conv.append_message(conv.roles[0], 'Hello!')
|
| 1243 |
-
conv.append_message(conv.roles[1], 'Hi!')
|
| 1244 |
-
conv.append_message(conv.roles[0], 'How are you?')
|
| 1245 |
-
conv.append_message(conv.roles[1], None)
|
| 1246 |
-
print(conv.to_openai_api_messages())
|
| 1247 |
-
|
| 1248 |
-
print('\n')
|
| 1249 |
-
|
| 1250 |
-
print('-- Claude template --')
|
| 1251 |
-
conv = get_conv_template('claude')
|
| 1252 |
-
conv.append_message(conv.roles[0], 'Hello!')
|
| 1253 |
-
conv.append_message(conv.roles[1], 'Hi!')
|
| 1254 |
-
conv.append_message(conv.roles[0], 'How are you?')
|
| 1255 |
-
conv.append_message(conv.roles[1], None)
|
| 1256 |
-
print(conv.get_prompt())
|
|
|
|
| 1211 |
sep2='</s>',
|
| 1212 |
)
|
| 1213 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|