ColPali
Safetensors
English
idefics3
colsmolvlm
vidore-experimental
vidore
QuentinJG commited on
Commit
4f01585
·
verified ·
1 Parent(s): 23605c4

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +117 -2
README.md CHANGED
@@ -1,5 +1,120 @@
1
  ---
 
 
 
 
 
2
  tags:
3
- - vidore
4
  - vidore-experimental
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ license: mit
3
+ library_name: colpali
4
+ base_model: vidore/ColSmolVLM-500M-Base-22750
5
+ language:
6
+ - en
7
  tags:
8
+ - colsmolvlm
9
  - vidore-experimental
10
+ - vidore
11
+ ---
12
+ # ColSmolVLM-500M-Base-22750: Visual Retriever based on SmolVLM-500M-Base-22750 with ColBERT strategy
13
+
14
+ ### This is a version trained with batch_size 32 for 3 epochs
15
+
16
+ ColSmolVLM is a model based on a novel model architecture and training strategy based on Vision Language Models (VLMs) to efficiently index documents from their visual features.
17
+ It is a SmolVLM extension that generates [ColBERT](https://arxiv.org/abs/2004.12832)- style multi-vector representations of text and images.
18
+ It was introduced in the paper [ColPali: Efficient Document Retrieval with Vision Language Models](https://arxiv.org/abs/2407.01449) and first released in [this repository](https://github.com/ManuelFay/colpali)
19
+
20
+ <p align="center"><img width=800 src="https://github.com/illuin-tech/colpali/blob/main/assets/colpali_architecture.webp?raw=true"/></p>
21
+
22
+ ## Version specificity
23
+
24
+ This version is trained with the commit b983e40 of the Colpali repository. (main branch from the repo)
25
+
26
+ Data is the same as the ColPali data described in the paper.
27
+
28
+
29
+ ## Model Training
30
+
31
+ ### Dataset
32
+ Our training dataset of 127,460 query-page pairs is comprised of train sets of openly available academic datasets (63%) and a synthetic dataset made up of pages from web-crawled PDF documents and augmented with VLM-generated (Claude-3 Sonnet) pseudo-questions (37%).
33
+ Our training set is fully English by design, enabling us to study zero-shot generalization to non-English languages. We explicitly verify no multi-page PDF document is used both [*ViDoRe*](https://huggingface.co/collections/vidore/vidore-benchmark-667173f98e70a1c0fa4db00d) and in the train set to prevent evaluation contamination.
34
+ A validation set is created with 2% of the samples to tune hyperparameters.
35
+
36
+ *Note: Multilingual data is present in the pretraining corpus of the language model and most probably in the multimodal training.*
37
+
38
+ ### Parameters
39
+
40
+ Unless specified otherwise, we train models in `bfloat16` format, use low-rank adapters ([LoRA](https://arxiv.org/abs/2106.09685))
41
+ with `alpha=32` and `r=32` on the transformer layers from the language model,
42
+ as well as the final randomly initialized projection layer, and use a `paged_adamw_8bit` optimizer.
43
+ We train on a 4 GPU setup with data parallelism, a learning rate of 5e-4 with linear decay with 2.5% warmup steps, and a batch size of 8.
44
+
45
+ ## Usage
46
+
47
+ Make sure `colpali-engine` is installed from source or with a version superior to 0.3.5 (main branch from the repo currently).
48
+ `transformers` version must be > 4.46.2.
49
+
50
+ ```bash
51
+ pip install git+https://github.com/illuin-tech/colpali
52
+ ```
53
+
54
+ ```python
55
+ import torch
56
+ from PIL import Image
57
+
58
+ from colpali_engine.models import ColIdefics3, ColIdefics3Processor
59
+
60
+ model = ColIdefics3.from_pretrained(
61
+ "vidore/colsmolvlm-alpha",
62
+ torch_dtype=torch.bfloat16,
63
+ device_map="cuda:0",
64
+ attn_implementation="flash_attention_2" # or eager
65
+ ).eval()
66
+ processor = ColIdefics3Processor.from_pretrained("vidore/colsmolvlm-alpha")
67
+
68
+ # Your inputs
69
+ images = [
70
+ Image.new("RGB", (32, 32), color="white"),
71
+ Image.new("RGB", (16, 16), color="black"),
72
+ ]
73
+ queries = [
74
+ "Is attention really all you need?",
75
+ "What is the amount of bananas farmed in Salvador?",
76
+ ]
77
+
78
+ # Process the inputs
79
+ batch_images = processor.process_images(images).to(model.device)
80
+ batch_queries = processor.process_queries(queries).to(model.device)
81
+
82
+ # Forward pass
83
+ with torch.no_grad():
84
+ image_embeddings = model(**batch_images)
85
+ query_embeddings = model(**batch_queries)
86
+
87
+ scores = processor.score_multi_vector(query_embeddings, image_embeddings)
88
+ ```
89
+
90
+
91
+ ## Limitations
92
+
93
+ - **Focus**: The model primarily focuses on PDF-type documents and high-ressources languages, potentially limiting its generalization to other document types or less represented languages.
94
+ - **Support**: The model relies on multi-vector retreiving derived from the ColBERT late interaction mechanism, which may require engineering efforts to adapt to widely used vector retrieval frameworks that lack native multi-vector support.
95
+
96
+ ## License
97
+
98
+ ColQwen2's vision language backbone model (Qwen2-VL) is under `apache2.0` license. The adapters attached to the model are under MIT license.
99
+
100
+ ## Contact
101
+
102
+ - Manuel Faysse: [email protected]
103
+ - Hugues Sibille: [email protected]
104
+ - Tony Wu: [email protected]
105
+
106
+ ## Citation
107
+
108
+ If you use any datasets or models from this organization in your research, please cite the original dataset as follows:
109
+
110
+ ```bibtex
111
+ @misc{faysse2024colpaliefficientdocumentretrieval,
112
+ title={ColPali: Efficient Document Retrieval with Vision Language Models},
113
+ author={Manuel Faysse and Hugues Sibille and Tony Wu and Bilel Omrani and Gautier Viaud and Céline Hudelot and Pierre Colombo},
114
+ year={2024},
115
+ eprint={2407.01449},
116
+ archivePrefix={arXiv},
117
+ primaryClass={cs.IR},
118
+ url={https://arxiv.org/abs/2407.01449},
119
+ }
120
+ ```