Update README.md
Browse files
README.md
CHANGED
@@ -7,7 +7,7 @@ tags:
|
|
7 |
- multimodal
|
8 |
- aria
|
9 |
---
|
10 |
-
<p align="center">
|
11 |
<br>Aria</br>
|
12 |
</p>
|
13 |
|
@@ -16,35 +16,113 @@ tags:
|
|
16 |
Β·π€ <a href="https://huggingface.co" target="_blank">GitHub</a> π <a href="https://huggingface.co" target="_blank">Discord</a>
|
17 |
Β· π <a href="https://huggingface.co" target="_blank">Twitter</a>
|
18 |
</p>
|
19 |
-
|
20 |
-
#
|
21 |
-
|
22 |
- Aria is the **first open multimodal native MoE** model, capable of seamlessly handling various input modalities within a MoE architecture.
|
23 |
- Aria performs **on par with GPT-4o mini and Gemini 1.5 Flash** across a range of multimodal tasks while maintaining strong performance on **text**-only tasks.
|
24 |
- Compared to similar or even larger models, Aria boasts **faster speeds** and **lower costs**. This high efficiency stems from its ability to activate only 3.9B parameters during inference β the **fewest** among models with comparable performance.
|
|
|
|
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
- **
|
29 |
-
- **Flexible image handling**: Aria supports variable image sizes and aspect ratios while maintaining high quality.
|
30 |
-
- **Extended context capacity**: Aria can manage multiple images within a long context window of 64k tokens.
|
31 |
-
- **Advanced text understanding**: Aria demonstrates competitive performance across language and coding tasks.
|
32 |
|
33 |
-
# Model Info
|
34 |
|
35 |
| Model | Download | Parameter | Context Length |
|
36 |
| :---- | :------- | :------------ | :------ |
|
37 |
-
| Aria | < HF link - TBD> | β’ Activation: 3.9B (3.5B MoE + 0.4B Visual Encoder) <br> β’ Total: 25.3B | 64K |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
- multimodal
|
8 |
- aria
|
9 |
---
|
10 |
+
<!-- <p align="center">
|
11 |
<br>Aria</br>
|
12 |
</p>
|
13 |
|
|
|
16 |
Β·π€ <a href="https://huggingface.co" target="_blank">GitHub</a> π <a href="https://huggingface.co" target="_blank">Discord</a>
|
17 |
Β· π <a href="https://huggingface.co" target="_blank">Twitter</a>
|
18 |
</p>
|
19 |
+
-->
|
20 |
+
# Aria Model Card
|
21 |
+
<!--
|
22 |
- Aria is the **first open multimodal native MoE** model, capable of seamlessly handling various input modalities within a MoE architecture.
|
23 |
- Aria performs **on par with GPT-4o mini and Gemini 1.5 Flash** across a range of multimodal tasks while maintaining strong performance on **text**-only tasks.
|
24 |
- Compared to similar or even larger models, Aria boasts **faster speeds** and **lower costs**. This high efficiency stems from its ability to activate only 3.9B parameters during inference β the **fewest** among models with comparable performance.
|
25 |
+
-->
|
26 |
+
## Key features
|
27 |
|
28 |
+
- **SoTA Multimodal Native Performance**: Aria achieves strong performance on a wide range of multimodal, language, and coding tasks. It is superior in video and document understanding.
|
29 |
+
- **Lightweight and Fast**: Aria is a mixture-of-expert model with 3.9B activated parameters per token. It efficently encodes visual input of variable sizes and aspect ratios.
|
30 |
+
- **Long Multimodal Context Window**: Aria supports multimodal input of up to 64K tokens. It can caption a 256-frame video in 10 seconds.
|
|
|
|
|
|
|
31 |
|
32 |
+
<!-- # Model Info
|
33 |
|
34 |
| Model | Download | Parameter | Context Length |
|
35 |
| :---- | :------- | :------------ | :------ |
|
36 |
+
| Aria | < HF link - TBD> | β’ Activation: 3.9B (3.5B MoE + 0.4B Visual Encoder) <br> β’ Total: 25.3B | 64K | -->
|
37 |
+
|
38 |
+
## Benchmark
|
39 |
+
| Category | Benchmark | Aria | Pixtral 12B | Llama3.2 11B | GPT-4o mini | GPT-4o | Gemini-1.5 Flash | Gemini-1.5 Pro |
|
40 |
+
|-------------------------------------|-------------------|-------|-------------|--------------|-------------|--------|------------------|----------------|
|
41 |
+
| **Knowledge (Multimodal)** | MMMU | 54.9 | 52.5 | 49.6 | 59.4 | 69.1 | 56.1 | 62.2 |
|
42 |
+
| **Math (Multimodal)** | MathVista | 66.1 | 58.0 | 51.5 | - | 54.7 | 63.8 | 58.4 |
|
43 |
+
| **Document** | DocQA | 92.6 | 90.7 | 84.4 | - | 92.8 | 89.9 | 93.1 |
|
44 |
+
| **Chart** | ChartQA | 86.4 | 81.8 | 78.7 | - | 85.7 | 85.4 | 87.2 |
|
45 |
+
| **Scene Text** | TextVQA | 81.1 | - | 78.2 | - | - | 78.7 | 78.7 |
|
46 |
+
| **General Visual QA** | MMBench-1.1 | 80.3 | - | - | 76.0 | 82.2 | - | 73.9 |
|
47 |
+
| **Video Understanding** | LongVideoBench | 66.6 | 47.4 | 45.7 | 58.8 | 66.7 | 62.4 | 64.4 |
|
48 |
+
| **Knowledge (Language)** | MMLU (5-shot) | 73.3 | 69.2 | 69.4 | - | 89.1 | 78.9 | 85.9 |
|
49 |
+
| **Math (Language)** | MATH | 50.8 | 48.1 | 51.9 | 70.2 | 76.6 | - | - |
|
50 |
+
| **Reasoning (Language)** | ARC Challenge | 91.0 | - | 83.4 | 96.4 | 96.7 | - | - |
|
51 |
+
| **Coding** | HumanEval | 73.2 | 72.0 | 72.6 | 87.2 | 90.2 | 74.3 | 84.1 |
|
52 |
+
|
53 |
+
|
54 |
+
## Quick Start
|
55 |
+
### Installation
|
56 |
+
```
|
57 |
+
pip install git+github.com/rhymes-ai/Aria.git
|
58 |
+
pip install flash-attn --no-build-isolation
|
59 |
+
```
|
60 |
+
|
61 |
+
### Inference
|
62 |
+
|
63 |
+
Aria has 25.3B total parameters, it can be loaded in one A100 (80GB) GPU with bfloat16 precision.
|
64 |
+
|
65 |
+
Here is a code snippet to show you how to use Aria.
|
66 |
+
|
67 |
+
```python
|
68 |
+
import requests
|
69 |
+
import torch
|
70 |
+
from PIL import Image
|
71 |
+
from transformers import AutoModelForCausalLM, AutoProcessor
|
72 |
+
|
73 |
+
model_id_or_path = "rhymes-ai/Aria"
|
74 |
+
|
75 |
+
model = AutoModelForCausalLM.from_pretrained(model_id_or_path, device_map="auto", torch_dtype=torch.bfloat16, trust_remote_code=True)
|
76 |
+
|
77 |
+
processor = AutoProcessor.from_pretrained(model_id_or_path, trust_remote_code=True)
|
78 |
+
|
79 |
+
image_path = "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/cat.png"
|
80 |
+
|
81 |
+
image = Image.open(requests.get(image_path, stream=True).raw)
|
82 |
+
|
83 |
+
messages = [
|
84 |
+
{
|
85 |
+
"role": "user",
|
86 |
+
"content": [
|
87 |
+
{"text": None, "type": "image"},
|
88 |
+
{"text": "what is the image?", "type": "text"},
|
89 |
+
],
|
90 |
+
}
|
91 |
+
]
|
92 |
+
|
93 |
+
text = processor.apply_chat_template(messages, add_generation_prompt=True)
|
94 |
+
inputs = processor(text=text, images=image, return_tensors="pt")
|
95 |
+
inputs["pixel_values"] = inputs["pixel_values"].to(model.dtype)
|
96 |
+
inputs = {k: v.to(model.device) for k, v in inputs.items()}
|
97 |
+
|
98 |
+
with torch.inference_mode(), torch.cuda.amp.autocast(dtype=torch.bfloat16):
|
99 |
+
output = model.generate(
|
100 |
+
**inputs,
|
101 |
+
max_new_tokens=500,
|
102 |
+
stop_strings=["<|im_end|>"],
|
103 |
+
tokenizer=processor.tokenizer,
|
104 |
+
do_sample=True,
|
105 |
+
temperature=0.9,
|
106 |
+
)
|
107 |
+
output_ids = output[0][inputs["input_ids"].shape[1]:]
|
108 |
+
result = processor.decode(output_ids, skip_special_tokens=True)
|
109 |
+
|
110 |
+
print(result)
|
111 |
+
```
|
112 |
+
|
113 |
+
### Advanced Inference and Fine-tuning
|
114 |
+
We provide a [codebase](https://github.com/rhymes-ai/Aria) for more advanced usage of Aria,
|
115 |
+
including vllm inference, cookbooks, and fine-tuning on custom datasets.
|
116 |
+
|
117 |
+
|
118 |
+
|
119 |
+
## Citation
|
120 |
+
If you find our work helpful, please consider citing.
|
121 |
+
```
|
122 |
+
@article{aria,
|
123 |
+
title={},
|
124 |
+
author={},
|
125 |
+
year={2024},
|
126 |
+
journal={}
|
127 |
+
}
|
128 |
+
```
|