Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,95 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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: DeBERTa</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;"> Type: Uncased</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>DeBERTa</b> <b>[1]</b> uncased 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 [mdeberta-v3-base](https://huggingface.co/microsoft/mdeberta-v3-base) 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 model has been first fine-tuned on WikiNER, then focused on the Italian language and turned to uncased by modifying the embedding layer (as in [3], computing document-level frequencies over the Wikipedia dataset), and lastly fine-tuned on an additional fine-tuning on ~3.500 manually annotated lowercase paragraphs.
|
39 |
+
|
40 |
+
<h3>Quick usage</h3>
|
41 |
+
|
42 |
+
```python
|
43 |
+
from transformers import AutoModelForTokenClassification, AutoTokenizer
|
44 |
+
import re
|
45 |
+
import string
|
46 |
+
|
47 |
+
tokenizer = AutoTokenizer.from_pretrained("osiria/deberta-base-italian-uncased-ner")
|
48 |
+
model = AutoModelForTokenClassification.from_pretrained("osiria/deberta-base-italian-uncased-ner", num_labels = 5)
|
49 |
+
|
50 |
+
text = "mi chiamo marco rossi, vivo a roma e lavoro per l'agenzia spaziale italiana nella missione prisma"
|
51 |
+
|
52 |
+
for p in string.punctuation:
|
53 |
+
text = text.replace(p, " " + p + " ")
|
54 |
+
|
55 |
+
ner(text)
|
56 |
+
|
57 |
+
[{'entity_group': 'PER',
|
58 |
+
'score': 0.9929622,
|
59 |
+
'word': 'marco rossi',
|
60 |
+
'start': 9,
|
61 |
+
'end': 21},
|
62 |
+
{'entity_group': 'LOC',
|
63 |
+
'score': 0.989851,
|
64 |
+
'word': 'roma',
|
65 |
+
'start': 31,
|
66 |
+
'end': 36},
|
67 |
+
{'entity_group': 'ORG',
|
68 |
+
'score': 0.99059105,
|
69 |
+
'word': 'agenzia spaziale italiana',
|
70 |
+
'start': 53,
|
71 |
+
'end': 79},
|
72 |
+
{'entity_group': 'MISC',
|
73 |
+
'score': 0.9247404,
|
74 |
+
'word': 'missione prisma',
|
75 |
+
'start': 85,
|
76 |
+
'end': 101}]
|
77 |
+
```
|
78 |
+
|
79 |
+
<h3>References</h3>
|
80 |
+
|
81 |
+
[1] https://arxiv.org/abs/2111.09543
|
82 |
+
|
83 |
+
[2] https://www.sciencedirect.com/science/article/pii/S0004370212000276
|
84 |
+
|
85 |
+
[3] https://arxiv.org/abs/2010.05609
|
86 |
+
|
87 |
+
<h3>Limitations</h3>
|
88 |
+
|
89 |
+
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
|
90 |
+
(like social media posts) or when it comes to domain-specific text (like medical, financial or legal content).
|
91 |
+
|
92 |
+
<h3>License</h3>
|
93 |
+
|
94 |
+
The model is released under <b>MIT</b> license
|
95 |
+
|