sentence-transformers
ONNX
Safetensors
English
bert
ColBERT
multi-vector
RAGatouille
passage-retrieval
Instructions to use answerdotai/answerai-colbert-small-v1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use answerdotai/answerai-colbert-small-v1 with sentence-transformers:
from sentence_transformers import MultiVectorEncoder model = MultiVectorEncoder("answerdotai/answerai-colbert-small-v1") queries = ["Which planet is known as the Red Planet?"] documents = [ "Venus is often called Earth's twin because of its similar size and proximity.", "Mars, known for its reddish appearance, is often referred to as the Red Planet.", "Jupiter, the largest planet in our solar system, has a prominent red spot.", ] query_embeddings = model.encode_query(queries) document_embeddings = model.encode_document(documents) similarities = model.similarity(query_embeddings, document_embeddings) print(similarities) - Notebooks
- Google Colab
- Kaggle
Make each Usage integration self-contained (own install), drop the shared Installation section
Browse files
README.md
CHANGED
|
@@ -20,6 +20,8 @@ For more information about this model or how it was trained, head over to the [a
|
|
| 20 |
|
| 21 |
## Usage
|
| 22 |
|
|
|
|
|
|
|
| 23 |
### Sentence Transformers
|
| 24 |
|
| 25 |
This model can be used with [Sentence Transformers](https://www.sbert.net/) as a multi-vector (ColBERT-style late interaction) retriever via the `MultiVectorEncoder`:
|
|
@@ -52,24 +54,14 @@ print(scores)
|
|
| 52 |
# tensor([[30.5692, 31.4895, 31.3029, 31.3072]])
|
| 53 |
```
|
| 54 |
|
| 55 |
-
###
|
| 56 |
-
|
| 57 |
-
This model was designed with the upcoming RAGatouille overhaul in mind. However, it's compatible with all recent ColBERT implementations!
|
| 58 |
-
|
| 59 |
-
To use it, you can either use the Stanford ColBERT library, or RAGatouille. You can install both or either by simply running.
|
| 60 |
-
|
| 61 |
-
```sh
|
| 62 |
-
pip install --upgrade ragatouille
|
| 63 |
-
pip install --upgrade colbert-ai
|
| 64 |
-
```
|
| 65 |
|
| 66 |
If you're interested in using this model as a re-ranker (it vastly outperforms cross-encoders its size!), you can do so via the [rerankers](https://github.com/AnswerDotAI/rerankers) library:
|
| 67 |
-
|
|
|
|
| 68 |
pip install --upgrade rerankers[transformers]
|
| 69 |
```
|
| 70 |
|
| 71 |
-
### Rerankers
|
| 72 |
-
|
| 73 |
```python
|
| 74 |
from rerankers import Reranker
|
| 75 |
|
|
@@ -81,6 +73,10 @@ ranker.rank(query=query, docs=docs)
|
|
| 81 |
|
| 82 |
### RAGatouille
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
```python
|
| 85 |
from ragatouille import RAGPretrainedModel
|
| 86 |
|
|
@@ -96,6 +92,10 @@ results = RAG.search(query)
|
|
| 96 |
|
| 97 |
### Stanford ColBERT
|
| 98 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
#### Indexing
|
| 100 |
|
| 101 |
```python
|
|
|
|
| 20 |
|
| 21 |
## Usage
|
| 22 |
|
| 23 |
+
This model was designed with the upcoming RAGatouille overhaul in mind. However, it's compatible with all recent ColBERT implementations!
|
| 24 |
+
|
| 25 |
### Sentence Transformers
|
| 26 |
|
| 27 |
This model can be used with [Sentence Transformers](https://www.sbert.net/) as a multi-vector (ColBERT-style late interaction) retriever via the `MultiVectorEncoder`:
|
|
|
|
| 54 |
# tensor([[30.5692, 31.4895, 31.3029, 31.3072]])
|
| 55 |
```
|
| 56 |
|
| 57 |
+
### Rerankers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
If you're interested in using this model as a re-ranker (it vastly outperforms cross-encoders its size!), you can do so via the [rerankers](https://github.com/AnswerDotAI/rerankers) library:
|
| 60 |
+
|
| 61 |
+
```bash
|
| 62 |
pip install --upgrade rerankers[transformers]
|
| 63 |
```
|
| 64 |
|
|
|
|
|
|
|
| 65 |
```python
|
| 66 |
from rerankers import Reranker
|
| 67 |
|
|
|
|
| 73 |
|
| 74 |
### RAGatouille
|
| 75 |
|
| 76 |
+
```bash
|
| 77 |
+
pip install --upgrade ragatouille
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
```python
|
| 81 |
from ragatouille import RAGPretrainedModel
|
| 82 |
|
|
|
|
| 92 |
|
| 93 |
### Stanford ColBERT
|
| 94 |
|
| 95 |
+
```bash
|
| 96 |
+
pip install --upgrade colbert-ai
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
#### Indexing
|
| 100 |
|
| 101 |
```python
|