sami commited on
Commit ·
ac49e62
1
Parent(s): af46a6a
new_ner
Browse files- README.md +65 -0
- config.json +47 -0
- pytorch_model.bin +3 -0
- sentencepiece.bpe.model +3 -0
- special_tokens_map.json +1 -0
- tokenizer_config.json +1 -0
- training_args.bin +3 -0
README.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
Hugging Face's logo
|
| 2 |
+
---
|
| 3 |
+
language:
|
| 4 |
+
- ar
|
| 5 |
+
- de
|
| 6 |
+
- en
|
| 7 |
+
- es
|
| 8 |
+
- fr
|
| 9 |
+
- it
|
| 10 |
+
- lv
|
| 11 |
+
- nl
|
| 12 |
+
- pt
|
| 13 |
+
- zh
|
| 14 |
+
- multilingual
|
| 15 |
+
|
| 16 |
+
---
|
| 17 |
+
# xlm-roberta-large-ner-hrl
|
| 18 |
+
## Model description
|
| 19 |
+
**xlm-roberta-large-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 XLM-RoBERTa large model. It has been trained to recognize three types of entities: location (LOC), organizations (ORG), and person (PER).
|
| 20 |
+
Specifically, this model is a *xlm-roberta-large* model that was fine-tuned on an aggregation of 10 high-resourced languages
|
| 21 |
+
## Intended uses & limitations
|
| 22 |
+
#### How to use
|
| 23 |
+
You can use this model with Transformers *pipeline* for NER.
|
| 24 |
+
```python
|
| 25 |
+
from transformers import AutoTokenizer, AutoModelForTokenClassification
|
| 26 |
+
from transformers import pipeline
|
| 27 |
+
tokenizer = AutoTokenizer.from_pretrained("Davlan/xlm-roberta-large-ner-hrl")
|
| 28 |
+
model = AutoModelForTokenClassification.from_pretrained("Davlan/xlm-roberta-large-ner-hrl")
|
| 29 |
+
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
|
| 30 |
+
example = "Nader Jokhadar had given Syria the lead with a well-struck header in the seventh minute."
|
| 31 |
+
ner_results = nlp(example)
|
| 32 |
+
print(ner_results)
|
| 33 |
+
```
|
| 34 |
+
#### Limitations and bias
|
| 35 |
+
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.
|
| 36 |
+
## Training data
|
| 37 |
+
The training data for the 10 languages are from:
|
| 38 |
+
|
| 39 |
+
Language|Dataset
|
| 40 |
+
-|-
|
| 41 |
+
Arabic | [ANERcorp](https://camel.abudhabi.nyu.edu/anercorp/)
|
| 42 |
+
German | [conll 2003](https://www.clips.uantwerpen.be/conll2003/ner/)
|
| 43 |
+
English | [conll 2003](https://www.clips.uantwerpen.be/conll2003/ner/)
|
| 44 |
+
Spanish | [conll 2002](https://www.clips.uantwerpen.be/conll2002/ner/)
|
| 45 |
+
French | [Europeana Newspapers](https://github.com/EuropeanaNewspapers/ner-corpora/tree/master/enp_FR.bnf.bio)
|
| 46 |
+
Italian | [Italian I-CAB](https://ontotext.fbk.eu/icab.html)
|
| 47 |
+
Latvian | [Latvian NER](https://github.com/LUMII-AILab/FullStack/tree/master/NamedEntities)
|
| 48 |
+
Dutch | [conll 2002](https://www.clips.uantwerpen.be/conll2002/ner/)
|
| 49 |
+
Portuguese |[Paramopama + Second Harem](https://github.com/davidsbatista/NER-datasets/tree/master/Portuguese)
|
| 50 |
+
Chinese | [MSRA](https://huggingface.co/datasets/msra_ner)
|
| 51 |
+
|
| 52 |
+
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:
|
| 53 |
+
Abbreviation|Description
|
| 54 |
+
-|-
|
| 55 |
+
O|Outside of a named entity
|
| 56 |
+
B-PER |Beginning of a person’s name right after another person’s name
|
| 57 |
+
I-PER |Person’s name
|
| 58 |
+
B-ORG |Beginning of an organisation right after another organisation
|
| 59 |
+
I-ORG |Organisation
|
| 60 |
+
B-LOC |Beginning of a location right after another location
|
| 61 |
+
I-LOC |Location
|
| 62 |
+
## Training procedure
|
| 63 |
+
This model was trained on NVIDIA V100 GPU with recommended hyperparameters from HuggingFace code.
|
| 64 |
+
|
| 65 |
+
|
config.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "xlm-roberta-large",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"XLMRobertaForTokenClassification"
|
| 5 |
+
],
|
| 6 |
+
"attention_probs_dropout_prob": 0.1,
|
| 7 |
+
"bos_token_id": 0,
|
| 8 |
+
"eos_token_id": 2,
|
| 9 |
+
"gradient_checkpointing": false,
|
| 10 |
+
"hidden_act": "gelu",
|
| 11 |
+
"hidden_dropout_prob": 0.1,
|
| 12 |
+
"hidden_size": 1024,
|
| 13 |
+
"id2label": {
|
| 14 |
+
"0": "O",
|
| 15 |
+
"1": "B-DATE",
|
| 16 |
+
"2": "I-DATE",
|
| 17 |
+
"3": "B-PER",
|
| 18 |
+
"4": "I-PER",
|
| 19 |
+
"5": "B-ORG",
|
| 20 |
+
"6": "I-ORG",
|
| 21 |
+
"7": "B-LOC",
|
| 22 |
+
"8": "I-LOC"
|
| 23 |
+
},
|
| 24 |
+
"initializer_range": 0.02,
|
| 25 |
+
"intermediate_size": 4096,
|
| 26 |
+
"label2id": {
|
| 27 |
+
"B-DATE": 1,
|
| 28 |
+
"B-LOC": 7,
|
| 29 |
+
"B-ORG": 5,
|
| 30 |
+
"B-PER": 3,
|
| 31 |
+
"I-DATE": 2,
|
| 32 |
+
"I-LOC": 8,
|
| 33 |
+
"I-ORG": 6,
|
| 34 |
+
"I-PER": 4,
|
| 35 |
+
"O": 0
|
| 36 |
+
},
|
| 37 |
+
"layer_norm_eps": 1e-05,
|
| 38 |
+
"max_position_embeddings": 514,
|
| 39 |
+
"model_type": "xlm-roberta",
|
| 40 |
+
"num_attention_heads": 16,
|
| 41 |
+
"num_hidden_layers": 24,
|
| 42 |
+
"output_past": true,
|
| 43 |
+
"pad_token_id": 1,
|
| 44 |
+
"position_embedding_type": "absolute",
|
| 45 |
+
"type_vocab_size": 1,
|
| 46 |
+
"vocab_size": 250002
|
| 47 |
+
}
|
pytorch_model.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:954cb8c2cb4f51a6451c2b2c17b57131df67825d93c95974b56ba4128afc6f63
|
| 3 |
+
size 2235572919
|
sentencepiece.bpe.model
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:cfc8146abe2a0488e9e2a0c56de7952f7c11ab059eca145a0a727afce0db2865
|
| 3 |
+
size 5069051
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"bos_token": "<s>", "eos_token": "</s>", "unk_token": "<unk>", "sep_token": "</s>", "pad_token": "<pad>", "cls_token": "<s>", "mask_token": "<mask>"}
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"bos_token": "<s>", "eos_token": "</s>", "sep_token": "</s>", "cls_token": "<s>", "unk_token": "<unk>", "pad_token": "<pad>", "mask_token": "<mask>", "model_max_length": 512, "name_or_path": "xlm-roberta-large"}
|
training_args.bin
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f773360234c947e56b446078e4bb52475c96c326c040072882dd50be96d0bf1b
|
| 3 |
+
size 1519
|