Image-Text-to-Text
Transformers
Safetensors
multilingual
sa2va_chat
feature-extraction
Sa2VA
custom_code
conversational
Instructions to use ByteDance/Sa2VA-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ByteDance/Sa2VA-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="ByteDance/Sa2VA-4B", 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("ByteDance/Sa2VA-4B", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use ByteDance/Sa2VA-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "ByteDance/Sa2VA-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ByteDance/Sa2VA-4B", "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/ByteDance/Sa2VA-4B
- SGLang
How to use ByteDance/Sa2VA-4B 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 "ByteDance/Sa2VA-4B" \ --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": "ByteDance/Sa2VA-4B", "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 "ByteDance/Sa2VA-4B" \ --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": "ByteDance/Sa2VA-4B", "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 ByteDance/Sa2VA-4B with Docker Model Runner:
docker model run hf.co/ByteDance/Sa2VA-4B
Update README.md
#5
by LXT - opened
README.md
CHANGED
|
@@ -1,21 +1,19 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
pipeline_tag: image-text-to-text
|
| 4 |
library_name: transformers
|
| 5 |
base_model:
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
- Qwen/Qwen2.5-3B-Instruct
|
| 13 |
base_model_relation: merge
|
| 14 |
language:
|
| 15 |
-
|
| 16 |
tags:
|
| 17 |
-
|
| 18 |
-
- custom_code
|
| 19 |
---
|
| 20 |
|
| 21 |
# Sa2VA: Marrying SAM2 with LLaVA for Dense Grounded Understanding of Images and Videos
|
|
@@ -160,4 +158,4 @@ If you find this project useful in your research, please consider citing:
|
|
| 160 |
journal={arXiv preprint},
|
| 161 |
year={2025}
|
| 162 |
}
|
| 163 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
pipeline_tag: image-text-to-text
|
| 4 |
library_name: transformers
|
| 5 |
base_model:
|
| 6 |
+
- OpenGVLab/InternVL2-1B
|
| 7 |
+
- OpenGVLab/InternVL2_5-8B
|
| 8 |
+
- OpenGVLab/InternVL2_5-4B
|
| 9 |
+
- OpenGVLab/InternViT-300M-448px-V2_5
|
| 10 |
+
- internlm/internlm2_5-7b-chat
|
| 11 |
+
- Qwen/Qwen2.5-3B-Instruct
|
|
|
|
| 12 |
base_model_relation: merge
|
| 13 |
language:
|
| 14 |
+
- multilingual
|
| 15 |
tags:
|
| 16 |
+
- Sa2VA
|
|
|
|
| 17 |
---
|
| 18 |
|
| 19 |
# Sa2VA: Marrying SAM2 with LLaVA for Dense Grounded Understanding of Images and Videos
|
|
|
|
| 158 |
journal={arXiv preprint},
|
| 159 |
year={2025}
|
| 160 |
}
|
| 161 |
+
```
|