How to use from the
Use from the
MLX library
# Download the model from the Hub
pip install huggingface_hub[hf_xet]

huggingface-cli download --local-dir gte-reranker-modernbert-base-mlx afanjul/gte-reranker-modernbert-base-mlx

afanjul/gte-reranker-modernbert-base-mlx

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.

Use with mlx

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()

Downloads last month
108
Safetensors
Model size
0.1B params
Tensor type
F16
·
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for afanjul/gte-reranker-modernbert-base-mlx

Finetuned
(1273)
this model