说明文档
distilbert-NER
如果您觉得我的开源模型对您有帮助,请考虑支持我构建有用的小型AI模型(并帮助我负担医学院费用/帮助我的父母经济上)。谢谢!
<a href="https://www.buymeacoffee.com/dslim" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/arial-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>
模型描述
distilbert-NER 是 DistilBERT 的微调版本,DistilBERT 是 BERT 模型的精简变体。DistilBERT 的参数比 BERT 少,使其更小、更快、更高效。distilbert-NER 专门针对**命名实体识别(NER)**任务进行了微调。
该模型能够准确识别与 BERT 对应模型相同的四种实体类型:位置(LOC)、组织(ORG)、人物(PER)和杂项(MISC)。尽管它是一个更紧凑的模型,distilbert-NER 在 NER 任务中表现出色,在大小、速度和准确性之间取得了平衡。
该模型基于英文版 CoNLL-2003 命名实体识别 数据集进行了微调,该数据集以其全面且多样化的实体类型而广受认可。
可用的 NER 模型
| 模型名称 | 描述 | 参数 |
|---|---|---|
| distilbert-NER | 微调 DistilBERT - 更小、更快、更轻量的 BERT 版本 | 66M |
| bert-large-NER | 微调 bert-large-cased - 更大的模型,性能略好 | 340M |
| bert-base-NER-(uncased) | 微调 bert-base,提供 cased 和 uncased 两个版本 | 110M |
预期用途与限制
如何使用
该模型可以与 Transformers 的 pipeline 一起用于 NER,类似于 BERT 模型。
from transformers import AutoTokenizer, AutoModelForTokenClassification
from transformers import pipeline
tokenizer = AutoTokenizer.from_pretrained("dslim/distilbert-NER")
model = AutoModelForTokenClassification.from_pretrained("dslim/distilbert-NER")
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
example = "My name is Wolfgang and I live in Berlin"
ner_results = nlp(example)
print(ner_results)
限制与偏见
distilbert-NER 的性能与其在 CoNLL-2003 数据集上的训练相关。因此,对于与该训练集显著不同的文本数据,其效果可能会有限。用户应注意训练数据中固有的潜在偏见,以及在复杂句子中进行实体错误分类的可能性。
训练数据
该模型基于标准 CoNLL-2003 命名实体识别 数据集的英文版本进行了微调。
训练数据集区分实体的开头和延续,这样如果存在连续的同类型实体,模型可以输出第二个实体的起始位置。与数据集中一样,每个标记将被分类为以下类别之一:
| 缩写 | 描述 |
|---|---|
| O | 命名实体之外 |
| B-MISC | 另一个杂项实体之后的杂项实体开头 |
| I-MISC | 杂项实体 |
| B-PER | 另一个人名之后的人物姓名开头 |
| I-PER | 人物姓名 |
| B-ORG | 另一个组织之后的组织开头 |
| I-ORG | 组织 |
| B-LOC | 另一个位置之后的位置开头 |
| I-LOC | 位置 |
CoNLL-2003 英文数据集统计
该数据集源自由路透社新闻报道组成的路透社语料库。您可以在 CoNLL-2003 论文中详细了解该数据集的创建方式。
每个实体类型的训练示例数量
| 数据集 | LOC | MISC | ORG | PER |
|---|---|---|---|---|
| 训练集 | 7140 | 3438 | 6321 | 6600 |
| 验证集 | 1837 | 922 | 1341 | 1842 |
| 测试集 | 1668 | 702 | 1661 | 1617 |
每个数据集的文章/句子/标记数量
| 数据集 | 文章数 | 句子数 | 标记数 |
|---|---|---|---|
| 训练集 | 946 | 14,987 | 203,621 |
| 验证集 | 216 | 3,466 | 51,362 |
| 测试集 | 231 | 3,684 | 46,435 |
训练过程
该模型在单个 NVIDIA V100 GPU 上训练,使用了来自 原始 BERT 论文 的推荐超参数,该论文在 CoNLL-2003 NER 任务上训练和评估了该模型。
评估结果
| 指标 | 分数 |
|---|---|
| 损失 | 0.0710 |
| 精确率 | 0.9202 |
| 召回率 | 0.9232 |
| F1 | 0.9217 |
| 准确率 | 0.9810 |
训练和验证损失随 epoch 下降,表明学习效果良好。精确率、召回率和 F1 分数都具有竞争力,展示了该模型在 NER 任务中的鲁棒性。
BibTeX 引用信息
对于 DistilBERT:
@article{sanh2019distilbert,
title={DistilBERT, a distilled version of BERT: smaller, faster, cheaper and lighter},
author={Sanh, Victor and Debut, Lysandre and Chaumond, Julien and Wolf, Thomas},
journal={arXiv preprint arXiv:1910.01108},
year={2019}
}
对于底层 BERT 模型:
@article{DBLP:journals/corr/abs-1810-04805,
author = {Jacob Devlin and
Ming{-}Wei Chang and
Kenton Lee and
Kristina Toutanova},
title = {{BERT:} Pre-training of Deep Bidirectional Transformers for Language
Understanding},
journal = {CoRR},
volume = {abs/1810.04805},
year = {2018},
url = {http://arxiv.org/abs/1810.04805},
archivePrefix = {arXiv},
eprint = {1810.04805},
timestamp = {Tue, 30 Oct 2018 20:39:56 +0100},
biburl = {https://dblp.org/rec/journals/corr/abs-1810-04805.bib},
bibsource = {dblp computer science bibliography, https://dblp.org}
}
dslim/distilbert-NER
作者 dslim
创建时间: 2024-01-25 21:01:49+00:00
更新时间: 2024-10-08 07:52:51+00:00
在 Hugging Face 上查看