🚀 ColQwen2.5-3b-multilingual-v1.0:基於Qwen2.5-VL-3B-Instruct和ColBERT策略的多語言視覺檢索器
ColQwen是一個基於視覺語言模型(VLMs)的新型模型架構和訓練策略的模型,旨在通過視覺特徵高效地對文檔進行索引。它是Qwen2.5-VL-3B的擴展版本,能夠生成ColBERT風格的文本和圖像多向量表示。該模型在論文ColPali: Efficient Document Retrieval with Vision Language Models中被提出,並首次在此倉庫中發佈。
這是在8xH100 80GB上訓練的基礎版本,每個設備的批量大小為128,訓練了8個週期。

✨ 主要特性
- 多語言支持:支持英語、法語、西班牙語、意大利語和德語等多種語言。
- 多模態嵌入:能夠處理文本和圖像的多模態嵌入。
- 高效檢索:基於ColBERT策略,能夠高效地進行文本到視覺文檔(T→VD)的檢索。
📦 安裝指南
pip install git+https://github.com/illuin-tech/colpali
pip install transformers==4.49.0
pip install flash-attn --no-build-isolation
💻 使用示例
基礎用法
import torch
from PIL import Image
from colpali_engine.models import ColQwen2_5, ColQwen2_5_Processor
model = ColQwen2_5.from_pretrained(
"tsystems/colqwen2.5-3b-multilingual-v1.0",
torch_dtype=torch.bfloat16,
device_map="cuda:0",
).eval()
processor = ColQwen2_5_Processor.from_pretrained("tsystems/colqwen2.5-3b-multilingual-v1.0")
images = [
Image.new("RGB", (32, 32), color="white"),
Image.new("RGB", (16, 16), color="black"),
]
queries = [
"Is attention really all you need?",
"What is the amount of bananas farmed in Salvador?",
]
batch_images = processor.process_images(images).to(model.device)
batch_queries = processor.process_queries(queries).to(model.device)
with torch.no_grad():
image_embeddings = model(**batch_images)
query_embeddings = model(**batch_queries)
scores = processor.score_multi_vector(query_embeddings, image_embeddings)
📚 詳細文檔
版本特性
此模型接受動態圖像分辨率輸入,不會像ColPali那樣調整圖像大小或改變其寬高比。最大分辨率設置為最多創建768個圖像塊。實驗表明,增加圖像塊數量可以顯著提高性能,但會增加內存需求。
此版本使用colpali-engine==0.3.9
進行訓練。
數據
- 德語和英語:來自
tsystems/vqa_de_en_batch1
數據集。
- 多語言數據集:來自
llamaindex/vdr-multilingual-train
。
- 合成數據:來自
openbmb/VisRAG-Ret-Train-Synthetic-data
數據集。
- 領域內VQA數據集:來自
openbmb/VisRAG-Ret-Train-In-domain-data
數據集。
- Colpali數據集:來自
vidore/colpali_train_set
。
模型訓練
參數
我們使用低秩適配器(LoRA)對語言模型的Transformer層以及最終隨機初始化的投影層進行訓練,其中alpha=128
,r=128
。使用paged_adamw_8bit
優化器,在8xH100 GPU上進行分佈式數據並行訓練(通過accelerate),學習率為2e-4,採用線性衰減,熱身步驟為1%,每個設備的批量大小為128,使用bfloat16
格式。
侷限性
- 適用範圍:該模型主要關注PDF類型的文檔和資源豐富的語言,可能在其他文檔類型或資源較少的語言上的泛化能力有限。
- 支持情況:該模型依賴於從ColBERT後期交互機制派生的多向量檢索,可能需要進行工程化工作才能適應缺乏原生多向量支持的廣泛使用的向量檢索框架。
許可證
ColQwen2.5的視覺語言骨幹模型(Qwen2.5-VL)遵循apache2.0
許可證。附加在模型上的適配器遵循MIT許可證。
引用
如果您在研究中使用了該組織的模型,請按以下方式引用原始論文:
@misc{faysse2024colpaliefficientdocumentretrieval,
title={ColPali: Efficient Document Retrieval with Vision Language Models},
author={Manuel Faysse and Hugues Sibille and Tony Wu and Bilel Omrani and Gautier Viaud and Céline Hudelot and Pierre Colombo},
year={2024},
eprint={2407.01449},
archivePrefix={arXiv},
primaryClass={cs.IR},
url={https://arxiv.org/abs/2407.01449},
}
開發團隊
T-Systems International
信息表格
屬性 |
詳情 |
模型類型 |
基於Qwen2.5-VL-3B-Instruct的多語言視覺檢索器 |
訓練數據 |
openbmb/VisRAG-Ret-Train-Synthetic-data、openbmb/VisRAG-Ret-Train-In-domain-data、tsystems/vqa_de_en_batch1、vidore/colpali_train_set、llamaindex/vdr-multilingual-train、Metric-AI/tabfquad_train_set |
支持語言 |
英語、法語、西班牙語、意大利語、德語 |
基礎模型 |
Qwen/Qwen2.5-VL-3B-Instruct |
標籤 |
多模態嵌入、多語言嵌入、文本到視覺文檔(T→VD)檢索 |
庫名稱 |
transformers |
任務類型 |
視覺文檔檢索 |