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
End of training
Browse files- README.md +3 -1
- config.json +1 -1
README.md
CHANGED
|
@@ -1,9 +1,11 @@
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen2-VL-2B-Instruct
|
|
|
|
| 3 |
library_name: transformers
|
| 4 |
model_name: Qwen2-VL-2B-Instruct-SFT
|
| 5 |
tags:
|
| 6 |
- generated_from_trainer
|
|
|
|
| 7 |
- trl
|
| 8 |
- sft
|
| 9 |
licence: license
|
|
@@ -11,7 +13,7 @@ licence: license
|
|
| 11 |
|
| 12 |
# Model Card for Qwen2-VL-2B-Instruct-SFT
|
| 13 |
|
| 14 |
-
This model is a fine-tuned version of [Qwen/Qwen2-VL-2B-Instruct](https://huggingface.co/Qwen/Qwen2-VL-2B-Instruct).
|
| 15 |
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 16 |
|
| 17 |
## Quick start
|
|
|
|
| 1 |
---
|
| 2 |
base_model: Qwen/Qwen2-VL-2B-Instruct
|
| 3 |
+
datasets: MMInstruction/Clevr_CoGenT_TrainA_R1
|
| 4 |
library_name: transformers
|
| 5 |
model_name: Qwen2-VL-2B-Instruct-SFT
|
| 6 |
tags:
|
| 7 |
- generated_from_trainer
|
| 8 |
+
- R1-V
|
| 9 |
- trl
|
| 10 |
- sft
|
| 11 |
licence: license
|
|
|
|
| 13 |
|
| 14 |
# Model Card for Qwen2-VL-2B-Instruct-SFT
|
| 15 |
|
| 16 |
+
This model is a fine-tuned version of [Qwen/Qwen2-VL-2B-Instruct](https://huggingface.co/Qwen/Qwen2-VL-2B-Instruct) on the [MMInstruction/Clevr_CoGenT_TrainA_R1](https://huggingface.co/datasets/MMInstruction/Clevr_CoGenT_TrainA_R1) dataset.
|
| 17 |
It has been trained using [TRL](https://github.com/huggingface/trl).
|
| 18 |
|
| 19 |
## Quick start
|
config.json
CHANGED
|
@@ -70,7 +70,7 @@
|
|
| 70 |
},
|
| 71 |
"torch_dtype": "bfloat16",
|
| 72 |
"transformers_version": "4.52.0.dev0",
|
| 73 |
-
"use_cache":
|
| 74 |
"use_sliding_window": false,
|
| 75 |
"video_token_id": 151656,
|
| 76 |
"vision_config": {
|
|
|
|
| 70 |
},
|
| 71 |
"torch_dtype": "bfloat16",
|
| 72 |
"transformers_version": "4.52.0.dev0",
|
| 73 |
+
"use_cache": true,
|
| 74 |
"use_sliding_window": false,
|
| 75 |
"video_token_id": 151656,
|
| 76 |
"vision_config": {
|