Skip to content

Commit

Permalink
new: add reranker example to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
joein committed Nov 7, 2024
1 parent a5f3f11 commit 7eea08e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,21 @@ embeddings = list(model.embed(images))
# ]
```

### 🔄 Rerankers
```python
from typing import List
from fastembed.rerank.cross_encoder import TextCrossEncoder

query = "Who is maintaining Qdrant?"
documents: List[str] = [
"This is built to be faster and lighter than other embedding libraries e.g. Transformers, Sentence-Transformers, etc.",
"fastembed is supported by and maintained by Qdrant.",
]
encoder = TextCrossEncoder(model_name='Xenova/ms-marco-MiniLM-L-6-v2')
scores = encoder.rerank(query, documents)

# [-11.48061752319336, 5.472434997558594]
```

## ⚡️ FastEmbed on a GPU

Expand Down

0 comments on commit 7eea08e

Please sign in to comment.