thomas-yanxin
commited on
Commit
•
3c1146a
1
Parent(s):
01d49e6
Update README.md
Browse files
README.md
CHANGED
@@ -9,10 +9,80 @@ tags:
|
|
9 |
library_name: transformers
|
10 |
---
|
11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
We evaluated **[XinYuan-VL-2B](https://huggingface.co/thomas-yanxin/XinYuan-VL-2B)** using the [VLMEvalKit](https://github.com/open-compass/VLMEvalKit) toolkit across the following benchmarks and found that **XinYuan-VL-2B** **outperformed** [Qwen/Qwen2-VL-2B-Instruct](https://huggingface.co/Qwen/Qwen2-VL-2B-Instruct) released by Alibaba Cloud, as well as other models of comparable parameter scale that have significant influence in the open-source community.
|
13 |
|
14 |
-
|
|
|
|
|
15 |
|
|
|
16 |
|
17 |
| Benchamrk | MiniCPM-2B | InternVL-2B | Qwen2-VL-2B | **XinYuan-VL-2B** |
|
18 |
| :---: | :---: | :---: | :---: | :---: |
|
|
|
9 |
library_name: transformers
|
10 |
---
|
11 |
|
12 |
+
|
13 |
+
## Introduction
|
14 |
+
|
15 |
+
`Cylingo/Xinyuan-VL-2B` is a high-performance multimodal large model for the end-side from the Cylingo Group, which is fine-tuned with `Qwen/Qwen2-VL-2B-Instruct`, and uses more than 5M of multimodal data as well as a small amount of plain text data.
|
16 |
+
|
17 |
+
It performs well on several authoritative Benchmarks.
|
18 |
+
|
19 |
+
## How to use
|
20 |
+
|
21 |
+
In order to rely on the thriving ecology of the open source community, we chose to fine-tune [Qwen/Qwen2-VL-2B-Instruct](https://huggingface.co/Qwen/Qwen2-VL-2B-Instruct) to form our `Cylingo/Xinyuan-VL- 2B`.
|
22 |
+
|
23 |
+
Thus, using `Cylingo/Xinyuan-VL-2B` is consistent with using `Qwen/Qwen2-VL-2B-Instruct`:
|
24 |
+
|
25 |
+
```Python
|
26 |
+
from transformers import Qwen2VLForConditionalGeneration, AutoTokenizer, AutoProcessor
|
27 |
+
from qwen_vl_utils import process_vision_info
|
28 |
+
|
29 |
+
# default: Load the model on the available device(s)
|
30 |
+
model = Qwen2VLForConditionalGeneration.from_pretrained(
|
31 |
+
"Cylingo/Xinyuan-VL-2B", torch_dtype="auto", device_map="auto"
|
32 |
+
)
|
33 |
+
|
34 |
+
# default processer
|
35 |
+
processor = AutoProcessor.from_pretrained("Cylingo/Xinyuan-VL-2B")
|
36 |
+
|
37 |
+
messages = [
|
38 |
+
{
|
39 |
+
"role": "user",
|
40 |
+
"content": [
|
41 |
+
{
|
42 |
+
"type": "image",
|
43 |
+
"image": "https://qianwen-res.oss-cn-beijing.aliyuncs.com/Qwen-VL/assets/demo.jpeg",
|
44 |
+
},
|
45 |
+
{"type": "text", "text": "Describe this image."},
|
46 |
+
],
|
47 |
+
}
|
48 |
+
]
|
49 |
+
|
50 |
+
# Preparation for inference
|
51 |
+
text = processor.apply_chat_template(
|
52 |
+
messages, tokenize=False, add_generation_prompt=True
|
53 |
+
)
|
54 |
+
image_inputs, video_inputs = process_vision_info(messages)
|
55 |
+
inputs = processor(
|
56 |
+
text=[text],
|
57 |
+
images=image_inputs,
|
58 |
+
videos=video_inputs,
|
59 |
+
padding=True,
|
60 |
+
return_tensors="pt",
|
61 |
+
)
|
62 |
+
inputs = inputs.to("cuda")
|
63 |
+
|
64 |
+
# Inference: Generation of the output
|
65 |
+
generated_ids = model.generate(**inputs, max_new_tokens=128)
|
66 |
+
generated_ids_trimmed = [
|
67 |
+
out_ids[len(in_ids) :] for in_ids, out_ids in zip(inputs.input_ids, generated_ids)
|
68 |
+
]
|
69 |
+
output_text = processor.batch_decode(
|
70 |
+
generated_ids_trimmed, skip_special_tokens=True, clean_up_tokenization_spaces=False
|
71 |
+
)
|
72 |
+
print(output_text)
|
73 |
+
|
74 |
+
```
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
## Evaluation
|
79 |
We evaluated **[XinYuan-VL-2B](https://huggingface.co/thomas-yanxin/XinYuan-VL-2B)** using the [VLMEvalKit](https://github.com/open-compass/VLMEvalKit) toolkit across the following benchmarks and found that **XinYuan-VL-2B** **outperformed** [Qwen/Qwen2-VL-2B-Instruct](https://huggingface.co/Qwen/Qwen2-VL-2B-Instruct) released by Alibaba Cloud, as well as other models of comparable parameter scale that have significant influence in the open-source community.
|
80 |
|
81 |
+
<p align="center">
|
82 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/6299c90ef1f2a097fcaa1293/7ThTCYfd_lDzsvaFLlUv2.png">
|
83 |
+
</p>
|
84 |
|
85 |
+
You can see the results in [opencompass/open_vlm_leaderboard](https://huggingface.co/spaces/opencompass/open_vlm_leaderboard):
|
86 |
|
87 |
| Benchamrk | MiniCPM-2B | InternVL-2B | Qwen2-VL-2B | **XinYuan-VL-2B** |
|
88 |
| :---: | :---: | :---: | :---: | :---: |
|