stockmark/ner-wikipedia-dataset
Viewer • Updated • 5.34k • 121 • 14
How to use ayousanz/yomi-linter-modernbert-ja-130m with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("token-classification", model="ayousanz/yomi-linter-modernbert-ja-130m") # Load model directly
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("ayousanz/yomi-linter-modernbert-ja-130m")
model = AutoModelForTokenClassification.from_pretrained("ayousanz/yomi-linter-modernbert-ja-130m")ModernBERT-Ja-130m を BIO トークン分類で fine-tune したモデルで、日本語 TTS(特に OpenJTalk のような G2P / 辞書ベース TTS)が誤読しがちな固有名詞・未知語のスパンを 合成前に 検出します。
O / B-RISK / I-RISK)sbintuitions/modernbert-ja-130m(MIT)stockmark/ner-wikipedia-dataset(CC BY-SA 4.0)+ 漢字専門語 118 語の弱ラベル注入入力した日本語文から TTS が誤読しそうな固有名詞・未知語のスパンを返します。スコープは 検出のみ で、正しい読みの付与・音声合成本体・配信統合は対象外です。
入力: 潤羽るしあの配信で魔王魂の楽曲が流れた
出力: [
{"surface": "潤羽るしあの", "start": 0, "end": 6, "label": "RISK", "score": 1.0},
{"surface": "魔王魂", "start": 9, "end": 12, "label": "RISK", "score": 0.999}
]
ブラウザでそのまま試したい方は、Hugging Face Space にデモを用意しています(インストール不要・例文 4 つ収録)。
手元から使う場合は、transformers のトークン分類パイプラインから直接利用できます。
from transformers import AutoTokenizer, AutoModelForTokenClassification, pipeline
model_id = "ayousanz/yomi-linter-modernbert-ja-130m"
tok = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForTokenClassification.from_pretrained(model_id)
ner = pipeline(
"token-classification",
model=model,
tokenizer=tok,
aggregation_strategy="simple",
)
for span in ner("潤羽るしあの配信で魔王魂の楽曲が流れた"):
print(f"{span['word']:10s} {span['entity_group']:5s} score={span['score']:.3f}")
出力例:
潤羽るしあの RISK score=1.000
魔王魂 RISK score=0.999
CPU 推論向けに PyTorch 動的量子化(nn.Linear のみ INT8 化)が使えます。配布ウェイトは float のままで、ロード時にクライアント側で量子化します。
import torch
from torch.ao.quantization import quantize_dynamic
model_q = quantize_dynamic(model, {torch.nn.Linear}, dtype=torch.qint8)
| バリアント | サイズ | CPU ms/文 | 漢字実誤読 recall |
|---|---|---|---|
| 130m float(本モデル) | 505 MB | 63 | 80% |
| 130m INT8(動的量子化) | 277 MB | 39 | 80% |
評価指標は 「OpenJTalk が実際に誤読する固有名詞・専門語の合成前検出 recall」 です。span-F1 のようなラベル一致度ではなく、実用に効くかを測る本命指標としてこれを採用しています。
| 比較対象 | 純日本語固有名詞 | 漢字専門語(医療含む) |
|---|---|---|
| OpenJTalk + 公開読み辞書のみ | 14% | ― |
| 漢字弱ラベルなし(従来モデル) | 71–100% | 47% |
| 本モデル(漢字弱ラベル 118 語あり) | 71–100% | 82% |
学習データの作り方の概要は著者ブログで公開予定です。
冠動脈瘤 のような医療熟語の一部はまだ完全には拾えません(漢字穴は 83% 縮小・1/6 程度の残あり)。sbintuitions/modernbert-ja-130m(MIT)stockmark/ner-wikipedia-dataset(CC BY-SA 4.0) + 漢字真誤読 118 語@software{yomi_linter_2026,
author = {yousan},
title = {yomi-linter: ModernBERT-Ja for Japanese TTS misreading pre-flight},
year = {2026},
url = {https://huggingface.co/ayousanz/yomi-linter-modernbert-ja-130m}
}
Base model
sbintuitions/modernbert-ja-130m