Image-Text-to-Text
Transformers
Safetensors
llava_next
multimodal
multilingual
vlm
translation
conversational
text-generation-inference
Instructions to use utter-project/TowerVision-2B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use utter-project/TowerVision-2B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="utter-project/TowerVision-2B") 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 AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("utter-project/TowerVision-2B") model = AutoModelForImageTextToText.from_pretrained("utter-project/TowerVision-2B") 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?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use utter-project/TowerVision-2B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "utter-project/TowerVision-2B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "utter-project/TowerVision-2B", "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/utter-project/TowerVision-2B
- SGLang
How to use utter-project/TowerVision-2B 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 "utter-project/TowerVision-2B" \ --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": "utter-project/TowerVision-2B", "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 "utter-project/TowerVision-2B" \ --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": "utter-project/TowerVision-2B", "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 utter-project/TowerVision-2B with Docker Model Runner:
docker model run hf.co/utter-project/TowerVision-2B
Guilherme Viveiros commited on
Upload LlavaNextForConditionalGeneration
Browse files- config.json +2 -2
- generation_config.json +2 -2
- model-00001-of-00003.safetensors +1 -1
- model-00002-of-00003.safetensors +1 -1
- model-00003-of-00003.safetensors +1 -1
config.json
CHANGED
|
@@ -66,7 +66,7 @@
|
|
| 66 |
"multimodal_projector_bias": true,
|
| 67 |
"projector_hidden_act": "gelu",
|
| 68 |
"text_config": {
|
| 69 |
-
"_name_or_path": "/
|
| 70 |
"add_faster_video": false,
|
| 71 |
"add_time_instruction": false,
|
| 72 |
"architectures": [
|
|
@@ -161,7 +161,7 @@
|
|
| 161 |
"mm_use_im_start_end": false,
|
| 162 |
"mm_vision_select_feature": "patch",
|
| 163 |
"mm_vision_select_layer": -2,
|
| 164 |
-
"mm_vision_tower": "/
|
| 165 |
"mm_vision_tower_lr": 2e-06,
|
| 166 |
"model_type": "gemma2",
|
| 167 |
"num_attention_heads": 8,
|
|
|
|
| 66 |
"multimodal_projector_bias": true,
|
| 67 |
"projector_hidden_act": "gelu",
|
| 68 |
"text_config": {
|
| 69 |
+
"_name_or_path": "/mnt/scratch-artemis/gviveiros/TowerVision/llava-next-native/towerp_2b_instruct/",
|
| 70 |
"add_faster_video": false,
|
| 71 |
"add_time_instruction": false,
|
| 72 |
"architectures": [
|
|
|
|
| 161 |
"mm_use_im_start_end": false,
|
| 162 |
"mm_vision_select_feature": "patch",
|
| 163 |
"mm_vision_select_layer": -2,
|
| 164 |
+
"mm_vision_tower": "/mnt/scratch-artemis/gviveiros/siglip2-so400m-patch14-384/",
|
| 165 |
"mm_vision_tower_lr": 2e-06,
|
| 166 |
"model_type": "gemma2",
|
| 167 |
"num_attention_heads": 8,
|
generation_config.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
-
"bos_token_id":
|
| 4 |
"cache_implementation": "hybrid",
|
| 5 |
-
"eos_token_id":
|
| 6 |
"pad_token_id": 0,
|
| 7 |
"transformers_version": "4.52.0.dev0"
|
| 8 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 2,
|
| 4 |
"cache_implementation": "hybrid",
|
| 5 |
+
"eos_token_id": 107,
|
| 6 |
"pad_token_id": 0,
|
| 7 |
"transformers_version": "4.52.0.dev0"
|
| 8 |
}
|
model-00001-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4973252496
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:73b13aa27ee5bd1f3d488a6e0147759fb3c72eda406c0dd503ffbfa71e0eb41f
|
| 3 |
size 4973252496
|
model-00002-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 4983446008
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:83e78fbd1e1c4ca7a004fc08cf464947bc5ab04126b68b34a44580f8dfa5224e
|
| 3 |
size 4983446008
|
model-00003-of-00003.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 2123643328
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:9be1dfbf34e2977863ca41794c9414d3979b34f876ed2c71990b336e77766e6a
|
| 3 |
size 2123643328
|