Image-Text-to-Text
Transformers
Safetensors
multilingual
internvl_chat
feature-extraction
internvl
custom_code
conversational
Instructions to use OpenGVLab/InternVL-Chat-V1-5-AWQ with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL-Chat-V1-5-AWQ 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-5-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/InternVL-Chat-V1-5-AWQ", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use OpenGVLab/InternVL-Chat-V1-5-AWQ 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-5-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/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-AWQ
- SGLang
How to use OpenGVLab/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-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/InternVL-Chat-V1-5-AWQ with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL-Chat-V1-5-AWQ
Upload folder using huggingface_hub
Browse files- README.md +3 -3
- config.json +1 -0
README.md
CHANGED
|
@@ -65,7 +65,7 @@ For more information about the pipeline parameters, please refer to [here](https
|
|
| 65 |
LMDeploy's `api_server` enables models to be easily packed into services with a single command. The provided RESTful APIs are compatible with OpenAI's interfaces. Below are an example of service startup:
|
| 66 |
|
| 67 |
```shell
|
| 68 |
-
lmdeploy serve api_server OpenGVLab/InternVL-Chat-V1-5-AWQ --
|
| 69 |
```
|
| 70 |
|
| 71 |
To use the OpenAI-style interface, you need to install OpenAI:
|
|
@@ -82,7 +82,7 @@ from openai import OpenAI
|
|
| 82 |
client = OpenAI(api_key='YOUR_API_KEY', base_url='http://0.0.0.0:23333/v1')
|
| 83 |
model_name = client.models.list().data[0].id
|
| 84 |
response = client.chat.completions.create(
|
| 85 |
-
model=
|
| 86 |
messages=[{
|
| 87 |
'role':
|
| 88 |
'user',
|
|
@@ -104,7 +104,7 @@ print(response)
|
|
| 104 |
|
| 105 |
## License
|
| 106 |
|
| 107 |
-
This project is released under the MIT license, while
|
| 108 |
|
| 109 |
## Citation
|
| 110 |
|
|
|
|
| 65 |
LMDeploy's `api_server` enables models to be easily packed into services with a single command. The provided RESTful APIs are compatible with OpenAI's interfaces. Below are an example of service startup:
|
| 66 |
|
| 67 |
```shell
|
| 68 |
+
lmdeploy serve api_server OpenGVLab/InternVL-Chat-V1-5-AWQ --backend turbomind --server-port 23333 --model-format awq
|
| 69 |
```
|
| 70 |
|
| 71 |
To use the OpenAI-style interface, you need to install OpenAI:
|
|
|
|
| 82 |
client = OpenAI(api_key='YOUR_API_KEY', base_url='http://0.0.0.0:23333/v1')
|
| 83 |
model_name = client.models.list().data[0].id
|
| 84 |
response = client.chat.completions.create(
|
| 85 |
+
model=model_name,
|
| 86 |
messages=[{
|
| 87 |
'role':
|
| 88 |
'user',
|
|
|
|
| 104 |
|
| 105 |
## License
|
| 106 |
|
| 107 |
+
This project is released under the MIT license, while InternLM2 is licensed under the Apache-2.0 license.
|
| 108 |
|
| 109 |
## Citation
|
| 110 |
|
config.json
CHANGED
|
@@ -8,6 +8,7 @@
|
|
| 8 |
"AutoModel": "modeling_internvl_chat.InternVLChatModel",
|
| 9 |
"AutoModelForCausalLM": "modeling_internvl_chat.InternVLChatModel"
|
| 10 |
},
|
|
|
|
| 11 |
"downsample_ratio": 0.5,
|
| 12 |
"dynamic_image_size": true,
|
| 13 |
"force_image_size": 448,
|
|
|
|
| 8 |
"AutoModel": "modeling_internvl_chat.InternVLChatModel",
|
| 9 |
"AutoModelForCausalLM": "modeling_internvl_chat.InternVLChatModel"
|
| 10 |
},
|
| 11 |
+
"system_message": "You are an AI assistant whose name is InternLM (涔︾敓路娴﹁).",
|
| 12 |
"downsample_ratio": 0.5,
|
| 13 |
"dynamic_image_size": true,
|
| 14 |
"force_image_size": 448,
|