🚀 大型無大小寫區分的BERT模型微調命名實體識別
此模型是在CoNLL2003數據集上對bert-large-uncased進行微調後的版本。它在評估集上取得了以下效果:
- 損失值:0.0778
- 精確率:0.9505
- 召回率:0.9575
- F1值:0.9540
- 準確率:0.9886
🚀 快速開始
本模型可通過Transformers的 pipeline 用於命名實體識別(NER)。
基礎用法
from transformers import pipeline
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("Jorgeutd/bert-large-uncased-finetuned-ner")
model = AutoModelForTokenClassification.from_pretrained("Jorgeutd/bert-large-uncased-finetuned-ner")
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
example = "My name is Scott and I live in Ohio"
ner_results = nlp(example)
print(ner_results)
✨ 主要特性
- 基於大型無大小寫區分的BERT模型進行微調,在CoNLL2003數據集上有良好表現。
- 能夠對文本中的命名實體進行有效識別。
📦 安裝指南
文檔未提供安裝相關內容,暫不展示。
💻 使用示例
基礎用法
from transformers import pipeline
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("Jorgeutd/bert-large-uncased-finetuned-ner")
model = AutoModelForTokenClassification.from_pretrained("Jorgeutd/bert-large-uncased-finetuned-ner")
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
example = "My name is Scott and I live in Ohio"
ner_results = nlp(example)
print(ner_results)
📚 詳細文檔
模型描述
需要更多信息。
侷限性和偏差
此模型受其訓練數據集的限制,該數據集為特定時間段內帶有實體標註的新聞文章。這可能導致它在不同領域的所有用例中泛化能力不佳。此外,模型偶爾會將子詞標記為實體,可能需要對結果進行後處理以處理這些情況。
訓練過程
訓練超參數
訓練過程中使用了以下超參數:
- 學習率:2e - 05
- 訓練批次大小:16
- 評估批次大小:64
- 隨機種子:42
- 優化器:Adam(β1 = 0.9,β2 = 0.999,ε = 1e - 08)
- 學習率調度器類型:線性
- 訓練輪數:10
訓練結果
訓練損失 |
輪數 |
步數 |
驗證損失 |
精確率 |
召回率 |
F1值 |
準確率 |
0.1997 |
1.0 |
878 |
0.0576 |
0.9316 |
0.9257 |
0.9286 |
0.9837 |
0.04 |
2.0 |
1756 |
0.0490 |
0.9400 |
0.9513 |
0.9456 |
0.9870 |
0.0199 |
3.0 |
2634 |
0.0557 |
0.9436 |
0.9540 |
0.9488 |
0.9879 |
0.0112 |
4.0 |
3512 |
0.0602 |
0.9443 |
0.9569 |
0.9506 |
0.9881 |
0.0068 |
5.0 |
4390 |
0.0631 |
0.9451 |
0.9589 |
0.9520 |
0.9882 |
0.0044 |
6.0 |
5268 |
0.0638 |
0.9510 |
0.9567 |
0.9538 |
0.9885 |
0.003 |
7.0 |
6146 |
0.0722 |
0.9495 |
0.9560 |
0.9527 |
0.9885 |
0.0016 |
8.0 |
7024 |
0.0762 |
0.9491 |
0.9595 |
0.9543 |
0.9887 |
0.0018 |
9.0 |
7902 |
0.0769 |
0.9496 |
0.9542 |
0.9519 |
0.9883 |
0.0009 |
10.0 |
8780 |
0.0778 |
0.9505 |
0.9575 |
0.9540 |
0.9886 |
框架版本
- Transformers 4.16.2
- Pytorch 1.8.1 + cu111
- Datasets 1.18.3
- Tokenizers 0.11.0
🔧 技術細節
文檔未提供足夠技術細節內容,暫不展示。
📄 許可證
本項目採用Apache 2.0許可證。