Visual Document Retrieval
PEFT
Safetensors
English
vidore
multimodal-embedding
yydxlv commited on
Commit
fe78df8
·
verified ·
1 Parent(s): e353535

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +100 -9
README.md CHANGED
@@ -1,26 +1,117 @@
1
  ---
2
- license: mit
3
  datasets:
4
  - vidore/colpali_train_set
 
 
5
  base_model:
6
  - Qwen/Qwen2-VL-7B-Instruct
7
- pipeline_tag: visual-document-retrieval
8
- library_name: transformers
9
  tags:
10
  - vidore
 
 
 
11
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
- ## Model Details
 
14
 
15
- ### Model Description
16
 
17
- ColQwen 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.
18
- It is a Qwen2-VL-7B extension that generates ColBERT- style multi-vector representations of text and images.
19
- It was introduced in the paper ColPali: Efficient Document Retrieval with Vision Language Models and first released in this repository.
20
 
21
- This version is trained on 8xA800 with batch_size 32*8 for 3 epochs.
22
 
 
23
 
 
 
 
 
 
 
 
 
 
 
 
24
 
25
  - **Developed by:** IEIT systems
26
 
 
1
  ---
2
+ license: cc-by-nc-4.0
3
  datasets:
4
  - vidore/colpali_train_set
5
+ language:
6
+ - en
7
  base_model:
8
  - Qwen/Qwen2-VL-7B-Instruct
 
 
9
  tags:
10
  - vidore
11
+ - multimodal-embedding
12
+ library_name: peft
13
+ pipeline_tag: visual-document-retrieval
14
  ---
15
+ # IEIT-Systems ColQwen2-7B: Visual Retriever based on Qwen2-VL-7B-Instruct with ColBERT strategy
16
+
17
+ ### This is the base version trained with batch_size 8x64 for 5 epoch and with the updated pad token
18
+
19
+ ColQwen 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.
20
+ It is a [Qwen2-VL-7B](https://huggingface.co/Qwen/Qwen2-VL-7B-Instruct) extension that generates [ColBERT](https://arxiv.org/abs/2004.12832)- style multi-vector representations of text and images.
21
+ 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)
22
+
23
+ This version is the untrained base version to guarantee deterministic projection layer initialization.
24
+ <p align="center"><img width=800 src="https://github.com/illuin-tech/colpali/blob/main/assets/colpali_architecture.webp?raw=true"/></p>
25
+
26
+ ## Version specificity
27
+
28
+
29
+ This model takes dynamic image resolutions in input and does not resize them, changing their aspect ratio as in ColPali.
30
+ Maximal resolution is set so that 768 image patches are created at most. Experiments show clear improvements with larger amounts of image patches, at the cost of memory requirements.
31
+
32
+ This version is trained with `colpali-engine==0.3.4`.
33
+
34
+ Data is the same as the ColPali data described in the paper. Additionally the fine-tune has been carried out with the ShareGPT4V (https://sharegpt4v.github.io/) dataset.
35
+
36
+
37
+ ## Model Training
38
+
39
+ ### Parameters
40
+ We train models 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 an 8xA100 GPU setup with distributed data parallelism (via accelerate), a learning rate of 5e-4 with linear decay with 1% warmup steps, batch size per device is 32, in `bfloat16` format
44
+
45
+ ## Usage
46
+
47
+ Make sure `colpali-engine` is installed from source or with a version superior to 0.3.4.
48
+ `transformers` version must be > 4.46.1.
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 ColQwen2, ColQwen2Processor
59
+
60
+ model = ColQwen2.from_pretrained(
61
+ "yydxlv/colqwen2-7b-v1.0",
62
+ torch_dtype=torch.bfloat16,
63
+ device_map="cuda:0", # or "mps" if on Apple Silicon
64
+ ).eval()
65
+ processor = ColQwen2Processor.from_pretrained("yydxlv/colqwen2-7b-v1.0")
66
+
67
+ # Your inputs
68
+ images = [
69
+ Image.new("RGB", (32, 32), color="white"),
70
+ Image.new("RGB", (16, 16), color="black"),
71
+ ]
72
+ queries = [
73
+ "Is attention really all you need?",
74
+ "What is the amount of bananas farmed in Salvador?",
75
+ ]
76
+
77
+ # Process the inputs
78
+ batch_images = processor.process_images(images).to(model.device)
79
+ batch_queries = processor.process_queries(queries).to(model.device)
80
+
81
+ # Forward pass
82
+ with torch.no_grad():
83
+ image_embeddings = model(**batch_images)
84
+ query_embeddings = model(**batch_queries)
85
+
86
+ scores = processor.score_multi_vector(query_embeddings, image_embeddings)
87
+ ```
88
+
89
+
90
+ ## Limitations
91
 
92
+ - **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.
93
+ - **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.
94
 
95
+ ## License
96
 
97
+ ColQwen2's vision language backbone model (Qwen2-VL) is under `apache2.0` license.
98
+ This fine-tuned adapter is under **CC BY NC 4.0 license**. Therefore, the use of the model is **research only** at the moment.
 
99
 
100
+ ## Citation
101
 
102
+ If you use this models from this organization in your research, please cite the original paper as follows:
103
 
104
+ ```bibtex
105
+ @misc{faysse2024colpaliefficientdocumentretrieval,
106
+ title={ColPali: Efficient Document Retrieval with Vision Language Models},
107
+ author={Manuel Faysse and Hugues Sibille and Tony Wu and Bilel Omrani and Gautier Viaud and Céline Hudelot and Pierre Colombo},
108
+ year={2024},
109
+ eprint={2407.01449},
110
+ archivePrefix={arXiv},
111
+ primaryClass={cs.IR},
112
+ url={https://arxiv.org/abs/2407.01449},
113
+ }
114
+ ```
115
 
116
  - **Developed by:** IEIT systems
117