Downloads · 30 days
6
16% of all-time downloads
lognat0704/qwen2-7b-instruct-trl-sft-ChartQA
qwen2-7b-instruct-trl-sft-ChartQA is a image-text-to-text model from lognat0704. Use it for the image-text-to-text task on the model card, and read the license before you ship it in a product. It is set up for peft. The card lists the license as apache-2.0.
A PEFT LoRA adapter that fine-tunes Qwen/Qwen2-VL-7B-Instruct for chart understanding and visual question answering on the ChartQA dataset, trained with the TRL SFTTrainer.
Downloads · 30 days
6
16% of all-time downloads
All-time downloads
37
Public
Repo size
21.5 MB
Likes
0
Public
Click a slice to open those files.
.json14.2 MB · 55%
From the Hugging Face model README
A PEFT LoRA adapter that fine-tunes
Qwen/Qwen2-VL-7B-Instruct for chart
understanding and visual question answering on the
ChartQA dataset, trained with the
TRL SFTTrainer.
Given a chart image and a natural-language question, the model reasons over the chart's visual elements (bars, lines, axes, labels) to produce an answer.
| Setting | Value |
|---|---|
| Base model | Qwen/Qwen2-VL-7B-Instruct |
| Method | Supervised fine-tuning (TRL SFTTrainer) |
| Adapter | LoRA (PEFT) |
Rank (r) | 8 |
lora_alpha | 16 |
| Target modules | q_proj, v_proj |
| Dataset | ChartQA |
from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
from peft import PeftModel
import torch
base = Qwen2VLForConditionalGeneration.from_pretrained(
"Qwen/Qwen2-VL-7B-Instruct", torch_dtype=torch.bfloat16, device_map="auto"
)
model = PeftModel.from_pretrained(base, "lognat0704/qwen2-7b-instruct-trl-sft-ChartQA")
processor = AutoProcessor.from_pretrained("Qwen/Qwen2-VL-7B-Instruct")
messages = [{
"role": "user",
"content": [
{"type": "image", "image": "chart.png"},
{"type": "text", "text": "What is the highest value in the chart?"},
],
}]
# See the Qwen2-VL docs for full multimodal preprocessing.
Qwen/Qwen2-VL-7B-Instruct.