File size: 2,366 Bytes
6fb5578
7f4f5c3
6fb5578
 
0008a4a
abe64e2
0008a4a
 
abe64e2
 
0008a4a
abe64e2
 
 
 
 
 
 
b731d78
 
 
 
 
 
 
abe64e2
 
0008a4a
 
 
abe64e2
0008a4a
 
abe64e2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0008a4a
abe64e2
d85d4dc
b731d78
d85d4dc
abe64e2
 
b731d78
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
language: es
license: cc-by-4.0
---
# NER-fine-tuned-BETO: model fine-tuned from BETO for NER task.
---
Language: es
Datasets:
- conll2002
- Babelscape/wikineural

## Introduction
[NER-fine-tuned-BETO] is a NER model that was fine-tuned from BETO on the 2002 Conll and the WikiNEuRal spanish datasets.
Model was trained on the Conll 2002 train dataset (~8320 sentences) and a bootstrapped dataset of WikiNEuRal, where we re-evaluate the dataset and only keep the sentences where all the labels matched the predictions made.
Model was evaluated on the test dataset of Conll2002.

## Training data
Training data was classified as follow:
|Abbreviation|  Description  |
|:----------:|:-------------:|
|     O      | Outside of NE |
|    PER     | Person’s name |
|    ORG     | Organization  |
|    LOC     |  Location     |
|   MISC     | Miscellaneous |

Alongside the IOB formatting, this is:
  - B-LABEL if the word is at the beggining of the entity.
  - I-LABEL if the word is part of the entity name, but not the first word.
  
## How to use NER-fine-tuned-BETO with HuggingFace
Load the model and its tokenizer :

```python
from transformers import AutoTokenizer, AutoModelForTokenClassification

tokenizer = AutoTokenizer.from_pretrained("NazaGara/NER-fine-tuned-BETO", use_auth_token=True)
model = AutoModelForTokenClassification.from_pretrained("NazaGara/NER-fine-tuned-BETO", use_auth_token=True)

nlp = pipeline('ner', model=model, tokenizer=tokenizer, aggregation_strategy="simple")
nlp('Ignacio se fue de viaje por Buenos aires')

[{'entity_group': 'PER',
  'score': 0.9997764,
  'word': 'Ignacio',
  'start': 0,
  'end': 7},
 {'entity_group': 'LOC',
  'score': 0.9997932,
  'word': 'Buenos aires',
  'start': 28,
  'end': 40}]

```
## Model Performance
Overall
| precision | recall | f1-score |
|:---------:|:------:|:--------:|
| 0.9833    | 0.8950 | 0.8998   |

By classes
| class  | precision | recall | f1-score |
|:------:|:---------:|:------:|:--------:|
| O      | 0.9958    | 0.9965 | 0.990    |
| B-PER  | 0.9572    | 0.9741 | 0.9654   |
| I-PER  | 0.9487    | 0.9921 | 0.9699   |
| B-ORG  | 0.8823    | 0.9264 | 0.9038   |
| I-ORG  | 0.9253    | 0.9264 | 0.9117   |
| B-LOC  | 0.8967    | 0.8736 | 0.8850   |
| I-LOC  | 0.8870    | 0.8215 | 0.8530   |
| B-MISC | 0.7541    | 0.7964 | 0.7747   |
| I-MISC | 0.9026    | 0.7827 | 0.8384   |