How to use from the
Use from the
Transformers library
# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("image-text-to-text", model="yongxianwei/Qwen2.5-VL-32B-VQA")
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("yongxianwei/Qwen2.5-VL-32B-VQA")
model = AutoModelForMultimodalLM.from_pretrained("yongxianwei/Qwen2.5-VL-32B-VQA", 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]:]))
Quick Links

Qwen2.5-VL-7B-VQA

This is a LoRA adapter for Qwen2.5-VL-7B fine-tuned on Visual Question Answering tasks.

Model Details

  • Base Model: Qwen/Qwen2.5-VL-7B
  • Task: Visual Question Answering
  • Training Method: LoRA (Low-Rank Adaptation)
  • Framework: Transformers

Usage

from transformers import AutoModelForVision2Seq, AutoProcessor
from peft import PeftModel

# Load base model
base_model = AutoModelForVision2Seq.from_pretrained(
    "Qwen/Qwen2.5-VL-7B",
    trust_remote_code=True
)

# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "yongxianwei/Qwen2.5-VL-7B-VQA")
processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-VL-7B", trust_remote_code=True)

# Inference
# ... your inference code ...

Training Details

Fine-tuned using LoRA on specific Visual Question Answering datasets.

Citation

@misc{qwen2.5-vl-visual question answering,
  author = {Yongxian Wei},
  title = {Qwen2.5-VL LoRA for Visual Question Answering},
  year = {2024},
  publisher = {Hugging Face},
  url = {https://huggingface.co/yongxianwei/Qwen2.5-VL-7B-VQA}
}
Downloads last month
24
Safetensors
Model size
33B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for yongxianwei/Qwen2.5-VL-32B-VQA

Adapters
1 model

Collection including yongxianwei/Qwen2.5-VL-32B-VQA