Downloads · 30 days
92
20% of all-time downloads
afanjul/gte-reranker-modernbert-base-mlx
gte-reranker-modernbert-base-mlx is a text ranking model from afanjul. Use it for the text ranking task on the model card, and read the license before you ship it in a product. It is set up for transformers. The card lists the license as apache-2.0.
The Model afanjul/gte-reranker-modernbert-base-mlx was converted to MLX format from Alibaba-NLP/gte-reranker-modernbert-base using mlx-lm version 0.1.1.
Downloads · 30 days
92
20% of all-time downloads
All-time downloads
454
Public
Parameters
150M
299 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors299 MB · 99%
From the Hugging Face model README
The Model afanjul/gte-reranker-modernbert-base-mlx was converted to MLX format from Alibaba-NLP/gte-reranker-modernbert-base using mlx-lm version 0.1.1.
pip install mlx-embeddings
from mlx_embeddings import load, generate
import mlx.core as mx
model, tokenizer = load("afanjul/gte-reranker-modernbert-base-mlx")
# For reranking (sequence classification)
pairs = [
["what is the capital of China?", "Beijing"],
["how to implement quick sort in python?", "Introduction of quick sort"],
]
output = generate(model, processor, texts=pairs, max_length=8192)
scores = output.pooler_output.squeeze()
print("Reranking scores:")
for pair, score in zip(pairs, scores.tolist()):
print(f" Query: {pair[0]}")
print(f" Document: {pair[1]}")
print(f" Score: {score:.4f}")
print()