Sentence Similarity
Safetensors
sentence-transformers
English
PyLate
modernbert
ColBERT
multi-vector
feature-extraction
Generated from Trainer
dataset_size:640000
loss:Distillation
Eval Results (legacy)
text-embeddings-inference
🇪🇺 Region: EU
Instructions to use lightonai/ColBERT-Zero with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use lightonai/ColBERT-Zero 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="lightonai/ColBERT-Zero") queries_emb = model.encode(queries, is_query=True) docs_emb = model.encode(documents, is_query=False) - Inference
- Notebooks
- Google Colab
- Kaggle
Update the Sentence Transformers section for the v6.0.1 prefix fix
#2
by tomaarsen HF Staff - opened
- README.md +3 -3
- config_sentence_transformers.json +6 -0
README.md
CHANGED
|
@@ -1011,7 +1011,7 @@ ColBERT(
|
|
| 1011 |
This model can be used with [Sentence Transformers](https://www.sbert.net/) as a multi-vector (ColBERT-style late interaction) retriever via the `MultiVectorEncoder`:
|
| 1012 |
|
| 1013 |
```bash
|
| 1014 |
-
pip install "sentence-transformers>=6.0.
|
| 1015 |
```
|
| 1016 |
|
| 1017 |
```python
|
|
@@ -1030,12 +1030,12 @@ documents = [
|
|
| 1030 |
query_embeddings = model.encode_query(query)
|
| 1031 |
document_embeddings = model.encode_document(documents)
|
| 1032 |
print(query_embeddings.shape, document_embeddings[0].shape)
|
| 1033 |
-
# (
|
| 1034 |
|
| 1035 |
# MaxSim late-interaction scoring (higher is more relevant)
|
| 1036 |
scores = model.similarity(query_embeddings, document_embeddings)
|
| 1037 |
print(scores)
|
| 1038 |
-
# tensor([[11.
|
| 1039 |
```
|
| 1040 |
|
| 1041 |
### PyLate
|
|
|
|
| 1011 |
This model can be used with [Sentence Transformers](https://www.sbert.net/) as a multi-vector (ColBERT-style late interaction) retriever via the `MultiVectorEncoder`:
|
| 1012 |
|
| 1013 |
```bash
|
| 1014 |
+
pip install "sentence-transformers>=6.0.1"
|
| 1015 |
```
|
| 1016 |
|
| 1017 |
```python
|
|
|
|
| 1030 |
query_embeddings = model.encode_query(query)
|
| 1031 |
document_embeddings = model.encode_document(documents)
|
| 1032 |
print(query_embeddings.shape, document_embeddings[0].shape)
|
| 1033 |
+
# torch.Size([16, 128]) torch.Size([19, 128])
|
| 1034 |
|
| 1035 |
# MaxSim late-interaction scoring (higher is more relevant)
|
| 1036 |
scores = model.similarity(query_embeddings, document_embeddings)
|
| 1037 |
print(scores)
|
| 1038 |
+
# tensor([[11.4863, 12.8909, 12.2002, 12.5669]], device='cuda:0')
|
| 1039 |
```
|
| 1040 |
|
| 1041 |
### PyLate
|
config_sentence_transformers.json
CHANGED
|
@@ -5,6 +5,12 @@
|
|
| 5 |
"transformers": "4.48.3",
|
| 6 |
"pytorch": "2.6.0"
|
| 7 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
"prompts": {
|
| 9 |
"query": "search_query: ",
|
| 10 |
"document": "search_document: "
|
|
|
|
| 5 |
"transformers": "4.48.3",
|
| 6 |
"pytorch": "2.6.0"
|
| 7 |
},
|
| 8 |
+
"requirements": {
|
| 9 |
+
"sentence-transformers": {
|
| 10 |
+
"specifier": ">=6.0.1",
|
| 11 |
+
"reason": "earlier versions encode this model's queries as \"search_query: ...\" instead of \"[Q] search_query: ...\", dropping the [Q] / [D] markers it was trained with and changing the embeddings."
|
| 12 |
+
}
|
| 13 |
+
},
|
| 14 |
"prompts": {
|
| 15 |
"query": "search_query: ",
|
| 16 |
"document": "search_document: "
|