Sentence Similarity
sentence-transformers
ONNX
Safetensors
bert
multi-vector
ColBERT
text-embeddings-inference
Instructions to use mixedbread-ai/mxbai-colbert-large-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use mixedbread-ai/mxbai-colbert-large-v1 with sentence-transformers:
from sentence_transformers import SentenceTransformer model = SentenceTransformer("mixedbread-ai/mxbai-colbert-large-v1") sentences = [ "That is a happy person", "That is a happy dog", "That is a very happy person", "Today is a sunny day" ] embeddings = model.encode(sentences) similarities = model.similarity(embeddings, embeddings) print(similarities.shape) # [4, 4] - Inference
- Notebooks
- Google Colab
- Kaggle
Remove stale modules.json and add Sentence Transformers usage
Browse files- README.md +41 -2
- modules.json +0 -8
README.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
| 4 |
|
| 5 |
<br><br>
|
|
@@ -24,7 +30,41 @@ You can learn more about the models in our [blog post](https://www.mixedbread.ai
|
|
| 24 |
|
| 25 |
## Quickstart
|
| 26 |
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
```sh
|
| 30 |
pip install ragatouille
|
|
@@ -77,7 +117,6 @@ The result looks like this:
|
|
| 77 |
]
|
| 78 |
```
|
| 79 |
|
| 80 |
-
|
| 81 |
## Evaluation
|
| 82 |
|
| 83 |
### 1. Reranking Performance
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
library_name: sentence-transformers
|
| 4 |
+
pipeline_tag: sentence-similarity
|
| 5 |
+
tags:
|
| 6 |
+
- sentence-transformers
|
| 7 |
+
- multi-vector
|
| 8 |
+
- ColBERT
|
| 9 |
---
|
| 10 |
|
| 11 |
<br><br>
|
|
|
|
| 30 |
|
| 31 |
## Quickstart
|
| 32 |
|
| 33 |
+
### Using Sentence Transformers
|
| 34 |
+
|
| 35 |
+
This checkpoint also loads with [Sentence Transformers](https://www.sbert.net/) as a multi-vector (ColBERT-style late interaction) retriever via the `MultiVectorEncoder`.
|
| 36 |
+
|
| 37 |
+
```bash
|
| 38 |
+
pip install "sentence-transformers>=6.0.0"
|
| 39 |
+
```
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
from sentence_transformers import MultiVectorEncoder
|
| 43 |
+
|
| 44 |
+
model = MultiVectorEncoder("mixedbread-ai/mxbai-colbert-large-v1")
|
| 45 |
+
|
| 46 |
+
query = "Who wrote 'To Kill a Mockingbird'?"
|
| 47 |
+
documents = [
|
| 48 |
+
"'To Kill a Mockingbird' is a novel by Harper Lee published in 1960. It was immediately successful, winning the Pulitzer Prize, and has become a classic of modern American literature.",
|
| 49 |
+
"The novel 'Moby-Dick' was written by Herman Melville and first published in 1851. It is considered a masterpiece of American literature and deals with complex themes of obsession, revenge, and the conflict between good and evil.",
|
| 50 |
+
"Harper Lee, an American novelist widely known for her novel 'To Kill a Mockingbird', was born in 1926 in Monroeville, Alabama. She received the Pulitzer Prize for Fiction in 1961.",
|
| 51 |
+
"Jane Austen was an English novelist known primarily for her six major novels, which interpret, critique and comment upon the British landed gentry at the end of the 18th century.",
|
| 52 |
+
]
|
| 53 |
+
|
| 54 |
+
query_embeddings = model.encode_query([query])
|
| 55 |
+
document_embeddings = model.encode_document(documents)
|
| 56 |
+
print(query_embeddings[0].shape, document_embeddings[0].shape)
|
| 57 |
+
# (128, 128) (34, 128)
|
| 58 |
+
|
| 59 |
+
# MaxSim late-interaction scoring
|
| 60 |
+
scores = model.similarity(query_embeddings, document_embeddings)
|
| 61 |
+
print(scores)
|
| 62 |
+
# tensor([[119.3276, 95.9337, 114.1252, 76.5609]])
|
| 63 |
+
```
|
| 64 |
+
|
| 65 |
+
### Using RAGatouille
|
| 66 |
+
|
| 67 |
+
This model can also be used with [RAGatouille](https://github.com/bclavie/RAGatouille):
|
| 68 |
|
| 69 |
```sh
|
| 70 |
pip install ragatouille
|
|
|
|
| 117 |
]
|
| 118 |
```
|
| 119 |
|
|
|
|
| 120 |
## Evaluation
|
| 121 |
|
| 122 |
### 1. Reranking Performance
|
modules.json
DELETED
|
@@ -1,8 +0,0 @@
|
|
| 1 |
-
[
|
| 2 |
-
{
|
| 3 |
-
"idx": 0,
|
| 4 |
-
"name": "0",
|
| 5 |
-
"path": "",
|
| 6 |
-
"type": "sentence_transformers.models.Transformer"
|
| 7 |
-
}
|
| 8 |
-
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|