Instructions to use tencent/R3-rerank-0.6b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use tencent/R3-rerank-0.6b with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("tencent/R3-rerank-0.6b") query = "Which planet is known as the Red Planet?" passages = [ "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.", "Saturn, famous for its rings, is sometimes mistaken for the Red Planet." ] scores = model.predict([(query, passage) for passage in passages]) print(scores) - Notebooks
- Google Colab
- Kaggle
Expand code snippet for easier use + add missing tag
#1
by tomaarsen HF Staff - opened
Hello @xiaoxiaoshadiao and team,
This is the companion PR to https://huggingface.co/tencent/R3-embedding-0.6b/discussions/1, which similarly extends the code snippet to be even easier to understand for new users. It also adds a missing tag, which made the model harder to find when searching for rerankers compatible with Sentence Transformers.
- Tom Aarsen
tomaarsen changed pull request status to open
xiaoxiaoshadiao changed pull request status to merged