|
--- |
|
pipeline_tag: text-classification |
|
tags: |
|
- transformers |
|
- sentence-transformers |
|
- reranker |
|
- cross-encoder |
|
language: |
|
- multilingual |
|
license: cc-by-nc-4.0 |
|
--- |
|
|
|
<br><br> |
|
|
|
<p align="center"> |
|
<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"> |
|
</p> |
|
|
|
<p align="center"> |
|
<b>Trained by <a href="https://jina.ai/"><b>Jina AI</b></a>.</b> |
|
</p> |
|
|
|
# jina-reranker-v2-base-multilingual |
|
|
|
|
|
# Usage |
|
|
|
1. The easiest way to starting using `jina-reranker-v2-base-multilingual` is to use Jina AI's [Reranker API](https://jina.ai/reranker/). |
|
|
|
```bash |
|
curl https://api.jina.ai/v1/rerank \ |
|
-H "Content-Type: application/json" \ |
|
-H "Authorization: Bearer YOUR_API_KEY" \ |
|
-d '{ |
|
"model": "jina-reranker-v2-base-multilingual", |
|
"query": "Organic skincare products for sensitive skin", |
|
"documents": [ |
|
"Eco-friendly kitchenware for modern homes", |
|
"Biodegradable cleaning supplies for eco-conscious consumers", |
|
"Organic cotton baby clothes for sensitive skin", |
|
"Natural organic skincare range for sensitive skin", |
|
"Tech gadgets for smart homes: 2024 edition", |
|
"Sustainable gardening tools and compost solutions", |
|
"Sensitive skin-friendly facial cleansers and toners", |
|
"Organic food wraps and storage solutions", |
|
"All-natural pet food for dogs with allergies", |
|
"Yoga mats made from recycled materials" |
|
], |
|
"top_n": 3 |
|
}' |
|
``` |
|
|
|
2. You can also use the `transformers` library to interact with the model programmatically. |
|
|
|
```python |
|
!pip install transformers |
|
from transformers import AutoModelForSequenceClassification |
|
|
|
model = AutoModelForSequenceClassification.from_pretrained( |
|
'jinaai/jina-reranker-v2-base-multilingual', trust_remote_code=True, |
|
) |
|
model.to('cuda') |
|
|
|
# Example query and documents |
|
query = "Organic skincare products for sensitive skin" |
|
documents = [ |
|
"Eco-friendly kitchenware for modern homes", |
|
"Biodegradable cleaning supplies for eco-conscious consumers", |
|
"Organic cotton baby clothes for sensitive skin", |
|
"Natural organic skincare range for sensitive skin", |
|
"Tech gadgets for smart homes: 2024 edition", |
|
"Sustainable gardening tools and compost solutions", |
|
"Sensitive skin-friendly facial cleansers and toners", |
|
"Organic food wraps and storage solutions", |
|
"All-natural pet food for dogs with allergies", |
|
"Yoga mats made from recycled materials" |
|
] |
|
|
|
# construct sentence pairs |
|
sentence_pairs = [[query, doc] for doc in documents] |
|
|
|
scores = model.compute_score(sentence_pairs) |
|
``` |
|
|
|
That's it! You can now use the `jina-reranker-v2-base-multilingual` model in your projects. |
|
|