Image-Text-to-Text
Transformers
Safetensors
multilingual
internvl_chat
feature-extraction
internvl
custom_code
conversational
Instructions to use OpenGVLab/InternVL3-1B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGVLab/InternVL3-1B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGVLab/InternVL3-1B", 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/InternVL3-1B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use OpenGVLab/InternVL3-1B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGVLab/InternVL3-1B" # 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/InternVL3-1B", "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/InternVL3-1B
- SGLang
How to use OpenGVLab/InternVL3-1B 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/InternVL3-1B" \ --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/InternVL3-1B", "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/InternVL3-1B" \ --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/InternVL3-1B", "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/InternVL3-1B with Docker Model Runner:
docker model run hf.co/OpenGVLab/InternVL3-1B
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -522,7 +522,7 @@ from lmdeploy.vl import load_image
|
|
| 522 |
|
| 523 |
model = 'OpenGVLab/InternVL3-1B'
|
| 524 |
image = load_image('https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/tests/data/tiger.jpeg')
|
| 525 |
-
pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=16384, tp=
|
| 526 |
response = pipe(('describe this image', image))
|
| 527 |
print(response.text)
|
| 528 |
```
|
|
@@ -539,7 +539,7 @@ from lmdeploy.vl import load_image
|
|
| 539 |
from lmdeploy.vl.constants import IMAGE_TOKEN
|
| 540 |
|
| 541 |
model = 'OpenGVLab/InternVL3-1B'
|
| 542 |
-
pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=16384, tp=
|
| 543 |
|
| 544 |
image_urls=[
|
| 545 |
'https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg',
|
|
@@ -561,7 +561,7 @@ from lmdeploy import pipeline, TurbomindEngineConfig
|
|
| 561 |
from lmdeploy.vl import load_image
|
| 562 |
|
| 563 |
model = 'OpenGVLab/InternVL3-1B'
|
| 564 |
-
pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=16384, tp=
|
| 565 |
|
| 566 |
image_urls=[
|
| 567 |
"https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg",
|
|
@@ -581,7 +581,7 @@ from lmdeploy import pipeline, TurbomindEngineConfig, GenerationConfig
|
|
| 581 |
from lmdeploy.vl import load_image
|
| 582 |
|
| 583 |
model = 'OpenGVLab/InternVL3-1B'
|
| 584 |
-
pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=16384, tp=
|
| 585 |
|
| 586 |
image = load_image('https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg')
|
| 587 |
gen_config = GenerationConfig(top_k=40, top_p=0.8, temperature=0.8)
|
|
@@ -596,7 +596,7 @@ print(sess.response.text)
|
|
| 596 |
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:
|
| 597 |
|
| 598 |
```shell
|
| 599 |
-
lmdeploy serve api_server OpenGVLab/InternVL3-1B --server-port 23333 --tp
|
| 600 |
```
|
| 601 |
|
| 602 |
To use the OpenAI-style interface, you need to install OpenAI:
|
|
|
|
| 522 |
|
| 523 |
model = 'OpenGVLab/InternVL3-1B'
|
| 524 |
image = load_image('https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/tests/data/tiger.jpeg')
|
| 525 |
+
pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=16384, tp=1))
|
| 526 |
response = pipe(('describe this image', image))
|
| 527 |
print(response.text)
|
| 528 |
```
|
|
|
|
| 539 |
from lmdeploy.vl.constants import IMAGE_TOKEN
|
| 540 |
|
| 541 |
model = 'OpenGVLab/InternVL3-1B'
|
| 542 |
+
pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=16384, tp=1))
|
| 543 |
|
| 544 |
image_urls=[
|
| 545 |
'https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg',
|
|
|
|
| 561 |
from lmdeploy.vl import load_image
|
| 562 |
|
| 563 |
model = 'OpenGVLab/InternVL3-1B'
|
| 564 |
+
pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=16384, tp=1))
|
| 565 |
|
| 566 |
image_urls=[
|
| 567 |
"https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg",
|
|
|
|
| 581 |
from lmdeploy.vl import load_image
|
| 582 |
|
| 583 |
model = 'OpenGVLab/InternVL3-1B'
|
| 584 |
+
pipe = pipeline(model, backend_config=TurbomindEngineConfig(session_len=16384, tp=1))
|
| 585 |
|
| 586 |
image = load_image('https://raw.githubusercontent.com/open-mmlab/mmdeploy/main/demo/resources/human-pose.jpg')
|
| 587 |
gen_config = GenerationConfig(top_k=40, top_p=0.8, temperature=0.8)
|
|
|
|
| 596 |
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:
|
| 597 |
|
| 598 |
```shell
|
| 599 |
+
lmdeploy serve api_server OpenGVLab/InternVL3-1B --server-port 23333 --tp 1
|
| 600 |
```
|
| 601 |
|
| 602 |
To use the OpenAI-style interface, you need to install OpenAI:
|