Sentence Similarity
Safetensors
sentence-transformers
PyLate
modernbert
multi-vector
ColBERT
feature-extraction
multilingual
late-interaction
retrieval
pretrained
loss:Distillation
text-embeddings-inference
Instructions to use VAGOsolutions/SauerkrautLM-Multi-ModernColBERT with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use VAGOsolutions/SauerkrautLM-Multi-ModernColBERT with sentence-transformers:
from pylate import models queries = [ "Which planet is known as the Red Planet?", "What is the largest planet in our solar system?", ] documents = [ ["Mars is the Red Planet.", "Venus is Earth's twin."], ["Jupiter is the largest planet.", "Saturn has rings."], ] model = models.ColBERT(model_name_or_path="VAGOsolutions/SauerkrautLM-Multi-ModernColBERT") queries_emb = model.encode(queries, is_query=True) docs_emb = model.encode(documents, is_query=False) - Notebooks
- Google Colab
- Kaggle
Add Sentence Transformers usage
#1
by tomaarsen HF Staff - opened
README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
---
|
| 2 |
tags:
|
|
|
|
| 3 |
- ColBERT
|
| 4 |
- PyLate
|
| 5 |
- sentence-transformers
|
|
@@ -55,7 +56,7 @@ This creates a truly multilingual retriever that maintains exceptional English p
|
|
| 55 |
**Additional Training:** 4.6B multilingual tokens via knowledge distillation
|
| 56 |
|
| 57 |
### Model Description
|
| 58 |
-
- **Model Type:**
|
| 59 |
- **Document Length:** 8192 tokens (32× longer than traditional BERT models)
|
| 60 |
- **Query Length:** 256 tokens (optimized for complex, multi-part queries)
|
| 61 |
- **Output Dimensionality:** 128 tokens (efficient vector representation)
|
|
@@ -160,12 +161,47 @@ We've created a model that excels in English (67.70 nDCG@10) while delivering st
|
|
| 160 |
|
| 161 |
---
|
| 162 |
|
| 163 |
-
#
|
| 164 |
|
| 165 |
-
This is a
|
| 166 |
|
| 167 |
|
| 168 |
## Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
First install the PyLate library:
|
| 170 |
|
| 171 |
```bash
|
|
|
|
| 1 |
---
|
| 2 |
tags:
|
| 3 |
+
- multi-vector
|
| 4 |
- ColBERT
|
| 5 |
- PyLate
|
| 6 |
- sentence-transformers
|
|
|
|
| 56 |
**Additional Training:** 4.6B multilingual tokens via knowledge distillation
|
| 57 |
|
| 58 |
### Model Description
|
| 59 |
+
- **Model Type:** Multi-vector embedding model with innovative Late Interaction architecture
|
| 60 |
- **Document Length:** 8192 tokens (32× longer than traditional BERT models)
|
| 61 |
- **Query Length:** 256 tokens (optimized for complex, multi-part queries)
|
| 62 |
- **Output Dimensionality:** 128 tokens (efficient vector representation)
|
|
|
|
| 161 |
|
| 162 |
---
|
| 163 |
|
| 164 |
+
# Model
|
| 165 |
|
| 166 |
+
This is a multi-vector (ColBERT-style late interaction) embedding model. It maps sentences & paragraphs to sequences of 128-dimensional dense vectors and can be used for semantic textual similarity using the MaxSim operator.
|
| 167 |
|
| 168 |
|
| 169 |
## Usage
|
| 170 |
+
|
| 171 |
+
### Sentence Transformers
|
| 172 |
+
|
| 173 |
+
This model can be used with [Sentence Transformers](https://www.sbert.net/) as a multi-vector (ColBERT-style late interaction) retriever via the `MultiVectorEncoder`:
|
| 174 |
+
|
| 175 |
+
```bash
|
| 176 |
+
pip install "sentence-transformers>=6.0.0"
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
```python
|
| 180 |
+
from sentence_transformers import MultiVectorEncoder
|
| 181 |
+
|
| 182 |
+
model = MultiVectorEncoder("VAGOsolutions/SauerkrautLM-Multi-ModernColBERT")
|
| 183 |
+
|
| 184 |
+
query = "Welcher Planet ist als der Rote Planet bekannt?"
|
| 185 |
+
documents = [
|
| 186 |
+
"Venus wird wegen ihrer ähnlichen Größe und Nähe oft als Erdzwilling bezeichnet.",
|
| 187 |
+
"Mars, bekannt für sein rötliches Aussehen, wird oft als der Rote Planet bezeichnet.",
|
| 188 |
+
"Jupiter, der größte Planet in unserem Sonnensystem, hat einen markanten roten Fleck.",
|
| 189 |
+
"Saturn, berühmt für seine Ringe, wird manchmal für den Roten Planeten gehalten.",
|
| 190 |
+
]
|
| 191 |
+
|
| 192 |
+
query_embeddings = model.encode_query(query)
|
| 193 |
+
document_embeddings = model.encode_document(documents)
|
| 194 |
+
print(query_embeddings.shape, document_embeddings[0].shape)
|
| 195 |
+
# (32, 128) (29, 128)
|
| 196 |
+
|
| 197 |
+
# MaxSim late-interaction scoring (higher is more relevant)
|
| 198 |
+
scores = model.similarity(query_embeddings, document_embeddings)
|
| 199 |
+
print(scores)
|
| 200 |
+
# tensor([[28.7305, 29.5820, 29.0117, 29.1172]])
|
| 201 |
+
```
|
| 202 |
+
|
| 203 |
+
### PyLate
|
| 204 |
+
|
| 205 |
First install the PyLate library:
|
| 206 |
|
| 207 |
```bash
|