Instructions to use gatilin/qwen3-vl-2b-referring with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gatilin/qwen3-vl-2b-referring with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="gatilin/qwen3-vl-2b-referring") 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)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("gatilin/qwen3-vl-2b-referring") model = AutoModelForMultimodalLM.from_pretrained("gatilin/qwen3-vl-2b-referring", 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=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gatilin/qwen3-vl-2b-referring with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gatilin/qwen3-vl-2b-referring" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gatilin/qwen3-vl-2b-referring", "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/gatilin/qwen3-vl-2b-referring
- SGLang
How to use gatilin/qwen3-vl-2b-referring 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 "gatilin/qwen3-vl-2b-referring" \ --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": "gatilin/qwen3-vl-2b-referring", "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 "gatilin/qwen3-vl-2b-referring" \ --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": "gatilin/qwen3-vl-2b-referring", "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 gatilin/qwen3-vl-2b-referring with Docker Model Runner:
docker model run hf.co/gatilin/qwen3-vl-2b-referring
Qwen3-VL-2B Referring (LoRA merged)
ๅบไบ Qwen3-VL-2B-Instruct ็ referring ๅคๆญๆจกๅ๏ผ็ปๅฎๅพ็ใ่ฅๅนฒๅ้ๆฃๆตๆกๅไธๆฎตๆๆฌๆ่ฟฐ๏ผ ๅคๆญๆฏไธชๆกๅ ๅ ๅฎนๆฏๅฆๅน้ ๆ่ฟฐ๏ผ่พๅบๅน้ ็ฝฎไฟกๅบฆ [0, 1]ใ ๅ ธๅ็จๆณๆฏๆฅๅจๅผๆพ่ฏๆฑๆฃๆตๅจ๏ผๅฆ DINOx๏ผไนๅๅไบๆฌกๅคๅฎ๏ผไพๅฆ "ๆฃๆตๅพ็ไธญๆฏๅฆๆไบบ" โ ๆฃๆตๅบ person ๆก โ ๆฌๆจกๅ้ๆก็กฎ่ฎคใ
ๆ้ๅฝขๅผ
ๆฌไปๅบไธบ LoRA ๅๅนถๅ็ๅฎๆดๆจกๅ๏ผmerged full model๏ผ๏ผๅฏ็ฌ็ซๅ ่ฝฝ๏ผๆ ้ๅบๅบงใ
LoRA ่ฎญ็ป้
็ฝฎ่ง lora_adapter_config.json๏ผr=64, alpha=64, ็ฎๆ q/k/v/o_proj๏ผiteration 271950๏ผใ
ๅๅง adapter ๅบๅบงไธบ Qwen/Qwen3-VL-2B-Instructใ
ๆไปถ่ฏดๆ
| ๆไปถ | ่ฏดๆ |
|---|---|
model.safetensors |
ๅๅนถๅๅฎๆดๆ้๏ผbf16, ~4GB๏ผ |
config.json / generation_config.json |
ๆจกๅ้ ็ฝฎ๏ผQwen3VL ๆถๆ๏ผ |
tokenizer.json / tokenizer_config.json / chat_template.jinja |
ๅ่ฏๅจไธๅฏน่ฏๆจกๆฟ |
processor_config.json |
ๅพๅ/่ง้ขๅค็ๅจ้ ็ฝฎ |
lora_adapter_config.json |
่ฎญ็ปๆถ็ LoRA adapter ้ ็ฝฎ๏ผ็ๆกฃ๏ผ |
infer_referring.py |
็ฌ็ซๆจ็ๅ ่ฝฝไปฃ็ |
ๅฟซ้ไฝฟ็จ
from infer_referring import ReferringPredictor
predictor = ReferringPredictor(model_dir=".")
confs = predictor.inference(
"demo.jpg",
bboxes=[[119, 136, 475, 1081], [10, 323, 217, 1025]],
prompt="ๆฃๆตๅพ็ไธญๆฏๅฆๆไบบ",
)
# [0.9821, 0.9517] ๆฏไธชๆก็ๅน้
็ฝฎไฟกๅบฆ๏ผ>0.5 ่งไธบๅน้
่พๅ ฅๆ ผๅผ๏ผๆจ็ๅ่ฎฎ๏ผ
ๆจกๅ้็จ ๅ
จๅฑไธไธๆ + ๆก่ฃๅช ๅๅพ่พๅ
ฅ๏ผ
ๅ
จๅฑๅพ็ผฉๆพๅฐ 512 ้ฟ่พน๏ผๅ้ๆกๆๆฏไพ่ฃๅชๅ้ๅ
ฅ๏ผ
่พๅ
ฅๅบๅไธบ [vision_start] global_patch [image_pad...] crop_patch [vision_end] promptๆๆฌ๏ผ
ไป
ๅฏนๅบๅๆซไฝ logits ็ๅไธคไธช token ๅ softmax๏ผๅ index 1 ไฝไธบๅน้
็ฝฎไฟกๅบฆใ
ๆๆฌๆฏๆไธญๆๅไปปๆ่ฏญ็งใ
่ฎญ็ปไฟกๆฏ
- ไปปๅก: referring ไบๅ็ฑป๏ผๆกๅ ๅ ๅฎนไธๆๆฌๆ่ฟฐๆฏๅฆๅน้ ๏ผ
- ๅพฎ่ฐๆนๅผ: LoRA๏ผr=64, dropout=0, ็ฎๆ ๆจกๅ q_proj/k_proj/v_proj/o_proj๏ผ
- ่ฎญ็ปๆญฅๆฐ: iteration 271950
- ๅบๅบง: Qwen3-VL-2B-Instruct (bf16)
- Downloads last month
- 6
Model tree for gatilin/qwen3-vl-2b-referring
Base model
Qwen/Qwen3-VL-2B-Instruct