--- license: mit language: ja tags: - bert - pytorch - transformers - ner - 固有表現抽出 - named entity recognition - named-entity-recognition --- # このモデルはcl-tohoku/bert-large-japanese-v2をファインチューニングして、固有表現抽出(NER)に用いれるようにしたものです。 このモデルはcl-tohoku/bert-large-japanese-v2を Wikipediaを用いた日本語の固有表現抽出データセット(ストックマーク社、https://github.com/stockmarkteam/ner-wikipedia-dataset )を用いてファインチューニングしたものです。 固有表現抽出(NER)タスクに用いることができます。 # This model is fine-tuned model for Named-Entity-Recognition(NER) which is based on cl-tohoku/bert-large-japanese-v2 This model is fine-tuned by using Wikipedia dataset. You could use this model for NER tasks. # モデルの精度 accuracy of model 全体:0.8620626488367833 || precision |recall | f1-score | support| |---|----|----|----|----| |その他の組織名 | 0.80 | 0.78 | 0.79| 238| |イベント名 | 0.82| 0.88 | 0.85 | 215| |人名 | 0.92 | 0.95 | 0.93 | 549| |地名 | 0.90 | 0.89 | 0.89 | 446| |政治的組織名 | 0.86 | 0.91 | 0.89 | 263| |施設名 | 0.86 | 0.91 | 0.88 | 241| |法人名 | 0.88 | 0.89 | 0.88 | 487| |製品名 | 0.62 | 0.68 | 0.65 | 252| |micro avg |0.85 | 0.87 | 0.86 | 2691| |macro avg | 0.83 | 0.86 | 0.85 | 2691| |weighted avg | 0.85 | 0.87 | 0.86 | 2691| # How to use 使い方 fugashiとtransformers,unidic_liteをインストールして (pip install fugashi, pip install unidic_lite, pip install transformers) 以下のコードを実行することで、NERタスクを解かせることができます。 please execute this code. ```python from transformers import AutoTokenizer,pipeline, AutoModelForTokenClassification tokenizer = AutoTokenizer.from_pretrained('Mizuiro-sakura/bert-large-japanese-v2-finetuned-ner') model=AutoModelForTokenClassification.from_pretrained('Mizuiro-sakura/bert-large-japanese-v2-finetuned-ner') # 学習済みモデルの読み込み text=('昨日は東京で買い物をした') ner=pipeline('ner', model=model, tokenizer=tokenizer) result=ner(text) print(result) ```