add bert ner hrl
This commit is contained in:
parent
c3eca740cc
commit
927df9cd6a
|
@ -0,0 +1,65 @@
|
|||
Hugging Face's logo
|
||||
---
|
||||
language:
|
||||
- ar
|
||||
- de
|
||||
- en
|
||||
- es
|
||||
- fr
|
||||
- it
|
||||
- lv
|
||||
- nl
|
||||
- pt
|
||||
- zh
|
||||
- multilingual
|
||||
|
||||
---
|
||||
# bert-base-multilingual-cased-ner-hrl
|
||||
## Model description
|
||||
**bert-base-multilingual-cased-ner-hrl** is a **Named Entity Recognition** model for 10 high resourced languages (Arabic, German, English, Spanish, French, Italian, Latvian, Dutch, Portuguese and Chinese) based on a fine-tuned mBERT base model. It has been trained to recognize three types of entities: location (LOC), organizations (ORG), and person (PER).
|
||||
Specifically, this model is a *bert-base-multilingual-cased* model that was fine-tuned on an aggregation of 10 high-resourced languages
|
||||
## Intended uses & limitations
|
||||
#### How to use
|
||||
You can use this model with Transformers *pipeline* for NER.
|
||||
```python
|
||||
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
||||
from transformers import pipeline
|
||||
tokenizer = AutoTokenizer.from_pretrained("Davlan/bert-base-multilingual-cased-ner-hrl")
|
||||
model = AutoModelForTokenClassification.from_pretrained("Davlan/bert-base-multilingual-cased-ner-hrl")
|
||||
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
|
||||
example = "Nader Jokhadar had given Syria the lead with a well-struck header in the seventh minute."
|
||||
ner_results = nlp(example)
|
||||
print(ner_results)
|
||||
```
|
||||
#### Limitations and bias
|
||||
This model is limited by its training dataset of entity-annotated news articles from a specific span of time. This may not generalize well for all use cases in different domains.
|
||||
## Training data
|
||||
The training data for the 10 languages are from:
|
||||
|
||||
Language|Dataset
|
||||
-|-
|
||||
Arabic | [ANERcorp](https://github.com/EmnamoR/Arabic-named-entity-recognition)
|
||||
German | [conll 2003](https://www.clips.uantwerpen.be/conll2003/ner/)
|
||||
English | [conll 2003](https://www.clips.uantwerpen.be/conll2003/ner/)
|
||||
Spanish | [conll 2002](https://www.clips.uantwerpen.be/conll2002/ner/)
|
||||
French | [Europeana Newspapers](https://github.com/EuropeanaNewspapers/ner-corpora/tree/master/enp_FR.bnf.bio)
|
||||
Italian | [Italian I-CAB](https://ontotext.fbk.eu/icab.html)
|
||||
Latvian | [Latvian NER](https://github.com/LUMII-AILab/FullStack/tree/master/NamedEntities)
|
||||
Dutch | [conll 2002](https://www.clips.uantwerpen.be/conll2002/ner/)
|
||||
Portuguese |[Paramopama + Second Harem](https://github.com/davidsbatista/NER-datasets/tree/master/Portuguese)
|
||||
Chinese | [MSRA](https://huggingface.co/datasets/msra_ner)
|
||||
|
||||
The training dataset distinguishes between the beginning and continuation of an entity so that if there are back-to-back entities of the same type, the model can output where the second entity begins. As in the dataset, each token will be classified as one of the following classes:
|
||||
Abbreviation|Description
|
||||
-|-
|
||||
O|Outside of a named entity
|
||||
B-PER |Beginning of a person’s name right after another person’s name
|
||||
I-PER |Person’s name
|
||||
B-ORG |Beginning of an organisation right after another organisation
|
||||
I-ORG |Organisation
|
||||
B-LOC |Beginning of a location right after another location
|
||||
I-LOC |Location
|
||||
## Training procedure
|
||||
This model was trained on NVIDIA V100 GPU with recommended hyperparameters from HuggingFace code.
|
||||
|
||||
|
|
@ -0,0 +1,50 @@
|
|||
{
|
||||
"_name_or_path": "bert-base-multilingual-cased",
|
||||
"architectures": [
|
||||
"BertForTokenClassification"
|
||||
],
|
||||
"attention_probs_dropout_prob": 0.1,
|
||||
"directionality": "bidi",
|
||||
"gradient_checkpointing": false,
|
||||
"hidden_act": "gelu",
|
||||
"hidden_dropout_prob": 0.1,
|
||||
"hidden_size": 768,
|
||||
"id2label": {
|
||||
"0": "O",
|
||||
"1": "B-DATE",
|
||||
"2": "I-DATE",
|
||||
"3": "B-PER",
|
||||
"4": "I-PER",
|
||||
"5": "B-ORG",
|
||||
"6": "I-ORG",
|
||||
"7": "B-LOC",
|
||||
"8": "I-LOC"
|
||||
},
|
||||
"initializer_range": 0.02,
|
||||
"intermediate_size": 3072,
|
||||
"label2id": {
|
||||
"B-DATE": 1,
|
||||
"B-LOC": 7,
|
||||
"B-ORG": 5,
|
||||
"B-PER": 3,
|
||||
"I-DATE": 2,
|
||||
"I-LOC": 8,
|
||||
"I-ORG": 6,
|
||||
"I-PER": 4,
|
||||
"O": 0
|
||||
},
|
||||
"layer_norm_eps": 1e-12,
|
||||
"max_position_embeddings": 512,
|
||||
"model_type": "bert",
|
||||
"num_attention_heads": 12,
|
||||
"num_hidden_layers": 12,
|
||||
"pad_token_id": 0,
|
||||
"pooler_fc_size": 768,
|
||||
"pooler_num_attention_heads": 12,
|
||||
"pooler_num_fc_layers": 3,
|
||||
"pooler_size_per_head": 128,
|
||||
"pooler_type": "first_token_transform",
|
||||
"position_embedding_type": "absolute",
|
||||
"type_vocab_size": 2,
|
||||
"vocab_size": 119547
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
{"unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]"}
|
|
@ -0,0 +1 @@
|
|||
{"do_lower_case": false, "unk_token": "[UNK]", "sep_token": "[SEP]", "pad_token": "[PAD]", "cls_token": "[CLS]", "mask_token": "[MASK]", "tokenize_chinese_chars": true, "strip_accents": null, "model_max_length": 512, "name_or_path": "bert-base-multilingual-cased"}
|
Binary file not shown.
Loading…
Reference in New Issue