Mme5 Mllama 11b Instruct
模型概述
該模型專注於多模態(圖像+文本)和多語言嵌入任務,能夠將圖像和文本映射到統一的嵌入空間,支持跨模態檢索和相似度計算。
模型特點
多模態嵌入能力
能夠同時處理圖像和文本輸入,將它們映射到統一的嵌入空間
多語言支持
支持8種語言的文本處理,包括英語、中文、阿拉伯語等
高質量合成數據訓練
使用專門設計的合成數據進行訓練,提高模型性能
最先進性能
在MMEB基準測試中達到最先進水平
模型能力
圖像-文本相似度計算
跨模態檢索
多語言文本嵌入
零樣本圖像分類
使用案例
跨模態檢索
圖像搜索
通過文本查詢檢索相關圖像
示例中'一隻貓和一隻狗'的查詢與圖像匹配度達0.4219
文本搜索
通過圖像檢索相關文本描述
示例中圖像與'一隻貓和一隻狗'的文本匹配度達0.4414
多語言應用
多語言圖像標註
為圖像生成多語言描述或標籤
🚀 mmE5-mllama-11b-instruct
mmE5-mllama-11b-instruct 模型基於高質量合成數據改進了多模態多語言嵌入,在多模態多語言評估基準(MMEB)上取得了優異的表現。該模型基於 Llama-3.2-11B-Vision 進行訓練,為多模態多語言任務提供了強大的支持。
🚀 快速開始
模型信息
- 論文鏈接:mmE5: Improving Multimodal Multilingual Embeddings via High-quality Synthetic Data。作者包括 Haonan Chen、Liang Wang、Nan Yang 等,發表於 arXiv 2025。
- 基礎模型:此模型基於 Llama-3.2-11B-Vision 進行訓練。
- GitHub 倉庫:Github
訓練/評估數據
- 訓練數據:
- https://huggingface.co/datasets/intfloat/mmE5-MMEB-hardneg
- https://huggingface.co/datasets/intfloat/mmE5-synthetic
- 評估數據:
- https://huggingface.co/datasets/TIGER-Lab/MMEB-eval
- https://huggingface.co/datasets/Haon-Chen/XTD-10
實驗結果
本模型在 MMEB 基準測試中達到了當前最優性能(SOTA)。
💻 使用示例
基礎用法
Transformers 庫使用示例
以下示例改編自 VLM2Vec。
import torch
import requests
from PIL import Image
from transformers import MllamaForConditionalGeneration, AutoProcessor
# Pooling and Normalization
def last_pooling(last_hidden_state, attention_mask, normalize=True):
sequence_lengths = attention_mask.sum(dim=1) - 1
batch_size = last_hidden_state.shape[0]
reps = last_hidden_state[torch.arange(batch_size, device=last_hidden_state.device), sequence_lengths]
if normalize:
reps = torch.nn.functional.normalize(reps, p=2, dim=-1)
return reps
def compute_similarity(q_reps, p_reps):
return torch.matmul(q_reps, p_reps.transpose(0, 1))
model_name = "intfloat/mmE5-mllama-11b-instruct"
# Load Processor and Model
processor = AutoProcessor.from_pretrained(model_name)
model = MllamaForConditionalGeneration.from_pretrained(
model_name, torch_dtype=torch.bfloat16
).to("cuda")
model.eval()
# Image + Text -> Text
image = Image.open(requests.get('https://github.com/haon-chen/mmE5/blob/main/figures/example.jpg?raw=true', stream=True).raw)
inputs = processor(text='<|image|><|begin_of_text|>Represent the given image with the following question: What is in the image\n', images=[image], return_tensors="pt").to("cuda")
qry_output = last_pooling(model(**inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], inputs['attention_mask'])
string = 'A cat and a dog'
text_inputs = processor(text=string, return_tensors="pt").to("cuda")
tgt_output = last_pooling(model(**text_inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], text_inputs['attention_mask'])
print(string, '=', compute_similarity(qry_output, tgt_output))
## A cat and a dog = tensor([[0.4219]], device='cuda:0', dtype=torch.bfloat16)
string = 'A cat and a tiger'
text_inputs = processor(text=string, return_tensors="pt").to("cuda")
tgt_output = last_pooling(model(**text_inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], text_inputs['attention_mask'])
print(string, '=', compute_similarity(qry_output, tgt_output))
## A cat and a tiger = tensor([[0.3184]], device='cuda:0', dtype=torch.bfloat16)
# Text -> Image
inputs = processor(text='Find me an everyday image that matches the given caption: A cat and a dog.\n', return_tensors="pt").to("cuda")
qry_output = last_pooling(model(**inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], inputs['attention_mask'])
string = '<|image|><|begin_of_text|>Represent the given image.\n'
tgt_inputs = processor(text=string, images=[image], return_tensors="pt").to("cuda")
tgt_output = last_pooling(model(**tgt_inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], tgt_inputs['attention_mask'])
print(string, '=', compute_similarity(qry_output, tgt_output))
## <|image|><|begin_of_text|>Represent the given image. = tensor([[0.4414]], device='cuda:0', dtype=torch.bfloat16)
inputs = processor(text='Find me an everyday image that matches the given caption: A cat and a tiger.\n', return_tensors="pt").to("cuda")
qry_output = last_pooling(model(**inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], inputs['attention_mask'])
string = '<|image|><|begin_of_text|>Represent the given image.\n'
tgt_inputs = processor(text=string, images=[image], return_tensors="pt").to("cuda")
tgt_output = last_pooling(model(**tgt_inputs, return_dict=True, output_hidden_states=True).hidden_states[-1], tgt_inputs['attention_mask'])
print(string, '=', compute_similarity(qry_output, tgt_output))
## <|image|><|begin_of_text|>Represent the given image. = tensor([[0.3730]], device='cuda:0', dtype=torch.bfloat16)
Sentence Transformers 庫使用示例
你也可以使用 Sentence Transformers 庫,該庫對大部分預處理和後處理操作進行了封裝。
from sentence_transformers import SentenceTransformer
import requests
# Load the model
model = SentenceTransformer("intfloat/mmE5-mllama-11b-instruct", trust_remote_code=True)
# Download an example image of a cat and a dog
dog_cat_image_bytes = requests.get('https://github.com/haon-chen/mmE5/blob/main/figures/example.jpg?raw=true', stream=True).raw.read()
with open("cat_dog_example.jpg", "wb") as f:
f.write(dog_cat_image_bytes)
# Image + Text -> Text
image_embeddings = model.encode([{
"image": "cat_dog_example.jpg",
"text": "Represent the given image with the following question: What is in the image",
}])
text_embeddings = model.encode([
{"text": "A cat and a dog"},
{"text": "A cat and a tiger"},
])
similarity = model.similarity(image_embeddings, text_embeddings)
print(similarity)
# tensor([[0.3967, 0.3090]])
# ✅ The first text is most similar to the image
# Text -> Image
image_embeddings = model.encode([
{"image": dog_cat_image_bytes, "text": "Represent the given image."},
])
text_embeddings = model.encode([
{"text": "Find me an everyday image that matches the given caption: A cat and a dog."},
{"text": "Find me an everyday image that matches the given caption: A cat and a tiger."},
])
similarity = model.similarity(image_embeddings, text_embeddings)
print(similarity)
# tensor([[0.4250, 0.3896]])
# ✅ The first text is most similar to the image
📄 許可證
本項目採用 MIT 許可證。
📚 引用
如果你使用了本模型,請引用以下論文:
@article{chen2025mmE5,
title={mmE5: Improving Multimodal Multilingual Embeddings via High-quality Synthetic Data},
author={Chen, Haonan and Wang, Liang and Yang, Nan and Zhu, Yutao and Zhao, Ziliang and Wei, Furu and Dou, Zhicheng},
journal={arXiv preprint arXiv:2502.08468},
year={2025}
}
Codebert Base
CodeBERT是一個面向編程語言與自然語言的預訓練模型,基於RoBERTa架構,支持代碼搜索和代碼生成文檔等功能。
多模態融合
C
microsoft
1.6M
248
Llama 4 Scout 17B 16E Instruct
其他
Llama 4 Scout是Meta開發的多模態AI模型,採用混合專家架構,支持12種語言的文本和圖像交互,具有17B激活參數和109B總參數。
多模態融合
Transformers 支持多種語言

