Text Ranking
sentence-transformers
Safetensors
Transformers
multilingual
t5gemma2
text2text-generation
reranker
encoder-decoder
FBNL
matryoshka
retrieval
RAG
Instructions to use KaLM-Embedding/KaLM-Reranker-V1-Small-R2 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use KaLM-Embedding/KaLM-Reranker-V1-Small-R2 with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("KaLM-Embedding/KaLM-Reranker-V1-Small-R2") 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) - Transformers
How to use KaLM-Embedding/KaLM-Reranker-V1-Small-R2 with Transformers:
# Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("KaLM-Embedding/KaLM-Reranker-V1-Small-R2") model = AutoModelForMultimodalLM.from_pretrained("KaLM-Embedding/KaLM-Reranker-V1-Small-R2", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Download vllm_support/examples/sample_pairs.jsonl from KaLM-Embedding/KaLM-Reranker-V1-Small-R2: direct link, hf CLI and curl.
- Browser
- Download file 219 Bytes
-
https://huggingface.co/KaLM-Embedding/KaLM-Reranker-V1-Small-R2/resolve/main/vllm_support/examples/sample_pairs.jsonl
- Command line
-
hf download hf://KaLM-Embedding/KaLM-Reranker-V1-Small-R2/vllm_support/examples/sample_pairs.jsonl
-
curl -L -o sample_pairs.jsonl https://huggingface.co/KaLM-Embedding/KaLM-Reranker-V1-Small-R2/resolve/main/vllm_support/examples/sample_pairs.jsonl
219 Bytes
| {"id":"positive","query":"What is the capital of China?","document":"The capital of China is Beijing."} | |
| {"id":"negative","query":"What is the capital of China?","document":"Gravity attracts bodies toward one another."} | |