japanese-reranker-small-v2-mlx
Model Summary
This is an MLX conversion of hotchpotch/japanese-reranker-small-v2, a lightweight Japanese reranker (cross-encoder) model. All credit for the original model goes to its author.
- Live demo: Ruri Atlas — explore Japanese & English sentence embeddings as a 3-D map in your browser (WebGPU), switch embedding models, toggle the reranker, and see where a prompt-injection lands. Nothing is sent to a server.
Usage
pip install -U mlx-embeddings
from mlx_embeddings import load
from transformers import AutoTokenizer
import mlx.core as mx
model, tokenizer = load("masahiroid/japanese-reranker-small-v2-mlx")
hf_tokenizer = AutoTokenizer.from_pretrained("hotchpotch/japanese-reranker-small-v2")
query = "瑠璃色はどんな色?"
document = "瑠璃色(るりいろ)は、紫みを帯びた濃い青。"
enc = hf_tokenizer(query, document, return_tensors="np")
input_ids = mx.array(enc["input_ids"])
attention_mask = mx.array(enc["attention_mask"])
out = model(input_ids, attention_mask)
score = out.pooler_output # relevance score in [0, 1]
print(score)
Notes
- This is a community conversion, not an official release from the original author.
Security
Audited against its upstream with model-audit-lite: weight format, bundled code, and a machine-readable lineage (ML-BOM). Details, checksums and how to reproduce: SECURITY.md.