numb3r3
commited on
Commit
•
7884ec1
1
Parent(s):
697801a
chore: init readme
Browse files
README.md
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
library_name: transformers
|
3 |
+
license: apache-2.0
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
tags:
|
7 |
+
- reranker
|
8 |
+
- cross-encoder
|
9 |
+
---
|
10 |
+
|
11 |
+
<br><br>
|
12 |
+
|
13 |
+
<p align="center">
|
14 |
+
<img src="https://aeiljuispo.cloudimg.io/v7/https://cdn-uploads.huggingface.co/production/uploads/603763514de52ff951d89793/AFoybzd5lpBQXEBrQHuTt.png?w=200&h=200&f=face" alt="Finetuner logo: Finetuner helps you to create experiments in order to improve embeddings on search tasks. It accompanies you to deliver the last mile of performance-tuning for neural search applications." width="150px">
|
15 |
+
</p>
|
16 |
+
|
17 |
+
<p align="center">
|
18 |
+
<b>Trained by <a href="https://jina.ai/"><b>Jina AI</b></a>.</b>
|
19 |
+
</p>
|
20 |
+
|
21 |
+
# jina-reranker-v1-turbo-en
|
22 |
+
|
23 |
+
This model is designed for **blazing-fast** reranking while maintaining **competitive performance**. What's more, it leverages the power of our [JinaBERT](https://arxiv.org/abs/2310.19923) model as their foundation. JinaBERT itself is a unique variant of the BERT architecture that supports the symmetric bidirectional variant of [ALiBi](https://arxiv.org/abs/2108.12409). This allows `jina-reranker-v1-turbo-en` to process significantly longer sequences of text compared to other reranking models, up to an impressive **8,192** tokens.
|
24 |
+
|
25 |
+
To achieve the remarkable speed, the `jina-reranker-v1-turbo-en` employ a technique called knowledge distillation. Here, a complex, but slower, model (like our original [jina-reranker-v1-base-en](https://jina.ai/reranker/)) acts as a teacher, condensing its knowledge into a smaller, faster student model. This student retains most of the teacher's knowledge, allowing it to deliver similar accuracy in a fraction of the time.
|
26 |
+
|
27 |
+
Here's a breakdown of the reranker models we provide:
|
28 |
+
|
29 |
+
| Model Name | Layers | Hidden Size | Parameters (Millions) |
|
30 |
+
| ------------------------------------------------------------------------------------ | ------ | ----------- | --------------------- |
|
31 |
+
| [jina-reranker-v1-base-en](https://jina.ai/reranker/) | 12 | 768 | 137.0 |
|
32 |
+
| [jina-reranker-v1-turbo-en](https://huggingface.co/jinaai/jina-reranker-v1-turbo-en) | 6 | 384 | 37.8 |
|
33 |
+
| [jina-reranker-v1-tiny-en](https://huggingface.co/jinaai/jina-reranker-v1-tiny-en) | 4 | 384 | 33.0 |
|
34 |
+
|
35 |
+
# Usage
|
36 |
+
|
37 |
+
You can use Jina Reranker models directly from transformers package:
|
38 |
+
|
39 |
+
```python
|
40 |
+
!pip install transformers
|
41 |
+
from transformers import AutoModelForSequenceClassification
|
42 |
+
|
43 |
+
model = AutoModelForSequenceClassification.from_pretrained(
|
44 |
+
'jinaai/jina-reranker-v1-turbo-en', num_labels=1, trust_remote_code=True
|
45 |
+
)
|
46 |
+
|
47 |
+
# Example query and documents
|
48 |
+
query = "Organic skincare products for sensitive skin"
|
49 |
+
documents = [
|
50 |
+
"Eco-friendly kitchenware for modern homes",
|
51 |
+
"Biodegradable cleaning supplies for eco-conscious consumers",
|
52 |
+
"Organic cotton baby clothes for sensitive skin",
|
53 |
+
"Natural organic skincare range for sensitive skin",
|
54 |
+
"Tech gadgets for smart homes: 2024 edition",
|
55 |
+
"Sustainable gardening tools and compost solutions",
|
56 |
+
"Sensitive skin-friendly facial cleansers and toners",
|
57 |
+
"Organic food wraps and storage solutions",
|
58 |
+
"All-natural pet food for dogs with allergies",
|
59 |
+
"Yoga mats made from recycled materials"
|
60 |
+
]
|
61 |
+
|
62 |
+
# construct sentence pairs
|
63 |
+
sentence_pairs = [[query, doc] for doc in documents]
|
64 |
+
|
65 |
+
scores = model.compute_score(sentence_pairs)
|
66 |
+
```
|
67 |
+
|
68 |
+
# Contact
|
69 |
+
|
70 |
+
Join our [Discord community](https://discord.jina.ai/) and chat with other community members about ideas.
|