Overseas access: www.kdjingpai.com
Bookmark Us
Current Position:fig. beginning " AI Answers

如何快速部署BGE-VL-MLLM-S1模型进行图像检索?

2025-08-30 1.1 K

部署BGE-VL-MLLM-S1主要分为四个步骤:

  1. environmental preparation: 创建Python3.10虚拟环境,安装transformers==4.41.2和sentencepiece
  2. Model loading:
    from transformers import AutoModel, AutoProcessor
    model = AutoModel.from_pretrained('BAAI/BGE-VL-MLLM-S1', trust_remote_code=True)
    processor = AutoProcessor.from_pretrained(model_name, trust_remote_code=True)
  3. input processing: 使用processor同时处理查询图像和文本,注意设置q_or_c参数区分查询/候选数据
  4. Similarity calculation:
    query_embs = model(**query_inputs).hidden_states[-1][:, -1, :]
    scores = torch.matmul(query_embs, candi_embs.T)

关键细节:必须使用GPU加速(需16GB+显存),处理文本时要包含任务指令模板,相似度计算前需对向量做L2归一化。

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

Top

en_USEnglish