Instructions to use trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration") 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("trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration") model = AutoModelForImageTextToText.from_pretrained("trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration") 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 trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration", "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/trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration
- SGLang
How to use trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration 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 "trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration" \ --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": "trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration", "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 "trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration" \ --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": "trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration", "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 trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration with Docker Model Runner:
docker model run hf.co/trl-internal-testing/tiny-Qwen2_5_VLForConditionalGeneration
Upload Qwen2_5_VLForConditionalGeneration
Browse files- config.json +11 -12
- generation_config.json +1 -1
- model.safetensors +1 -1
- preprocessor_config.json +0 -2
- tokenizer.json +2 -2
- video_preprocessor_config.json +2 -1
config.json
CHANGED
|
@@ -7,22 +7,21 @@
|
|
| 7 |
"dtype": "bfloat16",
|
| 8 |
"eos_token_id": 151645,
|
| 9 |
"hidden_act": "silu",
|
| 10 |
-
"hidden_size":
|
| 11 |
"image_token_id": 151655,
|
| 12 |
"initializer_range": 0.02,
|
| 13 |
"intermediate_size": 11008,
|
| 14 |
"max_position_embeddings": 128000,
|
| 15 |
"max_window_layers": 70,
|
| 16 |
"model_type": "qwen2_5_vl",
|
| 17 |
-
"num_attention_heads":
|
| 18 |
-
"num_hidden_layers":
|
| 19 |
"num_key_value_heads": 2,
|
| 20 |
"rms_norm_eps": 1e-06,
|
| 21 |
"rope_scaling": {
|
| 22 |
"mrope_section": [
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
24
|
| 26 |
],
|
| 27 |
"rope_type": "default",
|
| 28 |
"type": "default"
|
|
@@ -39,6 +38,7 @@
|
|
| 39 |
"eos_token_id": 151645,
|
| 40 |
"hidden_act": "silu",
|
| 41 |
"hidden_size": 16,
|
|
|
|
| 42 |
"initializer_range": 0.02,
|
| 43 |
"intermediate_size": 11008,
|
| 44 |
"layer_types": [
|
|
@@ -65,16 +65,18 @@
|
|
| 65 |
"tie_word_embeddings": true,
|
| 66 |
"use_cache": true,
|
| 67 |
"use_sliding_window": false,
|
|
|
|
|
|
|
|
|
|
| 68 |
"vision_token_id": 151654,
|
| 69 |
"vocab_size": 151936
|
| 70 |
},
|
| 71 |
-
"transformers_version": "4.
|
| 72 |
"use_cache": true,
|
| 73 |
"use_sliding_window": false,
|
| 74 |
"video_token_id": 151656,
|
| 75 |
"vision_config": {
|
| 76 |
"depth": 2,
|
| 77 |
-
"embed_dim": 64,
|
| 78 |
"fullatt_block_indexes": [
|
| 79 |
7,
|
| 80 |
15,
|
|
@@ -88,10 +90,7 @@
|
|
| 88 |
"initializer_range": 0.02,
|
| 89 |
"intermediate_size": 3420,
|
| 90 |
"model_type": "qwen2_5_vl",
|
| 91 |
-
"
|
| 92 |
-
"num_heads": 16,
|
| 93 |
-
"num_hidden_layers": 2,
|
| 94 |
-
"num_key_value_heads": 2,
|
| 95 |
"out_hidden_size": 16,
|
| 96 |
"patch_size": 14,
|
| 97 |
"spatial_merge_size": 2,
|
|
|
|
| 7 |
"dtype": "bfloat16",
|
| 8 |
"eos_token_id": 151645,
|
| 9 |
"hidden_act": "silu",
|
| 10 |
+
"hidden_size": 16,
|
| 11 |
"image_token_id": 151655,
|
| 12 |
"initializer_range": 0.02,
|
| 13 |
"intermediate_size": 11008,
|
| 14 |
"max_position_embeddings": 128000,
|
| 15 |
"max_window_layers": 70,
|
| 16 |
"model_type": "qwen2_5_vl",
|
| 17 |
+
"num_attention_heads": 4,
|
| 18 |
+
"num_hidden_layers": 2,
|
| 19 |
"num_key_value_heads": 2,
|
| 20 |
"rms_norm_eps": 1e-06,
|
| 21 |
"rope_scaling": {
|
| 22 |
"mrope_section": [
|
| 23 |
+
1,
|
| 24 |
+
1
|
|
|
|
| 25 |
],
|
| 26 |
"rope_type": "default",
|
| 27 |
"type": "default"
|
|
|
|
| 38 |
"eos_token_id": 151645,
|
| 39 |
"hidden_act": "silu",
|
| 40 |
"hidden_size": 16,
|
| 41 |
+
"image_token_id": null,
|
| 42 |
"initializer_range": 0.02,
|
| 43 |
"intermediate_size": 11008,
|
| 44 |
"layer_types": [
|
|
|
|
| 65 |
"tie_word_embeddings": true,
|
| 66 |
"use_cache": true,
|
| 67 |
"use_sliding_window": false,
|
| 68 |
+
"video_token_id": null,
|
| 69 |
+
"vision_end_token_id": 151653,
|
| 70 |
+
"vision_start_token_id": 151652,
|
| 71 |
"vision_token_id": 151654,
|
| 72 |
"vocab_size": 151936
|
| 73 |
},
|
| 74 |
+
"transformers_version": "4.56.2",
|
| 75 |
"use_cache": true,
|
| 76 |
"use_sliding_window": false,
|
| 77 |
"video_token_id": 151656,
|
| 78 |
"vision_config": {
|
| 79 |
"depth": 2,
|
|
|
|
| 80 |
"fullatt_block_indexes": [
|
| 81 |
7,
|
| 82 |
15,
|
|
|
|
| 90 |
"initializer_range": 0.02,
|
| 91 |
"intermediate_size": 3420,
|
| 92 |
"model_type": "qwen2_5_vl",
|
| 93 |
+
"num_heads": 4,
|
|
|
|
|
|
|
|
|
|
| 94 |
"out_hidden_size": 16,
|
| 95 |
"patch_size": 14,
|
| 96 |
"spatial_merge_size": 2,
|
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.56.2"
|
| 12 |
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 7721168
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c1b60f801b7637e6197bd375fa0896166286bc9ec021ecfebd153357fdfa866e
|
| 3 |
size 7721168
|
preprocessor_config.json
CHANGED
|
@@ -7,7 +7,6 @@
|
|
| 7 |
"do_center_crop": null,
|
| 8 |
"do_convert_rgb": true,
|
| 9 |
"do_normalize": true,
|
| 10 |
-
"do_pad": null,
|
| 11 |
"do_rescale": true,
|
| 12 |
"do_resize": true,
|
| 13 |
"image_mean": [
|
|
@@ -25,7 +24,6 @@
|
|
| 25 |
"max_pixels": 12845056,
|
| 26 |
"merge_size": 2,
|
| 27 |
"min_pixels": 3136,
|
| 28 |
-
"pad_size": null,
|
| 29 |
"patch_size": 14,
|
| 30 |
"processor_class": "Qwen2_5_VLProcessor",
|
| 31 |
"resample": 3,
|
|
|
|
| 7 |
"do_center_crop": null,
|
| 8 |
"do_convert_rgb": true,
|
| 9 |
"do_normalize": true,
|
|
|
|
| 10 |
"do_rescale": true,
|
| 11 |
"do_resize": true,
|
| 12 |
"image_mean": [
|
|
|
|
| 24 |
"max_pixels": 12845056,
|
| 25 |
"merge_size": 2,
|
| 26 |
"min_pixels": 3136,
|
|
|
|
| 27 |
"patch_size": 14,
|
| 28 |
"processor_class": "Qwen2_5_VLProcessor",
|
| 29 |
"resample": 3,
|
tokenizer.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ba0c439f7be467bf47d12a7e6f9adc6116201056fc60c67f431c679b7c16afc8
|
| 3 |
+
size 11422064
|
video_preprocessor_config.json
CHANGED
|
@@ -6,6 +6,7 @@
|
|
| 6 |
"do_center_crop": null,
|
| 7 |
"do_convert_rgb": true,
|
| 8 |
"do_normalize": true,
|
|
|
|
| 9 |
"do_rescale": true,
|
| 10 |
"do_resize": true,
|
| 11 |
"do_sample_frames": false,
|
|
@@ -27,7 +28,6 @@
|
|
| 27 |
"min_frames": 4,
|
| 28 |
"min_pixels": 3136,
|
| 29 |
"num_frames": null,
|
| 30 |
-
"pad_size": null,
|
| 31 |
"patch_size": 14,
|
| 32 |
"processor_class": "Qwen2_5_VLProcessor",
|
| 33 |
"resample": 3,
|
|
@@ -37,6 +37,7 @@
|
|
| 37 |
"longest_edge": 12845056,
|
| 38 |
"shortest_edge": 3136
|
| 39 |
},
|
|
|
|
| 40 |
"temporal_patch_size": 2,
|
| 41 |
"video_metadata": null,
|
| 42 |
"video_processor_type": "Qwen2VLVideoProcessor"
|
|
|
|
| 6 |
"do_center_crop": null,
|
| 7 |
"do_convert_rgb": true,
|
| 8 |
"do_normalize": true,
|
| 9 |
+
"do_pad": null,
|
| 10 |
"do_rescale": true,
|
| 11 |
"do_resize": true,
|
| 12 |
"do_sample_frames": false,
|
|
|
|
| 28 |
"min_frames": 4,
|
| 29 |
"min_pixels": 3136,
|
| 30 |
"num_frames": null,
|
|
|
|
| 31 |
"patch_size": 14,
|
| 32 |
"processor_class": "Qwen2_5_VLProcessor",
|
| 33 |
"resample": 3,
|
|
|
|
| 37 |
"longest_edge": 12845056,
|
| 38 |
"shortest_edge": 3136
|
| 39 |
},
|
| 40 |
+
"size_divisor": null,
|
| 41 |
"temporal_patch_size": 2,
|
| 42 |
"video_metadata": null,
|
| 43 |
"video_processor_type": "Qwen2VLVideoProcessor"
|