hf_mirrors/camembert_ner
Model Introduction
Files & versions
Analysis

camembert-ner: model fine-tuned from camemBERT for NER task.

Modification

  • Modify example code to openMind and add npu support

Introduction

camembert-ner is a NER model that was fine-tuned from camemBERT on wikiner-fr dataset. Model was trained on wikiner-fr dataset (~170 634 sentences). Model was validated on emails/chat data and overperformed other models on this type of data specifically. In particular the model seems to work better on entity that don't start with an upper case.

Training data

Training data was classified as follow:

AbbreviationDescription
OOutside of a named entity
MISCMiscellaneous entity
PERPerson’s name
ORGOrganization
LOCLocation

How to use camembert-ner with HuggingFace

Load camembert-ner and its sub-word tokenizer :
import torch
from openmind import AutoTokenizer, pipeline, is_torch_npu_available
from transformers import AutoModelForTokenClassification

if is_torch_npu_available():
    device = "npu:0"
else:
    device = "cpu"

model_path= "PyTorch-NPU/camembert_ner"
tokenizer = AutoTokenizer.from_pretrained(model_path)
model = AutoModelForTokenClassification.from_pretrained(model_path)

nlp = pipeline("ner", model=model, tokenizer=tokenizer, aggregation_strategy="simple", device=device)
output = 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.")
print(f'>>>output={output}')

Model performances (metric: seqeval)

Overall

precisionrecallf1
0.88590.89710.8914

By entity

entityprecisionrecallf1
PER0.93720.95980.9483
ORG0.80990.82650.8181
LOC0.89050.90050.8955
MISC0.81750.81170.8146

For those who could be interested, here is a short article on how I used the results of this model to train a LSTM model for signature detection in emails: https://medium.com/@jean-baptiste.polle/lstm-model-for-email-signature-detection-8e990384fefa