Views
No views yet
| Model | ChartQA Accuracy | Improvement |
|---|---|---|
| Qwen 2.5 7B base | 57.5% | - |
| AskAnythingInCharts-Qwen2.5 7B | 66.0% | +8.5% |
1from transformers import AutoProcessor, Qwen2_5_VLForConditionalGeneration
2from peft import PeftModel
3from PIL import Image
4
5# Load base model
6base_model = Qwen2_5_VLForConditionalGeneration.from_pretrained(
7 "Qwen/Qwen2.5-VL-7B-Instruct",
8 torch_dtype="bfloat16",
9 device_map="auto"
10)
11
12# Load LoRA adapter
13model = PeftModel.from_pretrained(base_model, "prakashchhipa/Qwen2.5-VL-7B-ChartQA-LoRA")
14model = model.merge_and_unload()
15
16# Load processor
17processor = AutoProcessor.from_pretrained("prakashchhipa/Qwen2.5-VL-7B-ChartQA-LoRA")
18
19# Inference
20image = Image.open("chart.png")
21question = "What is the highest value in the chart?"
22
23messages = [
24 {"role": "user", "content": [
25 {"type": "text", "text": question},
26 {"type": "image", "image": image}
27 ]}
28]
29
30text = processor.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
31# Process and generate response...1@misc{askanything-charts-qwen2.5,
2 title={AskAnythingInCharts-Qwen2.5-7B: Fine-tuned Qwen2.5-VL for Chart Understanding},
3 author={Prakash Chandra Chhipa},
4 year={2025},
5 url={https://huggingface.co/prakashchhipa/Qwen2.5-VL-7B-ChartQA-LoRA}
6}