Upload folder using huggingface_hub
Browse files- .gitattributes +6 -0
- README.md +131 -195
- assets/jay_chou_superman_cant_fly.mp3 +3 -0
- assets/joe_hisaishi_summer.mp3 +3 -0
- assets/llama4_hgf.png +3 -0
- assets/mapo_tofu.mp4 +3 -0
- assets/qwen2.5omni_hgf.png +3 -0
- assets/zhajiang_noodle.mp4 +3 -0
.gitattributes
CHANGED
@@ -34,3 +34,9 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
37 |
+
assets/jay_chou_superman_cant_fly.mp3 filter=lfs diff=lfs merge=lfs -text
|
38 |
+
assets/joe_hisaishi_summer.mp3 filter=lfs diff=lfs merge=lfs -text
|
39 |
+
assets/llama4_hgf.png filter=lfs diff=lfs merge=lfs -text
|
40 |
+
assets/mapo_tofu.mp4 filter=lfs diff=lfs merge=lfs -text
|
41 |
+
assets/qwen2.5omni_hgf.png filter=lfs diff=lfs merge=lfs -text
|
42 |
+
assets/zhajiang_noodle.mp4 filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,202 +1,138 @@
|
|
1 |
-
|
2 |
-
base_model: Tevatron/Qwen2.5-Omni-7B-Thinker
|
3 |
-
library_name: peft
|
4 |
-
---
|
5 |
-
|
6 |
-
# Model Card for Model ID
|
7 |
-
|
8 |
-
<!-- Provide a quick summary of what the model is/does. -->
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
## Model Details
|
13 |
-
|
14 |
-
### Model Description
|
15 |
-
|
16 |
-
<!-- Provide a longer summary of what this model is. -->
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
- **Developed by:** [More Information Needed]
|
21 |
-
- **Funded by [optional]:** [More Information Needed]
|
22 |
-
- **Shared by [optional]:** [More Information Needed]
|
23 |
-
- **Model type:** [More Information Needed]
|
24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
25 |
-
- **License:** [More Information Needed]
|
26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
27 |
-
|
28 |
-
### Model Sources [optional]
|
29 |
-
|
30 |
-
<!-- Provide the basic links for the model. -->
|
31 |
-
|
32 |
-
- **Repository:** [More Information Needed]
|
33 |
-
- **Paper [optional]:** [More Information Needed]
|
34 |
-
- **Demo [optional]:** [More Information Needed]
|
35 |
-
|
36 |
-
## Uses
|
37 |
-
|
38 |
-
<!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
|
39 |
-
|
40 |
-
### Direct Use
|
41 |
-
|
42 |
-
<!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
|
43 |
-
|
44 |
-
[More Information Needed]
|
45 |
-
|
46 |
-
### Downstream Use [optional]
|
47 |
-
|
48 |
-
<!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
|
49 |
-
|
50 |
-
[More Information Needed]
|
51 |
-
|
52 |
-
### Out-of-Scope Use
|
53 |
-
|
54 |
-
<!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
|
55 |
-
|
56 |
-
[More Information Needed]
|
57 |
-
|
58 |
-
## Bias, Risks, and Limitations
|
59 |
-
|
60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
61 |
-
|
62 |
-
[More Information Needed]
|
63 |
-
|
64 |
-
### Recommendations
|
65 |
-
|
66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
67 |
-
|
68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
69 |
-
|
70 |
-
## How to Get Started with the Model
|
71 |
-
|
72 |
-
Use the code below to get started with the model.
|
73 |
-
|
74 |
-
[More Information Needed]
|
75 |
-
|
76 |
-
## Training Details
|
77 |
-
|
78 |
-
### Training Data
|
79 |
-
|
80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
81 |
-
|
82 |
-
[More Information Needed]
|
83 |
-
|
84 |
-
### Training Procedure
|
85 |
-
|
86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
87 |
-
|
88 |
-
#### Preprocessing [optional]
|
89 |
-
|
90 |
-
[More Information Needed]
|
91 |
-
|
92 |
-
|
93 |
-
#### Training Hyperparameters
|
94 |
-
|
95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
96 |
|
97 |
-
|
|
|
98 |
|
99 |
-
|
100 |
|
101 |
-
|
102 |
|
103 |
-
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
-
|
106 |
|
107 |
-
|
108 |
-
|
109 |
-
#### Testing Data
|
110 |
-
|
111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
112 |
-
|
113 |
-
[More Information Needed]
|
114 |
-
|
115 |
-
#### Factors
|
116 |
-
|
117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
118 |
-
|
119 |
-
[More Information Needed]
|
120 |
-
|
121 |
-
#### Metrics
|
122 |
-
|
123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
124 |
-
|
125 |
-
[More Information Needed]
|
126 |
-
|
127 |
-
### Results
|
128 |
-
|
129 |
-
[More Information Needed]
|
130 |
-
|
131 |
-
#### Summary
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
## Model Examination [optional]
|
136 |
-
|
137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
138 |
-
|
139 |
-
[More Information Needed]
|
140 |
-
|
141 |
-
## Environmental Impact
|
142 |
-
|
143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
144 |
-
|
145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
146 |
-
|
147 |
-
- **Hardware Type:** [More Information Needed]
|
148 |
-
- **Hours used:** [More Information Needed]
|
149 |
-
- **Cloud Provider:** [More Information Needed]
|
150 |
-
- **Compute Region:** [More Information Needed]
|
151 |
-
- **Carbon Emitted:** [More Information Needed]
|
152 |
-
|
153 |
-
## Technical Specifications [optional]
|
154 |
-
|
155 |
-
### Model Architecture and Objective
|
156 |
-
|
157 |
-
[More Information Needed]
|
158 |
-
|
159 |
-
### Compute Infrastructure
|
160 |
-
|
161 |
-
[More Information Needed]
|
162 |
-
|
163 |
-
#### Hardware
|
164 |
-
|
165 |
-
[More Information Needed]
|
166 |
-
|
167 |
-
#### Software
|
168 |
-
|
169 |
-
[More Information Needed]
|
170 |
-
|
171 |
-
## Citation [optional]
|
172 |
-
|
173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
174 |
-
|
175 |
-
**BibTeX:**
|
176 |
-
|
177 |
-
[More Information Needed]
|
178 |
-
|
179 |
-
**APA:**
|
180 |
-
|
181 |
-
[More Information Needed]
|
182 |
-
|
183 |
-
## Glossary [optional]
|
184 |
-
|
185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
186 |
-
|
187 |
-
[More Information Needed]
|
188 |
-
|
189 |
-
## More Information [optional]
|
190 |
-
|
191 |
-
[More Information Needed]
|
192 |
-
|
193 |
-
## Model Card Authors [optional]
|
194 |
-
|
195 |
-
[More Information Needed]
|
196 |
-
|
197 |
-
## Model Card Contact
|
198 |
-
|
199 |
-
[More Information Needed]
|
200 |
-
### Framework versions
|
201 |
|
202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Tevatron/OmniEmbed-v0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
**OmniEmbed** is a powerful multi-modal embedding model built on [Qwen2.5-Omni-7B](https://huggingface.co/Qwen/Qwen2.5-Omni-7B) using our [Tevatron](https://github.com/texttron/tevatron/) toolkit—a unified toolkit across scale, language, and modality for document retrieval.
|
4 |
+
OmniEmbed generates unified embeddings across multilingual text, images, audio, and video, enabling effective cross-modal retrieval for diverse applications.
|
5 |
|
6 |
+
✅ Text ✅ Image ✅ Audio ✅ Video ✅ Multilingual
|
7 |
|
8 |
+
## Evaluation Results:
|
9 |
|
10 |
+
| Benchmark | Task | Metric | OmniEmbed | Baseline (Score) |
|
11 |
+
|-----------|--------------------------|---------|-----------|-------------------|
|
12 |
+
| BEIR-13 | Text Retrieval | nDCG@10 | 58.2 | MistralE5 (59.0) |
|
13 |
+
| MIRACL | Multilingual Retrieval | nDCG@10 | 69.1 | BGE‑M3 (69.2) |
|
14 |
+
| VIDORE | Image Document Retrieval | nDCG@5 | 85.8 | DSE‑QWen2 (85.8) |
|
15 |
+
| MSRVTT | Video Retrieval | R@1 | 51.3 | CLIP (31.2) |
|
16 |
|
17 |
+
OmniEmbed achieves strong performance, comparable to models specifically optimized for individual tasks.
|
18 |
|
19 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
+
## Usage
|
22 |
+
|
23 |
+
### Setup
|
24 |
+
```python
|
25 |
+
# Import Library, Load Model and Processor
|
26 |
+
import torch
|
27 |
+
from transformers import AutoProcessor, Qwen2_5OmniThinkerForConditionalGeneration
|
28 |
+
from qwen_omni_utils import process_mm_info
|
29 |
+
|
30 |
+
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
31 |
+
|
32 |
+
processor = AutoProcessor.from_pretrained("Qwen/Qwen2.5-Omni-7B")
|
33 |
+
model = Qwen2_5OmniThinkerForConditionalGeneration.from_pretrained(
|
34 |
+
'ArvinZhuang/OmniEmbed-test',
|
35 |
+
attn_implementation="flash_attention_2",
|
36 |
+
torch_dtype=torch.bfloat16
|
37 |
+
).to(device).eval()
|
38 |
+
|
39 |
+
processor.tokenizer.padding_side = "left"
|
40 |
+
model.padding_side = "left"
|
41 |
+
|
42 |
+
# Function to Encode Message
|
43 |
+
def encode_message(message):
|
44 |
+
texts = processor.apply_chat_template(message, tokenize=False, add_generation_prompt=True)[0] + "<|endoftext|>"
|
45 |
+
audio_inputs, image_inputs, video_inputs = process_mm_info(message, use_audio_in_video=True)
|
46 |
+
|
47 |
+
inputs = processor(
|
48 |
+
text=texts,
|
49 |
+
audio=audio_inputs,
|
50 |
+
images=image_inputs,
|
51 |
+
videos=video_inputs,
|
52 |
+
return_tensors="pt",
|
53 |
+
padding="longest",
|
54 |
+
)
|
55 |
+
for k in inputs:
|
56 |
+
inputs[k] = inputs[k].to(device)
|
57 |
+
|
58 |
+
cache_position = torch.arange(0, inputs['input_ids'].shape[1], device=device)
|
59 |
+
inputs = model.prepare_inputs_for_generation(**inputs, use_cache=True, cache_position=cache_position)
|
60 |
+
model_outputs = model(**inputs, return_dict=True, output_hidden_states=True)
|
61 |
+
|
62 |
+
last_hidden_state = model_outputs.hidden_states[-1]
|
63 |
+
reps = last_hidden_state[:, -1]
|
64 |
+
reps = torch.nn.functional.normalize(reps, p=2, dim=-1)
|
65 |
+
return reps
|
66 |
+
```
|
67 |
+
|
68 |
+
### 🎬 Video Retrieval
|
69 |
+
|
70 |
+
```python
|
71 |
+
example_query = 'Query: How to cook Mapo Tofu?
|
72 |
+
example_video_1 = "https://huggingface.co/Tevatron/OmniEmbed-v0/resolve/main/assets/mapo_tofu.mp4"
|
73 |
+
example_video_2 = "https://huggingface.co/Tevatron/OmniEmbed-v0/resolve/main/assets/zhajiang_noodle.mp4"
|
74 |
+
query = [{'role': 'user', 'content': [{'type': 'text', 'text': example_query}]}]
|
75 |
+
video_1 = [{'role': 'user', 'content': [{'type': 'video', 'video': example_video_1}]}]
|
76 |
+
video_2 = [{'role': 'user', 'content': [{'type': 'video', 'video': example_video_2}]}]
|
77 |
+
|
78 |
+
sim1 = torch.cosine_similarity(encode_message(query), encode_message(video_1))
|
79 |
+
sim2 = torch.cosine_similarity(encode_message(query), encode_message(video_2))
|
80 |
+
|
81 |
+
print("Similarities:", sim1.item(), sim2.item())
|
82 |
+
```
|
83 |
+
|
84 |
+
### 🎵 Audio Retrieval
|
85 |
+
```python
|
86 |
+
example_query = 'Query: A light piano piece'
|
87 |
+
example_audio_1 = "https://huggingface.co/Tevatron/OmniEmbed-v0/resolve/main/assets/joe_hisaishi_summer.mp3"
|
88 |
+
example_audio_2 = "https://huggingface.co/Tevatron/OmniEmbed-v0/resolve/main/assets/jay_chou_superman_cant_fly.mp3"
|
89 |
+
query = [{'role': 'user', 'content': [{'type': 'text', 'text': example_query}]}]
|
90 |
+
audio_1 = [{'role': 'user', 'content': [{'type': 'audio', 'audio': example_audio_1}]}]
|
91 |
+
audio_2 = [{'role': 'user', 'content': [{'type': 'audio', 'audio': example_audio_2}]}]
|
92 |
+
|
93 |
+
sim1 = torch.cosine_similarity(encode_message(query), encode_message(audio_1))
|
94 |
+
sim2 = torch.cosine_similarity(encode_message(query), encode_message(audio_2))
|
95 |
+
|
96 |
+
print("Similarities:", sim1.item(), sim2.item())
|
97 |
+
```
|
98 |
+
|
99 |
+
### 📈 Image Document Retrieval (Image, Chart, PDF)
|
100 |
+
```python
|
101 |
+
example_query = 'Query: How many input modality does Qwen2.5-Omni support?'
|
102 |
+
example_image_1 = "https://huggingface.co/Tevatron/OmniEmbed-v0/resolve/main/assets/qwen2.5omni_hgf.png"
|
103 |
+
example_image_2 = "https://huggingface.co/Tevatron/OmniEmbed-v0/resolve/main/assets/llama4_hgf.png"
|
104 |
+
query = [{'role': 'user', 'content': [{'type': 'text', 'text': example_query}]}]
|
105 |
+
image_1 = [{'role': 'user', 'content': [{'type': 'image', 'image': example_image_1}]}]
|
106 |
+
image_2 = [{'role': 'user', 'content': [{'type': 'image', 'image': example_image_2}]}]
|
107 |
+
|
108 |
+
sim1 = torch.cosine_similarity(encode_message(query), encode_message(image_1))
|
109 |
+
sim2 = torch.cosine_similarity(encode_message(query), encode_message(image_2))
|
110 |
+
|
111 |
+
print("Similarities:", sim1.item(), sim2.item())
|
112 |
+
```
|
113 |
+
|
114 |
+
### 🌍 Multilingual Text Retrieval
|
115 |
+
```python
|
116 |
+
example_query = 'Query: 氧气在空气中占比多少?'
|
117 |
+
example_text_1 = "空气是指大气层中由不同气体和各类飘浮在其中的固体与液体颗粒(大气颗粒与气溶胶)所组成的气态混合物。地球大气层的空气主要由78.1%的氮气、20.9%氧气、0.9%的氩气和1~4%的水蒸气组成,其成分并不是固定的,随着高度、气压、温度的改变和对流情况不同,局部空气的组成比例也会改变。空气在大气层(特别是对流层)中的流动形成了风和曳流、气旋、龙卷等自然现象,而空气中飘浮的颗粒则形成了云、雾、霾和沙尘暴等短期天气情况。空气在海洋和陆地之间跨区域流动所承载的湿度和热能传导也是水循环和气候变率与变化的关键一环。"
|
118 |
+
example_text_2 = "水(化学式:H2O)是一种无机化合物,在常温且无杂质中是无色[1]无味不导电的透明液体,也会通过蒸发产生气态的水蒸气(这种蒸发可以发生在任何温度下,同时取决于与空气接触的表面积和湿度差)。在标准大气压下,水的凝固点是0 °C(32 °F;273 K),沸点是100 °C(212 °F;373 K)。"
|
119 |
+
query = [{'role': 'user', 'content': [{'type': 'text', 'text': example_query}]}]
|
120 |
+
text_1 = [{'role': 'user', 'content': [{'type': 'text', 'text': example_text_1}]}]
|
121 |
+
text_2 = [{'role': 'user', 'content': [{'type': 'text', 'text': example_text_2}]}]
|
122 |
+
|
123 |
+
sim1 = torch.cosine_similarity(encode_message(query), encode_message(text_1))
|
124 |
+
sim2 = torch.cosine_similarity(encode_message(query), encode_message(text_2))
|
125 |
+
|
126 |
+
print("Similarities:", sim1.item(), sim2.item())
|
127 |
+
```
|
128 |
+
|
129 |
+
## Data & Training
|
130 |
+
We fully open-soured the Training Data and Training Code in [Tevatron](https://github.com/texttron/tevatron/tree/qwenomni)
|
131 |
+
|
132 |
+
|
133 |
+
## Contact
|
134 |
+
This model is developed by:
|
135 |
+
|
136 |
+
Shengyao Zhuang, Xueguang Ma, Samantha Zhan, Crystina Zhang
|
137 |
+
|
138 |
+
Feel free to reach out to us with any questions or for further discussion.
|
assets/jay_chou_superman_cant_fly.mp3
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:f54d08b9eecf4003b692daaff28f5387804a93a27deb1d5ce663e764a27de1d3
|
3 |
+
size 4872832
|
assets/joe_hisaishi_summer.mp3
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:979c14285b90422965ecbce68c88b69dcb1e9328d78b5329c6a965eda0cfb938
|
3 |
+
size 2638661
|
assets/llama4_hgf.png
ADDED
![]() |
Git LFS Details
|
assets/mapo_tofu.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:23bd7a2a9a554bc09084cb74e584ca6129292073efcd2350f180e81975f96ec5
|
3 |
+
size 5250889
|
assets/qwen2.5omni_hgf.png
ADDED
![]() |
Git LFS Details
|
assets/zhajiang_noodle.mp4
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:640b98fde893982dc0e866e72d537d9798a5a8432a6a7abc8f76d630c897a1b1
|
3 |
+
size 3571831
|