Views
No views yet
1from transformers import AutoModelForCausalLM, AutoTokenizer
2from transformers import CLIPImageProcessor
3from PIL import Image
4import torch
5import requests
6from io import BytesIO
7
8
9image_url = 'https://github.com/user-attachments/assets/83258e94-5d61-48ef-a87f-80dd9d895524'
10response = requests.get(image_url)
11image_data = BytesIO(response.content)
12pil_image = Image.open(image_data)
13prompt = 'please describe the image in detail'
14model_path = 'WePOINTS/POINTS-Yi-1-5-9B-Chat'
15tokenizer = AutoTokenizer.from_pretrained(model_path)
16model = AutoModelForCausalLM.from_pretrained(
17 model_path, trust_remote_code=True, device_map='cuda').to(torch.bfloat16)
18image_processor = CLIPImageProcessor.from_pretrained(model_path)
19generation_config = {
20 'max_new_tokens': 1024,
21 'temperature': 0.0,
22 'top_p': 0.0,
23 'num_beams': 1,
24}
25res = model.chat(
26 pil_image,
27 prompt,
28 tokenizer,
29 image_processor,
30 True,
31 generation_config
32)
33print(res)| Benchmark | InternVL2-8B | LLaVA-OneVision | POINTS |
|---|---|---|---|
| MMBench-dev-en | - | 80.8 | 82.4 |
| MathVista | 58.3 | 62.3 | 63.0 |
| HallucinationBench | 45.0 | 31.6 | 47.8 |
| OCRBench | 79.4 | 62.2 | 71.9 |
| AI2D | 83.6 | 82.4 | 78.8 |
| MMVet | 54.3 | 51.9 | 49.2 |
| MMStar | 61.5 | 61.9 | 56.9 |
| MMMU | 51.2 | 47.9 | 47.6 |
| ScienceQA | 97.1 | 95.4 | 92.9 |
| MME | 2215.1 | 1993.6 | 2024.8 |
| RealWorldQA | 64.2 | 69.9 | 66.3 |
| LLaVA-Wild | 73.3 | 81.0 | 69.3 |
@article{liu2024points,
title={POINTS: Improving Your Vision-language Model with Affordable Strategies},
author={Liu, Yuan and Zhao, Zhongyin and Zhuang, Ziyuan and Tian, Le and Zhou, Xiao and Zhou, Jie},
journal={arXiv preprint arXiv:2409.04828},
year={2024}
}
@article{liu2024rethinking,
title={Rethinking Overlooked Aspects in Vision-Language Models},
author={Liu, Yuan and Tian, Le and Zhou, Xiao and Zhou, Jie},
journal={arXiv preprint arXiv:2405.11850},
year={2024}
}