105 lines
2.7 KiB
Markdown
105 lines
2.7 KiB
Markdown
---
|
|
language: fr
|
|
datasets:
|
|
- Jean-Baptiste/wikiner_fr
|
|
widget:
|
|
- text: "Je m'appelle Jean-Baptiste et je vis à Paris"
|
|
---
|
|
|
|
# camembert-ner: model fine-tuned from camemBERT for NER task.
|
|
|
|
## Introduction
|
|
|
|
[camembert-ner] is a NER model that was fine-tuned from camemBERT on wikiner-fr dataset.
|
|
Model was trained on subset of wikiner-fr dataset (~36 000 sentences)
|
|
|
|
|
|
## How to use camembert-ner with HuggingFace
|
|
|
|
##### Load camembert-ner and its sub-word tokenizer :
|
|
|
|
```python
|
|
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
|
|
|
tokenizer = AutoTokenizer.from_pretrained("Jean-Baptiste/camembert-ner")
|
|
model = AutoModelForTokenClassification.from_pretrained("Jean-Baptiste/camembert-ner")
|
|
|
|
|
|
##### Process text sample (from wikipedia)
|
|
|
|
from transformers import pipeline
|
|
|
|
nlp = pipeline('ner', model=model, tokenizer=tokenizer, grouped_entities=True)
|
|
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}]
|
|
|
|
```
|
|
|
|
|
|
## Model performances (metric: seqeval)
|
|
|
|
Global
|
|
```
|
|
'precision': 0.8830965723967158
|
|
'recall': 0.8915789473684211
|
|
'f1': 0.8873174883781837
|
|
```
|
|
|
|
By entity
|
|
```
|
|
'LOC': {'precision': 0.8701754385964913,
|
|
'recall': 0.8878281622911695,
|
|
'f1': 0.8789131718842291},
|
|
'MISC': {'precision': 0.831053901850362,
|
|
'recall': 0.815955766192733,
|
|
'f1': 0.823435631725787},
|
|
'ORG': {'precision': 0.8620199146514936,
|
|
'recall': 0.8335625859697386,
|
|
'f1': 0.8475524475524475},
|
|
'PER': {'precision': 0.9367143476376246,
|
|
'recall': 0.9583148558758315,
|
|
'f1': 0.947391494958}
|
|
```
|
|
|