osiria commited on
Commit
9d87234
1 Parent(s): b83e7cc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +101 -0
README.md CHANGED
@@ -1,3 +1,104 @@
1
  ---
2
  license: mit
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ language:
4
+ - it
5
+ widget:
6
+ - text: "Mi chiamo Marco Rossi, vivo a Roma e lavoro per l'Agenzia Spaziale Italiana"
7
+ example_title: "Example 1"
8
  ---
9
+
10
+ --------------------------------------------------------------------------------------------------
11
+
12
+ <body>
13
+ <span class="vertical-text" style="background-color:lightgreen;border-radius: 3px;padding: 3px;"> </span>
14
+ <br>
15
+ <span class="vertical-text" style="background-color:orange;border-radius: 3px;padding: 3px;">    Task: Named Entity Recognition</span>
16
+ <br>
17
+ <span class="vertical-text" style="background-color:lightblue;border-radius: 3px;padding: 3px;">    Model: MiniLM</span>
18
+ <br>
19
+ <span class="vertical-text" style="background-color:tomato;border-radius: 3px;padding: 3px;">    Lang: IT</span>
20
+ <br>
21
+ <span class="vertical-text" style="background-color:lightgrey;border-radius: 3px;padding: 3px;">  </span>
22
+ <br>
23
+ <span class="vertical-text" style="background-color:#CF9FFF;border-radius: 3px;padding: 3px;"> </span>
24
+ </body>
25
+
26
+ --------------------------------------------------------------------------------------------------
27
+
28
+ <h3>Model description</h3>
29
+
30
+ This is a <b>MiniLMv2</b> <b>[1]</b> cased model for the <b>Italian</b> language, fine-tuned for <b>Named Entity Recognition</b> (<b>Person</b>, <b>Location</b>, <b>Organization</b> and <b>Miscellanea</b> classes) on the [WikiNER](https://figshare.com/articles/dataset/Learning_multilingual_named_entity_recognition_from_Wikipedia/5462500) dataset <b>[2]</b>, using <b>BERT-ITALIAN</b> ([bert-base-italian-cased](https://huggingface.co/osiria/bert-base-italian-cased)) as a pre-trained model.
31
+
32
+
33
+ <h3>Training and Performances</h3>
34
+
35
+ The model is trained to perform entity recognition over 4 classes: <b>PER</b> (persons), <b>LOC</b> (locations), <b>ORG</b> (organizations), <b>MISC</b> (miscellanea, mainly events, products and services). It has been fine-tuned for Named Entity Recognition, using the WikiNER Italian dataset plus an additional custom dataset of manually annotated Wikipedia paragraphs.
36
+ The WikiNER dataset has been splitted in 102.352 training instances and 25.588 test instances, and the model has been trained for 1 epoch with a constant learning rate of 1e-5.
37
+
38
+ The performances on the test set are reported in the following table:
39
+
40
+ | Recall | Precision | F1 |
41
+ | ------ | ------ | ------ |
42
+ | 80.84 | 85.32 | 82.85 |
43
+
44
+ The metrics have been computed at the token level and then macro-averaged over the 4 classes.
45
+
46
+ Then, since WikiNER is an automatically annotated (silver standard) dataset, which sometimes contains imperfect annotations, an additional fine-tuning on ~3.500 manually annotated paragraphs has been performed.
47
+
48
+ <h3>Quick usage</h3>
49
+
50
+ ```python
51
+ from transformers import AutoTokenizer, AutoModelForTokenClassification
52
+ import string
53
+
54
+ tokenizer = AutoTokenizer.from_pretrained("osiria/minilm-l6-h384-italian-cased-ner")
55
+ model = AutoModelForTokenClassification.from_pretrained("osiria/minilm-l6-h384-italian-cased-ner")
56
+
57
+ from transformers import pipeline
58
+ ner = pipeline("ner", model = model, tokenizer = tokenizer, aggregation_strategy="simple")
59
+
60
+ text = "Mi chiamo Marco Rossi, vivo a Roma e lavoro per l'Agenzia Spaziale Italiana, dove mi occupo del controllo del satellite Prisma"
61
+ for p in string.punctuation:
62
+ text = text.replace(p, " " + p + " ")
63
+
64
+ ner(text)
65
+
66
+ [{'entity_group': 'PER',
67
+ 'score': 0.8044705,
68
+ 'word': 'Marco Rossi',
69
+ 'start': 10,
70
+ 'end': 21},
71
+ {'entity_group': 'LOC',
72
+ 'score': 0.8467228,
73
+ 'word': 'Roma',
74
+ 'start': 32,
75
+ 'end': 36},
76
+ {'entity_group': 'ORG',
77
+ 'score': 0.72725743,
78
+ 'word': 'Agenzia Spaziale Italiana',
79
+ 'start': 54,
80
+ 'end': 79},
81
+ {'entity_group': 'MISC',
82
+ 'score': 0.7243446,
83
+ 'word': 'Prisma',
84
+ 'start': 126,
85
+ 'end': 132}]
86
+ ```
87
+
88
+ You can also try the model online using this web app: https://huggingface.co/spaces/osiria/minilm-l6-h384-italian-cased-ner
89
+
90
+ <h3>References</h3>
91
+
92
+ [1] https://arxiv.org/abs/2012.15828
93
+
94
+ [2] https://www.sciencedirect.com/science/article/pii/S0004370212000276
95
+
96
+ <h3>Limitations</h3>
97
+
98
+ This model is mainly trained on Wikipedia, so it's particularly suitable for natively digital text from the world wide web, written in a correct and fluent form (like wikis, web pages, news, etc.). However, it may show limitations when it comes to chaotic text, containing errors and slang expressions
99
+ (like social media posts) or when it comes to domain-specific text (like medical, financial or legal content).
100
+
101
+ <h3>License</h3>
102
+
103
+ The model is released under <b>MIT</b> license
104
+