Instructions to use zeroentropy/zerank-2-reranker with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- sentence-transformers
How to use zeroentropy/zerank-2-reranker with sentence-transformers:
from sentence_transformers import CrossEncoder model = CrossEncoder("zeroentropy/zerank-2-reranker") 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
Commit History
-
Add logging statements throughout model lifecycle
- Add logger initialization using __name__ - Log model loading process including device and config type - Log CrossEncoder initialization stages - Log prediction batching and processing - Replace print statements with logger for OOM handling - Log device changes in to_device function456ffeb -
Fix __init__ to call original CrossEncoder initialization
The previous implementation was completely overriding CrossEncoder's __init__ method, preventing proper base class initialization. Now we call the original __init__ first before loading our custom model.16b4531 -
Remove lazy loading and load model on instantiation
Load the model immediately when the CrossEncoder class is instantiated instead of waiting for the first predict() call.0ac03c0
-
Remove logging statements
cd705e3 -
Use torch.inference_mode() and disable gradient checkpointing
d9aaf5e
-
Update README.md
9ae8623
-
releasing zerank-2
b269504