Image-Text-to-Text
Transformers
Safetensors
qwen2_5_vl
conversational
custom_code
text-generation-inference
Instructions to use array/Qwen2.5-VL-SATBase with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use array/Qwen2.5-VL-SATBase with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="array/Qwen2.5-VL-SATBase", 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 AutoProcessor, AutoModelForImageTextToText processor = AutoProcessor.from_pretrained("array/Qwen2.5-VL-SATBase", trust_remote_code=True) model = AutoModelForImageTextToText.from_pretrained("array/Qwen2.5-VL-SATBase", 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?"} ] }, ] 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 array/Qwen2.5-VL-SATBase with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "array/Qwen2.5-VL-SATBase" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "array/Qwen2.5-VL-SATBase", "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/array/Qwen2.5-VL-SATBase
- SGLang
How to use array/Qwen2.5-VL-SATBase 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 "array/Qwen2.5-VL-SATBase" \ --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": "array/Qwen2.5-VL-SATBase", "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 "array/Qwen2.5-VL-SATBase" \ --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": "array/Qwen2.5-VL-SATBase", "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 array/Qwen2.5-VL-SATBase with Docker Model Runner:
docker model run hf.co/array/Qwen2.5-VL-SATBase
Upload folder using huggingface_hub
Browse files- chat_template.json +3 -0
- config.json +7 -85
- generation_config.json +1 -1
- model.safetensors.index.json +0 -1
- preprocessor_config.json +1 -1
- tokenizer_config.json +1 -0
chat_template.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}"
|
| 3 |
+
}
|
config.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
| 1 |
{
|
|
|
|
| 2 |
"architectures": [
|
| 3 |
"Qwen2_5_VLForConditionalGeneration"
|
| 4 |
],
|
| 5 |
"attention_dropout": 0.0,
|
| 6 |
"auto_map": {
|
| 7 |
-
"AutoModelForVision2Seq": "mmlatentdiscrete_qwen_vl.Qwen2_5_VLForConditionalGeneration"
|
| 8 |
},
|
| 9 |
"bos_token_id": 151643,
|
| 10 |
"dtype": "bfloat16",
|
|
@@ -37,104 +38,25 @@
|
|
| 37 |
"rope_theta": 1000000.0,
|
| 38 |
"sliding_window": 32768,
|
| 39 |
"stage": null,
|
| 40 |
-
"text_config":
|
| 41 |
-
"_name_or_path": "/usr/local/google/home/arijitray/Documents/final_models/qwen_vl_satbaseline_24000",
|
| 42 |
-
"architectures": [
|
| 43 |
-
"Qwen2_5_VLForConditionalGeneration"
|
| 44 |
-
],
|
| 45 |
-
"attention_dropout": 0.0,
|
| 46 |
-
"bos_token_id": 151643,
|
| 47 |
-
"dtype": "bfloat16",
|
| 48 |
-
"eos_token_id": 151645,
|
| 49 |
-
"hidden_act": "silu",
|
| 50 |
-
"hidden_size": 3584,
|
| 51 |
-
"initializer_range": 0.02,
|
| 52 |
-
"intermediate_size": 18944,
|
| 53 |
-
"layer_types": [
|
| 54 |
-
"full_attention",
|
| 55 |
-
"full_attention",
|
| 56 |
-
"full_attention",
|
| 57 |
-
"full_attention",
|
| 58 |
-
"full_attention",
|
| 59 |
-
"full_attention",
|
| 60 |
-
"full_attention",
|
| 61 |
-
"full_attention",
|
| 62 |
-
"full_attention",
|
| 63 |
-
"full_attention",
|
| 64 |
-
"full_attention",
|
| 65 |
-
"full_attention",
|
| 66 |
-
"full_attention",
|
| 67 |
-
"full_attention",
|
| 68 |
-
"full_attention",
|
| 69 |
-
"full_attention",
|
| 70 |
-
"full_attention",
|
| 71 |
-
"full_attention",
|
| 72 |
-
"full_attention",
|
| 73 |
-
"full_attention",
|
| 74 |
-
"full_attention",
|
| 75 |
-
"full_attention",
|
| 76 |
-
"full_attention",
|
| 77 |
-
"full_attention",
|
| 78 |
-
"full_attention",
|
| 79 |
-
"full_attention",
|
| 80 |
-
"full_attention",
|
| 81 |
-
"full_attention"
|
| 82 |
-
],
|
| 83 |
-
"max_position_embeddings": 128000,
|
| 84 |
-
"max_window_layers": 28,
|
| 85 |
-
"model_type": "qwen2_5_vl_text",
|
| 86 |
-
"num_attention_heads": 28,
|
| 87 |
-
"num_hidden_layers": 28,
|
| 88 |
-
"num_key_value_heads": 4,
|
| 89 |
-
"rms_norm_eps": 1e-06,
|
| 90 |
-
"rope_scaling": {
|
| 91 |
-
"mrope_section": [
|
| 92 |
-
16,
|
| 93 |
-
24,
|
| 94 |
-
24
|
| 95 |
-
],
|
| 96 |
-
"rope_type": "default",
|
| 97 |
-
"type": "default"
|
| 98 |
-
},
|
| 99 |
-
"rope_theta": 1000000.0,
|
| 100 |
-
"sliding_window": null,
|
| 101 |
-
"use_cache": true,
|
| 102 |
-
"use_sliding_window": false,
|
| 103 |
-
"vision_token_id": 151654,
|
| 104 |
-
"vocab_size": 151669
|
| 105 |
-
},
|
| 106 |
"tie_word_embeddings": false,
|
| 107 |
-
"
|
|
|
|
| 108 |
"use_cache": true,
|
| 109 |
"use_sliding_window": false,
|
| 110 |
"video_token_id": 151656,
|
| 111 |
"vision_config": {
|
| 112 |
-
"depth": 32,
|
| 113 |
"dtype": "bfloat16",
|
| 114 |
-
"fullatt_block_indexes": [
|
| 115 |
-
7,
|
| 116 |
-
15,
|
| 117 |
-
23,
|
| 118 |
-
31
|
| 119 |
-
],
|
| 120 |
-
"hidden_act": "silu",
|
| 121 |
"hidden_size": 1280,
|
| 122 |
-
"in_channels": 3,
|
| 123 |
"in_chans": 3,
|
| 124 |
"initializer_range": 0.02,
|
| 125 |
-
"intermediate_size": 3420,
|
| 126 |
"model_type": "qwen2_5_vl",
|
| 127 |
-
"num_heads": 16,
|
| 128 |
-
"out_hidden_size": 3584,
|
| 129 |
-
"patch_size": 14,
|
| 130 |
-
"spatial_merge_size": 2,
|
| 131 |
"spatial_patch_size": 14,
|
| 132 |
-
"temporal_patch_size": 2,
|
| 133 |
"tokens_per_second": 2,
|
| 134 |
-
"
|
| 135 |
},
|
| 136 |
"vision_end_token_id": 151653,
|
| 137 |
"vision_start_token_id": 151652,
|
| 138 |
"vision_token_id": 151654,
|
| 139 |
-
"vocab_size":
|
| 140 |
}
|
|
|
|
| 1 |
{
|
| 2 |
+
"_name_or_path": "array/Qwen2.5-VL-SATBase",
|
| 3 |
"architectures": [
|
| 4 |
"Qwen2_5_VLForConditionalGeneration"
|
| 5 |
],
|
| 6 |
"attention_dropout": 0.0,
|
| 7 |
"auto_map": {
|
| 8 |
+
"AutoModelForVision2Seq": "array/Qwen2.5-VL-SATBase--mmlatentdiscrete_qwen_vl.Qwen2_5_VLForConditionalGeneration"
|
| 9 |
},
|
| 10 |
"bos_token_id": 151643,
|
| 11 |
"dtype": "bfloat16",
|
|
|
|
| 38 |
"rope_theta": 1000000.0,
|
| 39 |
"sliding_window": 32768,
|
| 40 |
"stage": null,
|
| 41 |
+
"text_config": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
"tie_word_embeddings": false,
|
| 43 |
+
"torch_dtype": "bfloat16",
|
| 44 |
+
"transformers_version": "4.49.0.dev0",
|
| 45 |
"use_cache": true,
|
| 46 |
"use_sliding_window": false,
|
| 47 |
"video_token_id": 151656,
|
| 48 |
"vision_config": {
|
|
|
|
| 49 |
"dtype": "bfloat16",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
"hidden_size": 1280,
|
|
|
|
| 51 |
"in_chans": 3,
|
| 52 |
"initializer_range": 0.02,
|
|
|
|
| 53 |
"model_type": "qwen2_5_vl",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
"spatial_patch_size": 14,
|
|
|
|
| 55 |
"tokens_per_second": 2,
|
| 56 |
+
"torch_dtype": "bfloat16"
|
| 57 |
},
|
| 58 |
"vision_end_token_id": 151653,
|
| 59 |
"vision_start_token_id": 151652,
|
| 60 |
"vision_token_id": 151654,
|
| 61 |
+
"vocab_size": 151669
|
| 62 |
}
|
generation_config.json
CHANGED
|
@@ -8,5 +8,5 @@
|
|
| 8 |
"pad_token_id": 151643,
|
| 9 |
"repetition_penalty": 1.05,
|
| 10 |
"temperature": 1e-06,
|
| 11 |
-
"transformers_version": "4.
|
| 12 |
}
|
|
|
|
| 8 |
"pad_token_id": 151643,
|
| 9 |
"repetition_penalty": 1.05,
|
| 10 |
"temperature": 1e-06,
|
| 11 |
+
"transformers_version": "4.49.0.dev0"
|
| 12 |
}
|
model.safetensors.index.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
| 3 |
-
"total_parameters": 8289335296,
|
| 4 |
"total_size": 16578670592
|
| 5 |
},
|
| 6 |
"weight_map": {
|
|
|
|
| 1 |
{
|
| 2 |
"metadata": {
|
|
|
|
| 3 |
"total_size": 16578670592
|
| 4 |
},
|
| 5 |
"weight_map": {
|
preprocessor_config.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
| 8 |
0.4578275,
|
| 9 |
0.40821073
|
| 10 |
],
|
| 11 |
-
"image_processor_type": "
|
| 12 |
"image_std": [
|
| 13 |
0.26862954,
|
| 14 |
0.26130258,
|
|
|
|
| 8 |
0.4578275,
|
| 9 |
0.40821073
|
| 10 |
],
|
| 11 |
+
"image_processor_type": "Qwen2_5_VLImageProcessor",
|
| 12 |
"image_std": [
|
| 13 |
0.26862954,
|
| 14 |
0.26130258,
|
tokenizer_config.json
CHANGED
|
@@ -227,6 +227,7 @@
|
|
| 227 |
"<|video_pad|>"
|
| 228 |
],
|
| 229 |
"bos_token": null,
|
|
|
|
| 230 |
"clean_up_tokenization_spaces": false,
|
| 231 |
"eos_token": "<|im_end|>",
|
| 232 |
"errors": "replace",
|
|
|
|
| 227 |
"<|video_pad|>"
|
| 228 |
],
|
| 229 |
"bos_token": null,
|
| 230 |
+
"chat_template": "{% set image_count = namespace(value=0) %}{% set video_count = namespace(value=0) %}{% for message in messages %}{% if loop.first and message['role'] != 'system' %}<|im_start|>system\nYou are a helpful assistant.<|im_end|>\n{% endif %}<|im_start|>{{ message['role'] }}\n{% if message['content'] is string %}{{ message['content'] }}<|im_end|>\n{% else %}{% for content in message['content'] %}{% if content['type'] == 'image' or 'image' in content or 'image_url' in content %}{% set image_count.value = image_count.value + 1 %}{% if add_vision_id %}Picture {{ image_count.value }}: {% endif %}<|vision_start|><|image_pad|><|vision_end|>{% elif content['type'] == 'video' or 'video' in content %}{% set video_count.value = video_count.value + 1 %}{% if add_vision_id %}Video {{ video_count.value }}: {% endif %}<|vision_start|><|video_pad|><|vision_end|>{% elif 'text' in content %}{{ content['text'] }}{% endif %}{% endfor %}<|im_end|>\n{% endif %}{% endfor %}{% if add_generation_prompt %}<|im_start|>assistant\n{% endif %}",
|
| 231 |
"clean_up_tokenization_spaces": false,
|
| 232 |
"eos_token": "<|im_end|>",
|
| 233 |
"errors": "replace",
|