🚀 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個epoch。

✨ 主要特性
版本特性
此模型接受動態圖像分辨率作為輸入,不會像ColPali那樣調整圖像大小或改變其縱橫比。最大分辨率設置為最多創建768個圖像塊。實驗表明,增加圖像塊數量可以顯著提升性能,但會增加內存需求。
此版本使用colpali-engine==0.3.9
進行訓練。
支持語言
- 英語(en)
- 法語(fr)
- 西班牙語(es)
- 意大利語(it)
- 德語(de)
訓練數據集
- 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
標籤
- vidore
- multimodal_embedding
- multilingual_embedding
- Text-to-Visual Document (T→VD) retrieval
庫名稱
peft
任務類型
visual-document-retrieval
📦 安裝指南
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)
🔧 技術細節
模型訓練
參數設置
我們使用低秩適配器(LoRA)對模型進行訓練,其中alpha=128
,r=128
,應用於語言模型的Transformer層以及最終隨機初始化的投影層。優化器使用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