🚀 roberta-large-ner-english: NERタスク用にroberta-largeからファインチューニングされたモデル
[roberta-large-ner-english]は、conll2003データセットでroberta-largeからファインチューニングされた英語の固有表現抽出(NER)モデルです。このモデルは、電子メールやチャットデータで検証され、特にこの種のデータに対して他のモデルを上回る性能を発揮します。特に、大文字で始まらない固有表現に対してより良い性能を示すようです。
🚀 クイックスタート
データセット
ウィジェットサンプル
- テキスト: "My name is jean-baptiste and I live in montreal"
- テキスト: "My name is clara and I live in berkeley, california."
- テキスト: "My name is wolfgang and I live in berlin"
学習と評価の設定
- 設定: conll2003
- タスク: トークン分類
- タスクID: エンティティ抽出
- 分割: 評価分割は検証用データセット
- 列マッピング:
✨ 主な機能
- conll2003データセットでファインチューニングされた英語のNERモデルです。
- 電子メールやチャットデータで他のモデルを上回る性能を発揮します。
- 大文字で始まらない固有表現に対しても良い性能を示します。
📦 インストール
このセクションでは、HuggingFaceを使用してroberta-large-ner-english
をロードする方法を説明します。
モデルとトークナイザーのロード
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("Jean-Baptiste/roberta-large-ner-english")
model = AutoModelForTokenClassification.from_pretrained("Jean-Baptiste/roberta-large-ner-english")
テキストサンプルの処理
from transformers import pipeline
nlp = pipeline('ner', model=model, tokenizer=tokenizer, aggregation_strategy="simple")
nlp("Apple was founded in 1976 by Steve Jobs, Steve Wozniak and Ronald Wayne to develop and sell Wozniak's Apple I personal computer")
💻 使用例
基本的な使用法
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("Jean-Baptiste/roberta-large-ner-english")
model = AutoModelForTokenClassification.from_pretrained("Jean-Baptiste/roberta-large-ner-english")
from transformers import pipeline
nlp = pipeline('ner', model=model, tokenizer=tokenizer, aggregation_strategy="simple")
nlp("Apple was founded in 1976 by Steve Jobs, Steve Wozniak and Ronald Wayne to develop and sell Wozniak's Apple I personal computer")
📚 ドキュメント
学習データ
学習データは以下のように分類されます。
略称 |
説明 |
O |
固有表現の外 |
MISC |
その他の固有表現 |
PER |
人名 |
ORG |
組織 |
LOC |
場所 |
簡略化のため、元のconll2003の接頭辞B-またはI-は削除されています。元のconll2003の学習データセットとテストデータセットを学習に、「検証」データセットを検証に使用しました。これにより、以下のサイズのデータセットが得られました。
モデルの性能
conll2003検証データセットで計算されたモデルの性能(トークン予測に基づく)は以下の通りです。
エンティティ |
精度 |
再現率 |
F1値 |
PER |
0.9914 |
0.9927 |
0.9920 |
ORG |
0.9627 |
0.9661 |
0.9644 |
LOC |
0.9795 |
0.9862 |
0.9828 |
MISC |
0.9292 |
0.9262 |
0.9277 |
全体 |
0.9740 |
0.9766 |
0.9753 |
プライベートデータセット(電子メール、チャット、非公式な議論)で、単語予測に基づいて計算された性能は以下の通りです。
エンティティ |
精度 |
再現率 |
F1値 |
PER |
0.8823 |
0.9116 |
0.8967 |
ORG |
0.7694 |
0.7292 |
0.7487 |
LOC |
0.8619 |
0.7768 |
0.8171 |
同じプライベートデータセットでの比較として、Spacy(en_core_web_trf-3.2.0)の性能は以下の通りです。
エンティティ |
精度 |
再現率 |
F1値 |
PER |
0.9146 |
0.8287 |
0.8695 |
ORG |
0.7655 |
0.6437 |
0.6993 |
LOC |
0.8727 |
0.6180 |
0.7236 |
興味のある方のために、このモデルの結果を使用して電子メールの署名検出用のLSTMモデルを学習させた方法に関する短い記事を紹介します。
https://medium.com/@jean-baptiste.polle/lstm-model-for-email-signature-detection-8e990384fefa
📄 ライセンス
このモデルはMITライセンスの下で提供されています。