L
meta-llama
817.62k
844
Unixcoder Base
Apache-2.0
UniXcoder是一個統一的多模態預訓練模型,利用代碼註釋和抽象語法樹等多模態數據預訓練代碼表示。
多模態融合
Transformers 英語

U
microsoft
347.45k
51
TITAN
TITAN是一個多模態全切片基礎模型,通過視覺自監督學習和視覺-語言對齊進行預訓練,用於病理學圖像分析。
多模態融合
Safetensors 英語
T
MahmoodLab
213.39k
37
Qwen2.5 Omni 7B
其他
Qwen2.5-Omni 是一個端到端的多模態模型,能夠感知文本、圖像、音頻和視頻等多種模態,並以流式方式生成文本和自然語音響應。
多模態融合
Transformers 英語

Q
Qwen
206.20k
1,522
Minicpm O 2 6
MiniCPM-o 2.6是一款手機端運行的GPT-4o級多模態大模型,支持視覺、語音與直播流處理
多模態融合
Transformers 其他

M
openbmb
178.38k
1,117
Llama 4 Scout 17B 16E Instruct
其他
Llama 4 Scout是Meta推出的17B參數/16專家混合的多模態AI模型,支持12種語言和圖像理解,具有行業領先性能。
多模態融合
Transformers 支持多種語言

L
chutesai
173.52k
2
Qwen2.5 Omni 3B
其他
Qwen2.5-Omni是一款端到端多模態模型,能夠感知文本、圖像、音頻和視頻等多種模態信息,並以流式方式同步生成文本和自然語音響應。
多模態融合
Transformers 英語

Q
Qwen
48.07k
219
One Align
MIT
Q-Align是一個多任務視覺評估模型,專注於圖像質量評估(IQA)、美學評估(IAA)和視頻質量評估(VQA),在ICML2024上發表。
多模態融合
Transformers

O
q-future
39.48k
25
Biomedvlp BioViL T
MIT
BioViL-T是一個專注於分析胸部X光片和放射學報告的視覺語言模型,通過時序多模態預訓練提升性能。
多模態融合
Transformers 英語

B
microsoft
26.39k
35
精選推薦AI模型
Llama 3 Typhoon V1.5x 8b Instruct
專為泰語設計的80億參數指令模型,性能媲美GPT-3.5-turbo,優化了應用場景、檢索增強生成、受限生成和推理任務
大型語言模型
Transformers 支持多種語言

L
scb10x
3,269
16
Cadet Tiny
Openrail
Cadet-Tiny是一個基於SODA數據集訓練的超小型對話模型,專為邊緣設備推理設計,體積僅為Cosmo-3B模型的2%左右。
對話系統
Transformers 英語

C
ToddGoldfarb
2,691
6
Roberta Base Chinese Extractive Qa
基於RoBERTa架構的中文抽取式問答模型,適用於從給定文本中提取答案的任務。
問答系統 中文
R
uer
2,694
98