🚀 VLM2Vec-V2
VLM2Vec-V2 是一个用于大规模多模态嵌入任务的模型,通过训练视觉语言模型,为视频、图像和视觉文档等多模态数据提供更强大的嵌入能力。它在多模态评估基准(MMEB)上取得了优秀的实验结果,具有广泛的应用前景。
官网 |Github | 🏆排行榜 | 📖MMEB-V2/VLM2Vec-V2 论文 | | 📖MMEB-V1/VLM2Vec-V1 论文
🚀 快速开始
🌟 新特性
- [2025.07] 发布技术报告。
- [2025.05] 首次发布 MMEB-V2/VLM2Vec-V2。
📊 实验结果
我们提供了在 MMEB-V2 上的实验结果。
详细的排行榜请见此处。
💻 使用示例
基础用法
我们在 Github 上提供了演示示例。
from src.arguments import ModelArguments, DataArguments
from src.model.model import MMEBModel
from src.model.processor import load_processor, QWEN2_VL, VLM_VIDEO_TOKENS
import torch
from src.model.vlm_backbone.qwen2_vl.qwen_vl_utils import process_vision_info
model_args = ModelArguments(
model_name='Qwen/Qwen2-VL-7B-Instruct',
checkpoint_path='TIGER-Lab/VLM2Vec-Qwen2VL-7B',
pooling='last',
normalize=True,
model_backbone='qwen2_vl',
lora=True
)
data_args = DataArguments()
processor = load_processor(model_args, data_args)
model = MMEBModel.load(model_args)
model = model.to('cuda', dtype=torch.bfloat16)
model.eval()
messages = [
{
"role": "user",
"content": [
{
"type": "video",
"video": "assets/example_video.mp4",
"max_pixels": 360 * 420,
"fps": 1.0,
},
{"type": "text", "text": "Describe this video."},
],
}
]
image_inputs, video_inputs = process_vision_info(messages)
inputs = processor(
text=f'{VLM_VIDEO_TOKENS[QWEN2_VL]} Represent the given video.',
videos=video_inputs,
return_tensors="pt"
)
inputs = {key: value.to('cuda') for key, value in inputs.items()}
inputs['pixel_values_videos'] = inputs['pixel_values_videos'].unsqueeze(0)
inputs['video_grid_thw'] = inputs['video_grid_thw'].unsqueeze(0)
qry_output = model(qry=inputs)["qry_reps"]
string = 'A man in a gray sweater plays fetch with his dog in the snowy yard, throwing a toy and watching it run.'
inputs = processor(text=string,
images=None,
return_tensors="pt")
inputs = {key: value.to('cuda') for key, value in inputs.items()}
tgt_output = model(tgt=inputs)["tgt_reps"]
print(string, '=', model.compute_similarity(qry_output, tgt_output))
string = 'A person dressed in a blue jacket shovels the snow-covered pavement outside their house.'
inputs = processor(text=string,
images=None,
return_tensors="pt")
inputs = {key: value.to('cuda') for key, value in inputs.items()}
tgt_output = model(tgt=inputs)["tgt_reps"]
print(string, '=', model.compute_similarity(qry_output, tgt_output))
📚 引用
如果您使用了该项目,请引用以下论文:
@article{jiang2024vlm2vec,
title={VLM2Vec: Training Vision-Language Models for Massive Multimodal Embedding Tasks},
author={Jiang, Ziyan and Meng, Rui and Yang, Xinyi and Yavuz, Semih and Zhou, Yingbo and Chen, Wenhu},
journal={arXiv preprint arXiv:2410.05160},
year={2024}
}
@article{meng2025vlm2vecv2,
title={VLM2Vec-V2: Advancing Multimodal Embedding for Videos, Images, and Visual Documents},
author={Rui Meng and Ziyan Jiang and Ye Liu and Mingyi Su and Xinyi Yang and Yuepeng Fu and Can Qin and Zeyuan Chen and Ran Xu and Caiming Xiong and Yingbo Zhou and Wenhu Chen and Semih Yavuz},
journal={arXiv preprint arXiv:2507.04590},
year={2025}
}
📄 许可证
本项目采用 Apache-2.0 许可证。
📦 数据集
- TIGER-Lab/MMEB-train
- TIGER-Lab/MMEB-V2
- TIGER-Lab/MMEB-eval
📋 库名称
transformers