Improve language tag
Browse filesHi! As the model is multilingual, this is a PR to add other languages than English to the language tag to improve the referencing. Note that 29 languages are announced in the README, but only 13 are explicitly listed. I was therefore only able to add these 13 languages.
README.md
CHANGED
@@ -1,258 +1,171 @@
|
|
1 |
-
---
|
2 |
-
library_name: transformers
|
3 |
-
license: apache-2.0
|
4 |
-
language:
|
5 |
-
-
|
6 |
-
-
|
7 |
-
-
|
8 |
-
-
|
9 |
-
-
|
10 |
-
-
|
11 |
-
-
|
12 |
-
-
|
13 |
-
-
|
14 |
-
-
|
15 |
-
-
|
16 |
-
-
|
17 |
-
-
|
18 |
-
|
19 |
-
-
|
20 |
-
-
|
21 |
-
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
-
|
33 |
-
-
|
34 |
-
- gd
|
35 |
-
|
36 |
-
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
-
|
43 |
-
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
#
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
trust_remote_code=True
|
172 |
-
)
|
173 |
-
|
174 |
-
model_inputs = processor(text=[text], images=[image] return_tensors="pt").to(model.device)
|
175 |
-
|
176 |
-
generated_ids = model.generate(
|
177 |
-
**model_inputs,
|
178 |
-
max_new_tokens=128
|
179 |
-
)
|
180 |
-
|
181 |
-
generated_ids = [
|
182 |
-
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
183 |
-
]
|
184 |
-
|
185 |
-
response = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
186 |
-
|
187 |
-
```
|
188 |
-
|
189 |
-
#### Multiple Images
|
190 |
-
We natively support multi-image inputs. You only have to 1) include more `<image_placeholder>` while 2) passing all images of the *entire batch* as a flat list:
|
191 |
-
|
192 |
-
```python
|
193 |
-
[...]
|
194 |
-
# Variables reused from above.
|
195 |
-
|
196 |
-
processor.tokenizer.padding_side = "left" # default is 'right' but has to be 'left' for batched generation to work correctly!
|
197 |
-
|
198 |
-
image_multi_1, image_multi_2 = [...] # prepare additional images
|
199 |
-
|
200 |
-
prompt_multi = "What is the difference between the following images?\n<image_placeholder><image_placeholder>\nAnswer in German."
|
201 |
-
|
202 |
-
messages_multi = [
|
203 |
-
{"role": "system", "content": "You are a helpful assistant."},
|
204 |
-
{"role": "user", "content": prompt_multi}
|
205 |
-
]
|
206 |
-
|
207 |
-
text_multi = processor.apply_chat_template(
|
208 |
-
messages,
|
209 |
-
tokenize=False,
|
210 |
-
add_generation_prompt=True
|
211 |
-
)
|
212 |
-
|
213 |
-
model_inputs = processor(text=[text, text_multi], images=[image, image_multi_1, image_multi_2] return_tensors="pt").to(model.device)
|
214 |
-
|
215 |
-
generated_ids = model.generate(
|
216 |
-
**model_inputs,
|
217 |
-
max_new_tokens=128
|
218 |
-
)
|
219 |
-
|
220 |
-
[...]
|
221 |
-
|
222 |
-
```
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
## Bias, Risks, and Limitations
|
228 |
-
|
229 |
-
- General biases, risks, and limitations of large vision-language models like hallucinations or biases from training data apply.
|
230 |
-
- This is a research project and *not* recommended for production use.
|
231 |
-
- Multilingual: Performance and generation quality can differ widely between languages.
|
232 |
-
- OCR: Model struggles both with small text and writing in non-Latin scripts.
|
233 |
-
|
234 |
-
|
235 |
-
## Citation
|
236 |
-
|
237 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
238 |
-
|
239 |
-
**BibTeX:**
|
240 |
-
|
241 |
-
```
|
242 |
-
@article{centurio2025,
|
243 |
-
author = {Gregor Geigle and
|
244 |
-
Florian Schneider and
|
245 |
-
Carolin Holtermann and
|
246 |
-
Chris Biemann and
|
247 |
-
Radu Timofte and
|
248 |
-
Anne Lauscher and
|
249 |
-
Goran Glava\v{s}},
|
250 |
-
title = {Centurio: On Drivers of Multilingual Ability of Large Vision-Language Model},
|
251 |
-
journal = {arXiv},
|
252 |
-
volume = {abs/2501.05122},
|
253 |
-
year = {2025},
|
254 |
-
url = {https://arxiv.org/abs/2501.05122},
|
255 |
-
eprinttype = {arXiv},
|
256 |
-
eprint = {2501.05122},
|
257 |
-
}
|
258 |
```
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
license: apache-2.0
|
4 |
+
language:
|
5 |
+
- zho
|
6 |
+
- eng
|
7 |
+
- fra
|
8 |
+
- spa
|
9 |
+
- por
|
10 |
+
- deu
|
11 |
+
- ita
|
12 |
+
- rus
|
13 |
+
- jpn
|
14 |
+
- kor
|
15 |
+
- vie
|
16 |
+
- tha
|
17 |
+
- ara
|
18 |
+
base_model:
|
19 |
+
- Qwen/Qwen2.5-7B-Instruct
|
20 |
+
- timm/ViT-SO400M-14-SigLIP-384
|
21 |
+
pipeline_tag: image-text-to-text
|
22 |
+
---
|
23 |
+
|
24 |
+
# Centurio Qwen
|
25 |
+
|
26 |
+
## Model Details
|
27 |
+
|
28 |
+
### Model Description
|
29 |
+
|
30 |
+
<!-- Provide a longer summary of what this model is. -->
|
31 |
+
|
32 |
+
- **Model type:** Centurio is an open-source multilingual large vision-language model.
|
33 |
+
- **Training Data:** COMING SOON
|
34 |
+
- **Languages:** The model was trained with the following 100 languages: `af, am, ar, ar-eg, as, azb, be, bg, bm, bn, bo, bs, ca, ceb, cs, cy, da, de, du, el, en, eo, es, et, eu, fa, fi, fr, ga, gd, gl, ha, hi, hr, ht, hu, id, ig, is, it, iw, ja, jv, ka, ki, kk, km, ko, la, lb, ln, lo, lt, lv, mi, mr, ms, mt, my, no, oc, pa, pl, pt, qu, ro, ru, sa, sc, sd, sg, sk, sl, sm, so, sq, sr, ss, sv, sw, ta, te, th, ti, tl, tn, tpi, tr, ts, tw, uk, ur, uz, vi, war, wo, xh, yo, zh, zu
|
35 |
+
`
|
36 |
+
- **License:** This work is released under the Apache 2.0 license.
|
37 |
+
|
38 |
+
### Model Sources
|
39 |
+
|
40 |
+
<!-- Provide the basic links for the model. -->
|
41 |
+
|
42 |
+
- **Repository:** [gregor-ge.github.io/Centurio](https://gregor-ge.github.io/Centurio)
|
43 |
+
- **Paper:** [arXiv](https://arxiv.org/abs/2501.)
|
44 |
+
|
45 |
+
## Uses
|
46 |
+
|
47 |
+
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
48 |
+
|
49 |
+
### Direct Use
|
50 |
+
|
51 |
+
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
52 |
+
|
53 |
+
The model can be used directly through the `transformers` library with our custom code.
|
54 |
+
|
55 |
+
```python
|
56 |
+
from transformers import AutoModelForCausalLM, AutoProcessor
|
57 |
+
import timm
|
58 |
+
from PIL import Image
|
59 |
+
import requests
|
60 |
+
|
61 |
+
url = "https://upload.wikimedia.org/wikipedia/commons/b/bd/Golden_Retriever_Dukedestiny01_drvd.jpg"
|
62 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
63 |
+
|
64 |
+
model_name = "WueNLP/centurio_qwen"
|
65 |
+
|
66 |
+
processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
|
67 |
+
|
68 |
+
## Appearance of images in the prompt are indicates with '<image_placeholder>'!
|
69 |
+
prompt = "<image_placeholder>\nBriefly describe the image in German."
|
70 |
+
|
71 |
+
messages = [
|
72 |
+
{"role": "system", "content": "You are a helpful assistant."}, # This is the system prompt used during our training.
|
73 |
+
{"role": "user", "content": prompt}
|
74 |
+
]
|
75 |
+
|
76 |
+
text = processor.apply_chat_template(
|
77 |
+
messages,
|
78 |
+
tokenize=False,
|
79 |
+
add_generation_prompt=True
|
80 |
+
)
|
81 |
+
|
82 |
+
model = AutoModelForCausalLM.from_pretrained(
|
83 |
+
model_name,
|
84 |
+
trust_remote_code=True
|
85 |
+
)
|
86 |
+
|
87 |
+
model_inputs = processor(text=[text], images=[image] return_tensors="pt").to(model.device)
|
88 |
+
|
89 |
+
generated_ids = model.generate(
|
90 |
+
**model_inputs,
|
91 |
+
max_new_tokens=128
|
92 |
+
)
|
93 |
+
|
94 |
+
generated_ids = [
|
95 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
96 |
+
]
|
97 |
+
|
98 |
+
response = processor.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
99 |
+
|
100 |
+
```
|
101 |
+
|
102 |
+
#### Multiple Images
|
103 |
+
We natively support multi-image inputs. You only have to 1) include more `<image_placeholder>` while 2) passing all images of the *entire batch* as a flat list:
|
104 |
+
|
105 |
+
```python
|
106 |
+
[...]
|
107 |
+
# Variables reused from above.
|
108 |
+
|
109 |
+
processor.tokenizer.padding_side = "left" # default is 'right' but has to be 'left' for batched generation to work correctly!
|
110 |
+
|
111 |
+
image_multi_1, image_multi_2 = [...] # prepare additional images
|
112 |
+
|
113 |
+
prompt_multi = "What is the difference between the following images?\n<image_placeholder><image_placeholder>\nAnswer in German."
|
114 |
+
|
115 |
+
messages_multi = [
|
116 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
117 |
+
{"role": "user", "content": prompt_multi}
|
118 |
+
]
|
119 |
+
|
120 |
+
text_multi = processor.apply_chat_template(
|
121 |
+
messages,
|
122 |
+
tokenize=False,
|
123 |
+
add_generation_prompt=True
|
124 |
+
)
|
125 |
+
|
126 |
+
model_inputs = processor(text=[text, text_multi], images=[image, image_multi_1, image_multi_2] return_tensors="pt").to(model.device)
|
127 |
+
|
128 |
+
generated_ids = model.generate(
|
129 |
+
**model_inputs,
|
130 |
+
max_new_tokens=128
|
131 |
+
)
|
132 |
+
|
133 |
+
[...]
|
134 |
+
|
135 |
+
```
|
136 |
+
|
137 |
+
|
138 |
+
|
139 |
+
|
140 |
+
## Bias, Risks, and Limitations
|
141 |
+
|
142 |
+
- General biases, risks, and limitations of large vision-language models like hallucinations or biases from training data apply.
|
143 |
+
- This is a research project and *not* recommended for production use.
|
144 |
+
- Multilingual: Performance and generation quality can differ widely between languages.
|
145 |
+
- OCR: Model struggles both with small text and writing in non-Latin scripts.
|
146 |
+
|
147 |
+
|
148 |
+
## Citation
|
149 |
+
|
150 |
+
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
151 |
+
|
152 |
+
**BibTeX:**
|
153 |
+
|
154 |
+
```
|
155 |
+
@article{centurio2025,
|
156 |
+
author = {Gregor Geigle and
|
157 |
+
Florian Schneider and
|
158 |
+
Carolin Holtermann and
|
159 |
+
Chris Biemann and
|
160 |
+
Radu Timofte and
|
161 |
+
Anne Lauscher and
|
162 |
+
Goran Glava\v{s}},
|
163 |
+
title = {Centurio: On Drivers of Multilingual Ability of Large Vision-Language Model},
|
164 |
+
journal = {arXiv},
|
165 |
+
volume = {abs/2501.05122},
|
166 |
+
year = {2025},
|
167 |
+
url = {https://arxiv.org/abs/2501.05122},
|
168 |
+
eprinttype = {arXiv},
|
169 |
+
eprint = {2501.05122},
|
170 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
171 |
```
|