japanese-reranker-small-v2-mlx

English | 日本語

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.


モデルの概要

hotchpotch/japanese-reranker-small-v2(軽量な日本語reranker、ModernBERTベース)のMLX変換版です。元モデルの著作権はその作者に帰属します。

  • ライブデモ: Ruri Atlas — 日本語・英語の文の埋め込みを、ブラウザ上(WebGPU)で3Dの地図として見られます。埋め込みモデルの切り替え、リランカーのON/OFF、プロンプトインジェクションの効き方の可視化もできます。文章はサーバーに送られません。

使い方

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  # 0〜1の関連度スコア
print(score)

備考

  • 本変換は非公式のコミュニティ版です。

セキュリティー

model-audit-lite で変換元と突き合わせて監査済みです(重みの形式、同梱コード、機械可読な系譜=ML-BOM)。詳細・チェックサム・再現方法は SECURITY.md をご覧ください。

Downloads last month
193
Safetensors
Model size
70.2M params
Tensor type
BF16
·
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 masahiroid/japanese-reranker-small-v2-mlx