Migrate model card from transformers-repo
Browse filesRead announcement at https://discuss.huggingface.co/t/announcement-all-model-cards-will-be-migrated-to-hf-co-model-repos/2755
Original file history: https://github.com/huggingface/transformers/commits/master/model_cards/mrm8488/bert-spanish-cased-finetuned-ner/README.md
README.md
ADDED
@@ -0,0 +1,79 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: es
|
3 |
+
thumbnail: https://i.imgur.com/jgBdimh.png
|
4 |
+
---
|
5 |
+
|
6 |
+
# Spanish BERT (BETO) + NER
|
7 |
+
|
8 |
+
This model is a fine-tuned on [NER-C](https://www.kaggle.com/nltkdata/conll-corpora) version of the Spanish BERT cased [(BETO)](https://github.com/dccuchile/beto) for **NER** downstream task.
|
9 |
+
|
10 |
+
## Details of the downstream task (NER) - Dataset
|
11 |
+
|
12 |
+
- [Dataset: CONLL Corpora ES](https://www.kaggle.com/nltkdata/conll-corpora)
|
13 |
+
|
14 |
+
I preprocessed the dataset and split it as train / dev (80/20)
|
15 |
+
|
16 |
+
| Dataset | # Examples |
|
17 |
+
| ---------------------- | ----- |
|
18 |
+
| Train | 8.7 K |
|
19 |
+
| Dev | 2.2 K |
|
20 |
+
|
21 |
+
|
22 |
+
- [Fine-tune on NER script provided by Huggingface](https://github.com/huggingface/transformers/blob/master/examples/token-classification/run_ner_old.py)
|
23 |
+
|
24 |
+
- Labels covered:
|
25 |
+
|
26 |
+
```
|
27 |
+
B-LOC
|
28 |
+
B-MISC
|
29 |
+
B-ORG
|
30 |
+
B-PER
|
31 |
+
I-LOC
|
32 |
+
I-MISC
|
33 |
+
I-ORG
|
34 |
+
I-PER
|
35 |
+
O
|
36 |
+
```
|
37 |
+
|
38 |
+
## Metrics on evaluation set:
|
39 |
+
|
40 |
+
| Metric | # score |
|
41 |
+
| :------------------------------------------------------------------------------------: | :-------: |
|
42 |
+
| F1 | **90.17**
|
43 |
+
| Precision | **89.86** |
|
44 |
+
| Recall | **90.47** |
|
45 |
+
|
46 |
+
## Comparison:
|
47 |
+
|
48 |
+
| Model | # F1 score |Size(MB)|
|
49 |
+
| :--------------------------------------------------------------------------------------------------------------: | :-------: |:------|
|
50 |
+
| bert-base-spanish-wwm-cased (BETO) | 88.43 | 421
|
51 |
+
| [bert-spanish-cased-finetuned-ner (this one)](https://huggingface.co/mrm8488/bert-spanish-cased-finetuned-ner) | **90.17** | 420 |
|
52 |
+
| Best Multilingual BERT | 87.38 | 681 |
|
53 |
+
|[TinyBERT-spanish-uncased-finetuned-ner](https://huggingface.co/mrm8488/TinyBERT-spanish-uncased-finetuned-ner) | 70.00 | **55** |
|
54 |
+
|
55 |
+
## Model in action
|
56 |
+
|
57 |
+
Fast usage with **pipelines**:
|
58 |
+
|
59 |
+
```python
|
60 |
+
from transformers import pipeline
|
61 |
+
|
62 |
+
nlp_ner = pipeline(
|
63 |
+
"ner",
|
64 |
+
model="mrm8488/bert-spanish-cased-finetuned-ner",
|
65 |
+
tokenizer=(
|
66 |
+
'mrm8488/bert-spanish-cased-finetuned-ner',
|
67 |
+
{"use_fast": False}
|
68 |
+
))
|
69 |
+
|
70 |
+
text = 'Mis amigos están pensando viajar a Londres este verano'
|
71 |
+
|
72 |
+
nlp_ner(text)
|
73 |
+
|
74 |
+
#Output: [{'entity': 'B-LOC', 'score': 0.9998720288276672, 'word': 'Londres'}]
|
75 |
+
```
|
76 |
+
|
77 |
+
> Created by [Manuel Romero/@mrm8488](https://twitter.com/mrm8488)
|
78 |
+
|
79 |
+
> Made with <span style="color: #e25555;">♥</span> in Spain
|