@@ -63,6 +63,23 @@ embeddings = list(model.embed(documents))
63
63
64
64
```
65
65
66
+ Dense text embedding can also be extended with models which are not in the list of supported models.
67
+
68
+ ``` python
69
+ from fastembed import TextEmbedding
70
+ from fastembed.common.model_description import PoolingType, ModelSource
71
+
72
+ TextEmbedding.add_custom_model(
73
+ model = " intfloat/multilingual-e5-small" ,
74
+ pooling = PoolingType.MEAN ,
75
+ normalization = True ,
76
+ sources = ModelSource(hf = " intfloat/multilingual-e5-small" ), # can be used with an `url` to load files from a private storage
77
+ dim = 384 ,
78
+ model_file = " onnx/model.onnx" , # can be used to load an already supported model with another optimization or quantization, e.g. onnx/model_O4.onnx
79
+ )
80
+ model = TextEmbedding(model_name = " intfloat/multilingual-e5-small" )
81
+ embeddings = list (model.embed(documents))
82
+ ```
66
83
67
84
68
85
### 🔱 Sparse text embeddings
@@ -137,6 +154,27 @@ embeddings = list(model.embed(images))
137
154
# ]
138
155
```
139
156
157
+ ### Late interaction multimodal models (ColPali)
158
+
159
+ ``` python
160
+ from fastembed import LateInteractionMultimodalEmbedding
161
+
162
+ doc_images = [
163
+ " ./path/to/qdrant_pdf_doc_1_screenshot.jpg" ,
164
+ " ./path/to/colpali_pdf_doc_2_screenshot.jpg" ,
165
+ ]
166
+
167
+ query = " What is Qdrant?"
168
+
169
+ model = LateInteractionMultimodalEmbedding(model_name = " Qdrant/colpali-v1.3-fp16" )
170
+ doc_images_embeddings = list (model.embed_image(doc_images))
171
+ # shape (2, 1030, 128)
172
+ # [array([[-0.03353882, -0.02090454, ..., -0.15576172, -0.07678223]], dtype=float32)]
173
+ query_embedding = model.embed_text(query)
174
+ # shape (1, 20, 128)
175
+ # [array([[-0.00218201, 0.14758301, ..., -0.02207947, 0.16833496]], dtype=float32)]
176
+ ```
177
+
140
178
### 🔄 Rerankers
141
179
``` python
142
180
from fastembed.rerank.cross_encoder import TextCrossEncoder
0 commit comments