Views
No views yet

Qwen/Qwen2-VL-2B-Instruct, and uses more than 5M of multimodal data as well as a small amount of plain text data.Cylingo/Xinyuan-VL- 2B.Cylingo/Xinyuan-VL-2B is consistent with using Qwen/Qwen2-VL-2B-Instruct:1from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor
2from qwen_vl_utils import process_vision_info
3
4# default: Load the model on the available device(s)
5model = Qwen2VLForConditionalGeneration.from_pretrained(
6 "Cylingo/Xinyuan-VL-2B", torch_dtype="auto", device_map="auto"
7)
8
9# default processer
10processor = AutoProcessor.from_pretrained("Cylingo/Xinyuan-VL-2B")
11
12messages = [
13 {
14 "role": "user",
15 "content": [
16 {
17 "type": "image",
18 "image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
19 },
20 {"type": "text", "text": "Describe this image."},
21 ],
22 }
23]
24
25# Preparation for inference
26text = processor.apply_chat_template(
27 messages, tokenize=False, add_generation_prompt=True
28)
29image_inputs, video_inputs = process_vision_info(messages)
30inputs = processor(
31 text=[text],
32 images=image_inputs,
33 videos=video_inputs,
34 padding=True,
35 return_tensors="pt",
36)
37inputs = inputs.to("cuda")
38
39# Inference: Generation of the output
40generated_ids = model.generate(**inputs, max_new_tokens=128)
41generated_ids_trimmed = [
42 out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
43]
44output_text = processor.batch_decode(
45 generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
46)
47print(output_text)
48
| Benchamrk | MiniCPM-2B | InternVL-2B | Qwen2-VL-2B | XinYuan-VL-2B |
|---|---|---|---|---|
| MMB-CN-V11-Test | 64.5 | 68.9 | 71.2 | 74.3 |
| MMB-EN-V11-Test | 65.8 | 70.2 | 73.2 | 76.5 |
| MMB-EN | 69.1 | 74.4 | 74.3 | 78.9 |
| MMB-CN | 66.5 | 71.2 | 73.8 | 76.12 |
| CCBench | 45.3 | 74.7 | 53.7 | 55.5 |
| MMT-Bench | 53.5 | 50.8 | 54.5 | 55.2 |
| RealWorld | 55.8 | 57.3 | 62.9 | 63.9 |
| SEEDBench_IMG | 67.1 | 70.9 | 72.86 | 73.4 |
| AI2D | 56.3 | 74.1 | 74.7 | 74.2 |
| MMMU | 38.2 | 36.3 | 41.1 | 40.9 |
| HallusionBench | 36.2 | 36.2 | 42.4 | 55.00 |
| POPE | 86.3 | 86.3 | 86.82 | 89.42 |
| MME | 1808.6 | 1876.8 | 1872.0 | 1854.9 |
| MMStar | 39.1 | 49.8 | 47.5 | 51.87 |
| SEEDBench2_Plus | 51.9 | 59.9 | 62.23 | 62.98 |
| BLINK | 41.2 | 42.8 | 43.92 | 42.98 |
| OCRBench | 605 | 781 | 794 | 782 |
| TextVQA | 74.1 | 73.4 | 79.7 | 77.6 |