PEFT
Safetensors
vidore-experimental
vidore
manu commited on
Commit
171d95c
·
verified ·
1 Parent(s): e0da897

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +110 -2
README.md CHANGED
@@ -3,8 +3,116 @@ base_model: manu/ColSmolVLM-base
3
  library_name: peft
4
  tags:
5
  - vidore-experimental
 
6
  ---
7
 
8
- # ColSmolVLM-alpha
9
 
10
- Model Card in progress.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  library_name: peft
4
  tags:
5
  - vidore-experimental
6
+ - vidore
7
  ---
8
 
9
+ # ColSmolVLM-alpha: Visual Retriever based on SmolVLM-Instruct with ColBERT strategy
10
 
11
+ ### This is the base version trained with batch_size 128 for 3 epoch a
12
+
13
+ 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.
14
+ It is a SmolVLM extension that generates [ColBERT](https://arxiv.org/abs/2004.12832)- style multi-vector representations of text and images.
15
+ 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)
16
+
17
+ This version is the untrained base version to guarantee deterministic projection layer initialization.
18
+ <p align="center"><img width=800 src="https://github.com/illuin-tech/colpali/blob/main/assets/colpali_architecture.webp?raw=true"/></p>
19
+
20
+ ## Version specificity
21
+
22
+ This version is trained with `colpali-engine==0.3.5`. (branch smolvlm from the repo)
23
+
24
+ Data is the same as the ColPali data described in the paper.
25
+
26
+
27
+ ## Model Training
28
+
29
+ ### Dataset
30
+ 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%).
31
+ 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.
32
+ A validation set is created with 2% of the samples to tune hyperparameters.
33
+
34
+ *Note: Multilingual data is present in the pretraining corpus of the language model and most probably in the multimodal training.*
35
+
36
+ ### Parameters
37
+
38
+ Unless specified otherwise, we train models in `bfloat16` format, use low-rank adapters ([LoRA](https://arxiv.org/abs/2106.09685))
39
+ with `alpha=32` and `r=32` on the transformer layers from the language model,
40
+ as well as the final randomly initialized projection layer, and use a `paged_adamw_8bit` optimizer.
41
+ 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 32.
42
+
43
+ ## Usage
44
+
45
+ Make sure `colpali-engine` is installed from source or with a version superior to 0.3.5 (branch smolvlm from the repo currently).
46
+ `transformers` version must be > 4.46.2.
47
+
48
+ ```bash
49
+ pip install git+https://github.com/illuin-tech/colpali@smolvlm
50
+ ```
51
+
52
+ ```python
53
+ import torch
54
+ from PIL import Image
55
+
56
+ from colpali_engine.models import ColIdefics3, ColIdefics3Processor
57
+
58
+ model = ColIdefics3.from_pretrained(
59
+ "vidore/colqwen2-v1.0",
60
+ torch_dtype=torch.bfloat16,
61
+ device_map="cuda:0",
62
+ attn_implementation="flash_attention_2" # or eager
63
+ ).eval()
64
+ processor = ColIdefics3Processor.from_pretrained("manu/colsmolvlm-alpha")
65
+
66
+ # Your inputs
67
+ images = [
68
+ Image.new("RGB", (32, 32), color="white"),
69
+ Image.new("RGB", (16, 16), color="black"),
70
+ ]
71
+ queries = [
72
+ "Is attention really all you need?",
73
+ "What is the amount of bananas farmed in Salvador?",
74
+ ]
75
+
76
+ # Process the inputs
77
+ batch_images = processor.process_images(images).to(model.device)
78
+ batch_queries = processor.process_queries(queries).to(model.device)
79
+
80
+ # Forward pass
81
+ with torch.no_grad():
82
+ image_embeddings = model(**batch_images)
83
+ query_embeddings = model(**batch_queries)
84
+
85
+ scores = processor.score_multi_vector(query_embeddings, image_embeddings)
86
+ ```
87
+
88
+
89
+ ## Limitations
90
+
91
+ - **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.
92
+ - **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.
93
+
94
+ ## License
95
+
96
+ ColQwen2's vision language backbone model (Qwen2-VL) is under `apache2.0` license. The adapters attached to the model are under MIT license.
97
+
98
+ ## Contact
99
+
100
+ - Manuel Faysse: [email protected]
101
+ - Hugues Sibille: [email protected]
102
+ - Tony Wu: [email protected]
103
+
104
+ ## Citation
105
+
106
+ If you use any datasets or models from this organization in your research, please cite the original dataset as follows:
107
+
108
+ ```bibtex
109
+ @misc{faysse2024colpaliefficientdocumentretrieval,
110
+ title={ColPali: Efficient Document Retrieval with Vision Language Models},
111
+ author={Manuel Faysse and Hugues Sibille and Tony Wu and Bilel Omrani and Gautier Viaud and Céline Hudelot and Pierre Colombo},
112
+ year={2024},
113
+ eprint={2407.01449},
114
+ archivePrefix={arXiv},
115
+ primaryClass={cs.IR},
116
+ url={https://arxiv.org/abs/2407.01449},
117
+ }
118
+ ```