PEFT
Safetensors
English
German
vidore
multimodal-embedding
tattrongvu commited on
Commit
acd3d8a
·
verified ·
1 Parent(s): 9c44b9a

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +71 -1
README.md CHANGED
@@ -47,4 +47,74 @@ The dataset was extended from the original colpali train set with the gemini 1.5
47
  We train models use low-rank adapters ([LoRA](https://arxiv.org/abs/2106.09685))
48
  with `alpha=64` and `r=64` on the transformer layers from the language model,
49
  as well as the final randomly initialized projection layer, and use a `paged_adamw_8bit` optimizer.
50
- We train on an 8xH100 GPU setup with distriuted data parallelism (via accelerate), a learning rate of 2e-4 with linear decay with 1% warmup steps, batch size per device is 64, in `bfloat16` format
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
47
  We train models use low-rank adapters ([LoRA](https://arxiv.org/abs/2106.09685))
48
  with `alpha=64` and `r=64` on the transformer layers from the language model,
49
  as well as the final randomly initialized projection layer, and use a `paged_adamw_8bit` optimizer.
50
+ We train on an 8xH100 GPU setup with distriuted data parallelism (via accelerate), a learning rate of 2e-4 with linear decay with 1% warmup steps, batch size per device is 64, in `bfloat16` format
51
+
52
+ ## Usage
53
+
54
+ Make sure `colpali-engine` is installed from source or with a version superior to 0.3.4.
55
+ `transformers` version must be > 4.46.1.
56
+
57
+ ```bash
58
+ pip install git+https://github.com/illuin-tech/colpali
59
+ ```
60
+
61
+ ```python
62
+ import torch
63
+ from PIL import Image
64
+
65
+ from colpali_engine.models import ColQwen2, ColQwen2Processor
66
+
67
+ model = ColQwen2.from_pretrained(
68
+ "vidore/colqwen2-v1.0",
69
+ torch_dtype=torch.bfloat16,
70
+ device_map="cuda:0", # or "mps" if on Apple Silicon
71
+ ).eval()
72
+ processor = ColQwen2Processor.from_pretrained("vidore/colqwen2-v1.0")
73
+
74
+ # Your inputs
75
+ images = [
76
+ Image.new("RGB", (32, 32), color="white"),
77
+ Image.new("RGB", (16, 16), color="black"),
78
+ ]
79
+ queries = [
80
+ "Is attention really all you need?",
81
+ "What is the amount of bananas farmed in Salvador?",
82
+ ]
83
+
84
+ # Process the inputs
85
+ batch_images = processor.process_images(images).to(model.device)
86
+ batch_queries = processor.process_queries(queries).to(model.device)
87
+
88
+ # Forward pass
89
+ with torch.no_grad():
90
+ image_embeddings = model(**batch_images)
91
+ query_embeddings = model(**batch_queries)
92
+
93
+ scores = processor.score_multi_vector(query_embeddings, image_embeddings)
94
+ ```
95
+
96
+
97
+ ## Limitations
98
+
99
+ - **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.
100
+ - **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.
101
+
102
+ ## License
103
+
104
+ ColQwen2's vision language backbone model (Qwen2-VL) is under `apache2.0` license. The adapters attached to the model are under MIT license.
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
+ ```