返回模型
说明文档
camembert-ner:基于 camemBERT 微调的 NER 模型
介绍
[camembert-ner] 是一个基于 camemBERT 在 wikiner-fr 数据集上微调的命名实体识别(NER)模型。 该模型在 wikiner-fr 数据集上进行了训练(约 170,634 个句子)。 该模型已在邮件/聊天数据上进行了验证,在此类型数据上的表现优于其他模型。 特别值得注意的是,该模型在处理首字母不大写的实体时效果更好。
训练数据
训练数据分类如下:
| 缩写 | 描述 |
|---|---|
| O | 不属于命名实体 |
| MISC | 杂项实体 |
| PER | 人名 |
| ORG | 组织机构 |
| LOC | 地点 |
如何使用 camembert-ner 与 HuggingFace
加载 camembert-ner 及其子词分词器:
from transformers import AutoTokenizer, AutoModelForTokenClassification
tokenizer = AutoTokenizer.from_pretrained("Jean-Baptiste/camembert-ner")
model = AutoModelForTokenClassification.from_pretrained("Jean-Baptiste/camembert-ner")
##### 处理文本样本(来自维基百科)
from transformers import pipeline
nlp = pipeline('ner', model=model, tokenizer=tokenizer, aggregation_strategy="simple")
nlp("Apple est créée le 1er avril 1976 dans le garage de la maison d'enfance de Steve Jobs à Los Altos en Californie par Steve Jobs, Steve Wozniak et Ronald Wayne14, puis constituée sous forme de société le 3 janvier 1977 à l'origine sous le nom d'Apple Computer, mais pour ses 30 ans et pour refléter la diversification de ses produits, le mot « computer » est retiré le 9 janvier 2015.")
[{'entity_group': 'ORG',
'score': 0.9472818374633789,
'word': 'Apple',
'start': 0,
'end': 5},
{'entity_group': 'PER',
'score': 0.9838564991950989,
'word': 'Steve Jobs',
'start': 74,
'end': 85},
{'entity_group': 'LOC',
'score': 0.9831605950991312,
'word': 'Los Altos',
'start': 87,
'end': 97},
{'entity_group': 'LOC',
'score': 0.9834540486335754,
'word': 'Californie',
'start': 100,
'end': 111},
{'entity_group': 'PER',
'score': 0.9841555754343668,
'word': 'Steve Jobs',
'start': 115,
'end': 126},
{'entity_group': 'PER',
'score': 0.9843501806259155,
'word': 'Steve Wozniak',
'start': 127,
'end': 141},
{'entity_group': 'PER',
'score': 0.9841533899307251,
'word': 'Ronald Wayne',
'start': 144,
'end': 157},
{'entity_group': 'ORG',
'score': 0.9468960364659628,
'word': 'Apple Computer',
'start': 243,
'end': 257}]
模型性能(指标:seqeval)
总体
| 精确率 | 召回率 | F1 |
|---|---|---|
| 0.8859 | 0.8971 | 0.8914 |
按实体类型
| 实体 | 精确率 | 召回率 | F1 |
|---|---|---|---|
| PER | 0.9372 | 0.9598 | 0.9483 |
| ORG | 0.8099 | 0.8265 | 0.8181 |
| LOC | 0.8905 | 0.9005 | 0.8955 |
| MISC | 0.8175 | 0.8117 | 0.8146 |
如有兴趣,以下是一篇简短的文章,介绍我如何使用该模型的结果来训练 LSTM 模型以检测邮件中的签名: https://medium.com/@jean-baptiste.polle/lstm-model-for-email-signature-detection-8e990384fefa
Jean-Baptiste/camembert-ner
作者 Jean-Baptiste
token-classification
transformers
↓ 51.7K
♥ 120
创建时间: 2022-03-02 23:29:04+00:00
更新时间: 2023-06-01 01:32:51+00:00
在 Hugging Face 上查看文件 (10)
.gitattributes
README.md
config.json
model.onnx
ONNX
model.safetensors
pytorch_model.bin
sentencepiece.bpe.model
special_tokens_map.json
tokenizer_config.json
vocab.txt