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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- Emova-ollm/temp
|
5 |
+
- Emova-ollm/emova-sft-4m
|
6 |
+
- Emova-ollm/emova-sft-speech-231k
|
7 |
+
language:
|
8 |
+
- en
|
9 |
+
- zh
|
10 |
+
base_model:
|
11 |
+
- Emova-ollm/qwen2vit600m
|
12 |
+
- Emova-ollm/Qwen2.5-7B-Instruct_add_speech_token_4096_nostrip
|
13 |
+
new_version: Emova-ollm/emova-qwen-2-5-7b-hf
|
14 |
+
library_name: transformers
|
15 |
+
tags:
|
16 |
+
- Omni-modal-LLM
|
17 |
+
- Multi-modal-LLM
|
18 |
+
- Emotional-spoken-dialogue
|
19 |
+
model-index:
|
20 |
+
- name: emova-qwen-2-5-7b
|
21 |
+
results:
|
22 |
+
- task:
|
23 |
+
type: multimodal
|
24 |
+
dataset:
|
25 |
+
name: AI2D
|
26 |
+
type: ai2d
|
27 |
+
metrics:
|
28 |
+
- type: accuracy
|
29 |
+
value: 81.7
|
30 |
+
name: accuracy
|
31 |
+
verified: true
|
32 |
+
- task:
|
33 |
+
type: multimodal
|
34 |
+
dataset:
|
35 |
+
name: ChartQA
|
36 |
+
type: chartqa
|
37 |
+
metrics:
|
38 |
+
- type: accuracy
|
39 |
+
value: 84.9
|
40 |
+
name: accuracy
|
41 |
+
verified: true
|
42 |
+
- task:
|
43 |
+
type: multimodal
|
44 |
+
dataset:
|
45 |
+
name: DocVQA
|
46 |
+
type: docvqa
|
47 |
+
metrics:
|
48 |
+
- type: accuracy
|
49 |
+
value: 94.2
|
50 |
+
name: accuracy
|
51 |
+
verified: true
|
52 |
+
- task:
|
53 |
+
type: multimodal
|
54 |
+
dataset:
|
55 |
+
name: InfoVQA
|
56 |
+
type: infovqa
|
57 |
+
metrics:
|
58 |
+
- type: accuracy
|
59 |
+
value: 75.1
|
60 |
+
name: accuracy
|
61 |
+
verified: true
|
62 |
+
- task:
|
63 |
+
type: multimodal
|
64 |
+
dataset:
|
65 |
+
name: MathVerse
|
66 |
+
type: mathverse
|
67 |
+
metrics:
|
68 |
+
- type: accuracy
|
69 |
+
value: 40.9
|
70 |
+
name: accuracy
|
71 |
+
verified: true
|
72 |
+
- task:
|
73 |
+
type: multimodal
|
74 |
+
dataset:
|
75 |
+
name: MathVista
|
76 |
+
type: mathvista
|
77 |
+
metrics:
|
78 |
+
- type: accuracy
|
79 |
+
value: 65.5
|
80 |
+
name: accuracy
|
81 |
+
verified: true
|
82 |
+
- task:
|
83 |
+
type: multimodal
|
84 |
+
dataset:
|
85 |
+
name: MMBench
|
86 |
+
type: mmbench
|
87 |
+
metrics:
|
88 |
+
- type: accuracy
|
89 |
+
value: 83
|
90 |
+
name: accuracy
|
91 |
+
verified: true
|
92 |
+
- task:
|
93 |
+
type: multimodal
|
94 |
+
dataset:
|
95 |
+
name: MME
|
96 |
+
type: mme
|
97 |
+
metrics:
|
98 |
+
- type: score
|
99 |
+
value: 2317
|
100 |
+
name: score
|
101 |
+
verified: true
|
102 |
+
- task:
|
103 |
+
type: multimodal
|
104 |
+
dataset:
|
105 |
+
name: MMVet
|
106 |
+
type: mmvet
|
107 |
+
metrics:
|
108 |
+
- type: accuracy
|
109 |
+
value: 59.4
|
110 |
+
name: accuracy
|
111 |
+
verified: true
|
112 |
+
- task:
|
113 |
+
type: multimodal
|
114 |
+
dataset:
|
115 |
+
name: OCRBench
|
116 |
+
type: ocrbench
|
117 |
+
metrics:
|
118 |
+
- type: accuracy
|
119 |
+
value: 814
|
120 |
+
name: accuracy
|
121 |
+
verified: true
|
122 |
+
- task:
|
123 |
+
type: multimodal
|
124 |
+
dataset:
|
125 |
+
name: RealWorldQA
|
126 |
+
type: realworldqa
|
127 |
+
metrics:
|
128 |
+
- type: accuracy
|
129 |
+
value: 67.5
|
130 |
+
name: accuracy
|
131 |
+
verified: true
|
132 |
+
- task:
|
133 |
+
type: multimodal
|
134 |
+
dataset:
|
135 |
+
name: Seed-Bench-Image
|
136 |
+
type: seed-bench-image
|
137 |
+
metrics:
|
138 |
+
- type: accuracy
|
139 |
+
value: 75.5
|
140 |
+
name: accuracy
|
141 |
+
verified: true
|
142 |
+
- task:
|
143 |
+
type: multimodal
|
144 |
+
dataset:
|
145 |
+
name: Science-QA
|
146 |
+
type: science-qa
|
147 |
+
metrics:
|
148 |
+
- type: accuracy
|
149 |
+
value: 96.4
|
150 |
+
name: accuracy
|
151 |
+
verified: true
|
152 |
+
- task:
|
153 |
+
type: multimodal
|
154 |
+
dataset:
|
155 |
+
name: TextVQA
|
156 |
+
type: textvqa
|
157 |
+
metrics:
|
158 |
+
- type: accuracy
|
159 |
+
value: 78
|
160 |
+
name: accuracy
|
161 |
+
verified: true
|
162 |
+
- task:
|
163 |
+
name: Automatic Speech Recognition
|
164 |
+
type: automatic-speech-recognition
|
165 |
+
dataset:
|
166 |
+
name: LibriSpeech (clean)
|
167 |
+
type: librispeech_asr
|
168 |
+
config: clean
|
169 |
+
split: test
|
170 |
+
args:
|
171 |
+
language: en
|
172 |
+
metrics:
|
173 |
+
- name: Test WER
|
174 |
+
type: wer
|
175 |
+
value: 4.1
|
176 |
+
---
|
177 |
+
|
178 |
+
# EMOVA-Qwen-2.5-7B
|
179 |
+
|
180 |
+
<div align="center">
|
181 |
+
|
182 |
+
<img src="https://emova-ollm.github.io/static/images/icons/emova_icon2.png" width="300em"></img>
|
183 |
+
|
184 |
+
π€ [EMOVA-Models](https://huggingface.co/collections/Emova-ollm/emova-models-67779d377bb8261e6057a320) | π€ [EMOVA-Datasets](https://huggingface.co/collections/Emova-ollm/emova-datasets-67779be7d02447a2d0891bf6) | π€ [EMOVA-Demo](https://huggingface.co/spaces/Emova-ollm/EMOVA-demo) <br/>
|
185 |
+
π [Paper](https://arxiv.org/abs/2409.18042) | π [Project-Page](https://emova-ollm.github.io/) | π» [Github](https://github.com/emova-ollm/EMOVA) | π» [EMOVA-Speech-Tokenizer-Github](https://github.com/emova-ollm/EMOVA_speech_tokenizer)
|
186 |
+
|
187 |
+
</div>
|
188 |
+
|
189 |
+
## Model Summary
|
190 |
+
|
191 |
+
**EMOVA** (**EM**otionally **O**mni-present **V**oice **A**ssistant) is a novel end-to-end omni-modal LLM that can see, hear and speak without relying on external models. Given the omni-modal (i.e., textual, visual and speech) inputs, EMOVA can generate both textual and speech responses with vivid emotional controls by utilizing the speech decoder together with a style encoder. EMOVA possesses general omni-modal understanding and generation capabilities, featuring its superiority in advanced vision-language understanding, emotional spoken dialogue, and spoken dialogue with structural data understanding. We summarize its key advantages as:
|
192 |
+
|
193 |
+
- **State-of-the-art omni-modality performance**: EMOVA achieves state-of-the-art comparable results on both **vision-language** and **speech** benchmarks simultaneously. Our best performing model, **EMOVA-72B**, even surpasses commercial models including GPT-4o and Gemini Pro 1.5.
|
194 |
+
- **Emotional spoken dialogue**: A **semantic-acoustic disentangled** speech tokenizer and a lightweight **style control** module are adopted for seamless omni-modal alignment and diverse speech style controllability. EMOVA supports **bilingual (Chinese and English)** spoken dialogue with **24 speech style** controls (i.e., 2 speakers, 3 pitches and 4 emotions).
|
195 |
+
- **Diverse configurations**: We open-source 3 configurations, **EMOVA-3B/7B/72B**, to support omni-modal usage under different computational budgets. Check our [Model Zoo](https://huggingface.co/collections/Emova-ollm/emova-models-67779d377bb8261e6057a320) and find the best fit model for your computational devices!
|
196 |
+
|
197 |
+
<div align="center">
|
198 |
+
<img src="https://emova-ollm.github.io/static/images/model_architecture.png" width=100%></img>
|
199 |
+
</div>
|
200 |
+
|
201 |
+
|
202 |
+
## Performance
|
203 |
+
|
204 |
+
|
205 |
+
| Benchmarks | EMOVA-3B | EMOVA-7B | EMOVA-72B | GPT-4o | VITA 8x7B | VITA 1.5 | Baichuan-Omni |
|
206 |
+
|:------------------:|:-------: |:--------:|:---------:|:------:|:---------:|:--------:|:-------------:|
|
207 |
+
| **MME** | 2175 | 2317 | 2402 | 2310 | 2097 | 2311 | 2187 |
|
208 |
+
| **MMBench** | 79.2 | 83.0 | 86.4 | 83.4 | 71.8 | 76.6 | 76.2 |
|
209 |
+
| **SEED-Image** | 74.9 | 75.5 | 76.6 | 77.1 | 72.6 | 74.2 | 74.1 |
|
210 |
+
| **MM-Vet** | 57.3 | 59.4 | 64.8 | - | 41.6 | 51.1 | 65.4 |
|
211 |
+
| **RealWorldQA** | 62.6 | 67.5 | 71.0 | 75.4 | 59.0 | 66.8 | 62.6 |
|
212 |
+
| **TextVQA** | 77.2 | 78.0 | 81.4 | - | 71.8 | 74.9 | 74.3 |
|
213 |
+
| **ChartQA** | 81.5 | 84.9 | 88.7 | 85.7 | 76.6 | 79.6 | 79.6 |
|
214 |
+
| **DocVQA** | 93.5 | 94.2 | 95.9 | 92.8 | - | - | - |
|
215 |
+
| **InfoVQA** | 71.2 | 75.1 | 83.2 | - | - | - | - |
|
216 |
+
| **OCRBench** | 803 | 814 | 843 | 736 | 678 | 752 | 700 |
|
217 |
+
| **ScienceQA-Img** | 92.7 | 96.4 | 98.2 | - | - | - | - |
|
218 |
+
| **AI2D** | 78.6 | 81.7 | 85.8 | 84.6 | 73.1 | 79.3 | - |
|
219 |
+
| **MathVista** | 62.6 | 65.5 | 69.9 | 63.8 | 44.9 | 66.2 | 51.9 |
|
220 |
+
| **Mathverse** | 31.4 | 40.9 | 50.0 | - | - | - | - |
|
221 |
+
| **Librispeech (WERβ)** | 5.4 | 4.1 | 2.9 | - | 3.4 | 8.1 | - |
|
222 |
+
|
223 |
+
|
224 |
+
## Usage
|
225 |
+
|
226 |
+
This repo contains the **EMOVA-Qwen2.5-7B** checkpoint organized in the **HuggingFace format**, and thus, and be directly loaded with **transformers Auto APIs**.
|
227 |
+
|
228 |
+
```python
|
229 |
+
from transformers import AutoModel, AutoProcessor
|
230 |
+
from PIL import Image
|
231 |
+
import torch
|
232 |
+
|
233 |
+
### Uncomment if you want to use Ascend NPUs
|
234 |
+
# import torch_npu
|
235 |
+
# from torch_npu.contrib import transfer_to_npu
|
236 |
+
|
237 |
+
# prepare models and processors
|
238 |
+
model = AutoModel.from_pretrained(
|
239 |
+
"Emova-ollm/emova-qwen-2-5-7b-hf",
|
240 |
+
torch_dtype=torch.bfloat16,
|
241 |
+
attn_implementation='flash_attention_2', # OR 'sdpa' for Ascend NPUs
|
242 |
+
low_cpu_mem_usage=True,
|
243 |
+
trust_remote_code=True).eval().cuda()
|
244 |
+
processor = AutoProcessor.from_pretrained("Emova-ollm/emova-qwen-2-5-7b-hf", trust_remote_code=True)
|
245 |
+
|
246 |
+
# only necessary for spoken dialogue
|
247 |
+
# Note to inference with speech inputs/outputs, **emova_speech_tokenizer** is still a necessary dependency (https://huggingface.co/Emova-ollm/emova_speech_tokenizer_hf#install).
|
248 |
+
speeck_tokenizer = AutoModel.from_pretrained("Emova-ollm/emova_speech_tokenizer_hf", torch_dtype=torch.float32, trust_remote_code=True).eval().cuda()
|
249 |
+
processor.set_speech_tokenizer(speeck_tokenizer)
|
250 |
+
|
251 |
+
# Example 1: image-text
|
252 |
+
inputs = dict(
|
253 |
+
text=[
|
254 |
+
{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]},
|
255 |
+
{"role": "user", "content": [{"type": "image"}, {"type": "text", "text": "What's shown in this image?"}]},
|
256 |
+
{"role": "assistant", "content": [{"type": "text", "text": "This image shows a red stop sign."}]},
|
257 |
+
{"role": "user", "content": [{"type": "text", "text": "Describe the image in more details."}]},
|
258 |
+
],
|
259 |
+
images=Image.open('path/to/image')
|
260 |
+
)
|
261 |
+
|
262 |
+
# Example 2: text-audio
|
263 |
+
inputs = dict(
|
264 |
+
text=[{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]}],
|
265 |
+
audios='path/to/audio'
|
266 |
+
)
|
267 |
+
|
268 |
+
# Example 3: image-text-audio
|
269 |
+
inputs = dict(
|
270 |
+
text=[{"role": "system", "content": [{"type": "text", "text": "You are a helpful assistant."}]}],
|
271 |
+
images=Image.open('path/to/image'),
|
272 |
+
audios='path/to/audio'
|
273 |
+
)
|
274 |
+
|
275 |
+
# run processors
|
276 |
+
has_speech = 'audios' in inputs.keys()
|
277 |
+
inputs = processor(**inputs, return_tensors="pt")
|
278 |
+
inputs = inputs.to(model.device)
|
279 |
+
|
280 |
+
# prepare generation arguments
|
281 |
+
gen_kwargs = {"max_new_tokens": 4096, "do_sample": False} # add if necessary
|
282 |
+
speech_kwargs = {"speaker": "female", "output_wav_prefix": "output"} if has_speech else {}
|
283 |
+
|
284 |
+
# run generation
|
285 |
+
# for speech outputs, we will return the saved wav paths (c.f., output_wav_prefix)
|
286 |
+
with torch.no_grad():
|
287 |
+
outputs = model.generate(**inputs, **gen_kwargs)
|
288 |
+
outputs = outputs[:, inputs['input_ids'].shape[1]:]
|
289 |
+
print(processor.batch_decode(outputs, skip_special_tokens=True, **speech_kwargs))
|
290 |
+
```
|
291 |
+
|
292 |
+
## Citation
|
293 |
+
|
294 |
+
```bibtex
|
295 |
+
@article{chen2024emova,
|
296 |
+
title={Emova: Empowering language models to see, hear and speak with vivid emotions},
|
297 |
+
author={Chen, Kai and Gou, Yunhao and Huang, Runhui and Liu, Zhili and Tan, Daxin and Xu, Jing and Wang, Chunwei and Zhu, Yi and Zeng, Yihan and Yang, Kuo and others},
|
298 |
+
journal={arXiv preprint arXiv:2409.18042},
|
299 |
+
year={2024}
|
300 |
+
}
|
301 |
+
```
|