Image-Text-to-Text
Transformers
Safetensors
qwen2_vl
Generated from Trainer
R1-V
trl
sft
conversational
text-generation-inference
Instructions to use bluuluu/Qwen2-VL-2B-Instruct-SFT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use bluuluu/Qwen2-VL-2B-Instruct-SFT with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="bluuluu/Qwen2-VL-2B-Instruct-SFT") 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, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("bluuluu/Qwen2-VL-2B-Instruct-SFT") model = AutoModelForMultimodalLM.from_pretrained("bluuluu/Qwen2-VL-2B-Instruct-SFT", device_map="auto") 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 Settings
- vLLM
How to use bluuluu/Qwen2-VL-2B-Instruct-SFT with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "bluuluu/Qwen2-VL-2B-Instruct-SFT" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "bluuluu/Qwen2-VL-2B-Instruct-SFT", "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/bluuluu/Qwen2-VL-2B-Instruct-SFT
- SGLang
How to use bluuluu/Qwen2-VL-2B-Instruct-SFT 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 "bluuluu/Qwen2-VL-2B-Instruct-SFT" \ --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": "bluuluu/Qwen2-VL-2B-Instruct-SFT", "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 "bluuluu/Qwen2-VL-2B-Instruct-SFT" \ --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": "bluuluu/Qwen2-VL-2B-Instruct-SFT", "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 bluuluu/Qwen2-VL-2B-Instruct-SFT with Docker Model Runner:
docker model run hf.co/bluuluu/Qwen2-VL-2B-Instruct-SFT
Training in progress, epoch 0
Browse files- config.json +42 -2
- model.safetensors +2 -2
- tokenizer_config.json +0 -1
- training_args.bin +1 -1
config.json
CHANGED
|
@@ -28,9 +28,48 @@
|
|
| 28 |
},
|
| 29 |
"rope_theta": 1000000.0,
|
| 30 |
"sliding_window": 32768,
|
| 31 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
"torch_dtype": "bfloat16",
|
| 33 |
-
"transformers_version": "4.
|
| 34 |
"use_cache": false,
|
| 35 |
"use_sliding_window": false,
|
| 36 |
"video_token_id": 151656,
|
|
@@ -41,6 +80,7 @@
|
|
| 41 |
"hidden_size": 1536,
|
| 42 |
"in_channels": 3,
|
| 43 |
"in_chans": 3,
|
|
|
|
| 44 |
"mlp_ratio": 4,
|
| 45 |
"model_type": "qwen2_vl",
|
| 46 |
"num_heads": 16,
|
|
|
|
| 28 |
},
|
| 29 |
"rope_theta": 1000000.0,
|
| 30 |
"sliding_window": 32768,
|
| 31 |
+
"text_config": {
|
| 32 |
+
"architectures": [
|
| 33 |
+
"Qwen2VLForConditionalGeneration"
|
| 34 |
+
],
|
| 35 |
+
"attention_dropout": 0.0,
|
| 36 |
+
"bos_token_id": 151643,
|
| 37 |
+
"eos_token_id": 151645,
|
| 38 |
+
"hidden_act": "silu",
|
| 39 |
+
"hidden_size": 1536,
|
| 40 |
+
"image_token_id": null,
|
| 41 |
+
"initializer_range": 0.02,
|
| 42 |
+
"intermediate_size": 8960,
|
| 43 |
+
"max_position_embeddings": 32768,
|
| 44 |
+
"max_window_layers": 28,
|
| 45 |
+
"model_type": "qwen2_vl_text",
|
| 46 |
+
"num_attention_heads": 12,
|
| 47 |
+
"num_hidden_layers": 28,
|
| 48 |
+
"num_key_value_heads": 2,
|
| 49 |
+
"rms_norm_eps": 1e-06,
|
| 50 |
+
"rope_scaling": {
|
| 51 |
+
"mrope_section": [
|
| 52 |
+
16,
|
| 53 |
+
24,
|
| 54 |
+
24
|
| 55 |
+
],
|
| 56 |
+
"rope_type": "default",
|
| 57 |
+
"type": "default"
|
| 58 |
+
},
|
| 59 |
+
"rope_theta": 1000000.0,
|
| 60 |
+
"sliding_window": 32768,
|
| 61 |
+
"tie_word_embeddings": true,
|
| 62 |
+
"torch_dtype": "bfloat16",
|
| 63 |
+
"use_cache": true,
|
| 64 |
+
"use_sliding_window": false,
|
| 65 |
+
"video_token_id": null,
|
| 66 |
+
"vision_end_token_id": 151653,
|
| 67 |
+
"vision_start_token_id": 151652,
|
| 68 |
+
"vision_token_id": 151654,
|
| 69 |
+
"vocab_size": 151936
|
| 70 |
+
},
|
| 71 |
"torch_dtype": "bfloat16",
|
| 72 |
+
"transformers_version": "4.52.0.dev0",
|
| 73 |
"use_cache": false,
|
| 74 |
"use_sliding_window": false,
|
| 75 |
"video_token_id": 151656,
|
|
|
|
| 80 |
"hidden_size": 1536,
|
| 81 |
"in_channels": 3,
|
| 82 |
"in_chans": 3,
|
| 83 |
+
"initializer_range": 0.02,
|
| 84 |
"mlp_ratio": 4,
|
| 85 |
"model_type": "qwen2_vl",
|
| 86 |
"num_heads": 16,
|
model.safetensors
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:d28a886119824ad565f6c16158e46d575945133d36e77f139bd430d5725ee8cc
|
| 3 |
+
size 3269852072
|
tokenizer_config.json
CHANGED
|
@@ -130,7 +130,6 @@
|
|
| 130 |
"<|video_pad|>"
|
| 131 |
],
|
| 132 |
"bos_token": null,
|
| 133 |
-
"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 %}",
|
| 134 |
"clean_up_tokenization_spaces": false,
|
| 135 |
"eos_token": "<|im_end|>",
|
| 136 |
"errors": "replace",
|
|
|
|
| 130 |
"<|video_pad|>"
|
| 131 |
],
|
| 132 |
"bos_token": null,
|
|
|
|
| 133 |
"clean_up_tokenization_spaces": false,
|
| 134 |
"eos_token": "<|im_end|>",
|
| 135 |
"errors": "replace",
|
training_args.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 7096
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c96d362fcf26f2b05f2a797bef3d6079376660bbbea529242c6249f3aeeba8de
|
| 3 |
size 7096
|