File size: 2,492 Bytes
fddb86b
 
bd1255a
 
 
 
 
 
 
 
 
 
fddb86b
bd1255a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
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)
```