Initial model
Browse files- README.md +87 -0
- config.json +65 -0
- merges.txt +0 -0
- pytorch_model.bin +3 -0
- special_tokens_map.json +1 -0
- tf_model.h5 +3 -0
- tokenizer.json +0 -0
- tokenizer_config.json +1 -0
- vocab.json +0 -0
README.md
ADDED
@@ -0,0 +1,87 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language: is
|
3 |
+
license: apache-2.0
|
4 |
+
widget:
|
5 |
+
- text: "Kristin manneskja getur ekki lagt frásagnir af Jesú Kristi á hilluna vegna þess að hún sé búin að lesa þær ."
|
6 |
+
- text: "Til hvers að kjósa flokk , sem þykist vera Jafnaðarmannaflokkur rétt fyrir kosningar , þegar að það er hægt að kjósa sannnan jafnaðarmannaflokk , sjálfan Jafnaðarmannaflokk Íslands - Samfylkinguna ."
|
7 |
+
- text: "Það sannaðist svo eftirminnilega á plötunni Það þarf fólk eins og þig sem kom út fyrir þremur árum , en á henni hann Fálka úr Keflavík og Gáluna , son sinn , til að útsetja lög hans og spila inn ."
|
8 |
+
- text: "Lögin hafa áður komið út sem aukalög á smáskífum af Hail to the Thief , en á disknum er líka myndband og fleira efni fyrir tölvur ."
|
9 |
+
- text: "Britney gerði honum viðvart og hann ók henni á UCLA-sjúkrahúsið í Santa Monica en það er í nágrenni hljóðversins ."
|
10 |
+
---
|
11 |
+
|
12 |
+
|
13 |
+
# IcelandicNER RoBERTa
|
14 |
+
|
15 |
+
This model was fine-tuned on the MIM-GOLD-NER dataset for the Icelandic language.
|
16 |
+
The [MIM-GOLD-NER](http://hdl.handle.net/20.500.12537/42) corpus was developed at [Reykjavik University](https://en.ru.is/) in 2018–2020 that covered eight types of entities:
|
17 |
+
|
18 |
+
- Date
|
19 |
+
- Location
|
20 |
+
- Miscellaneous
|
21 |
+
- Money
|
22 |
+
- Organization
|
23 |
+
- Percent
|
24 |
+
- Person
|
25 |
+
- Time
|
26 |
+
|
27 |
+
## Dataset Information
|
28 |
+
|
29 |
+
| | Records | B-Date | B-Location | B-Miscellaneous | B-Money | B-Organization | B-Percent | B-Person | B-Time | I-Date | I-Location | I-Miscellaneous | I-Money | I-Organization | I-Percent | I-Person | I-Time |
|
30 |
+
|:------|----------:|---------:|-------------:|------------------:|----------:|-----------------:|------------:|-----------:|---------:|---------:|-------------:|------------------:|----------:|-----------------:|------------:|-----------:|---------:|
|
31 |
+
| Train | 39988 | 3409 | 5980 | 4351 | 729 | 5754 | 502 | 11719 | 868 | 2112 | 516 | 3036 | 770 | 2382 | 50 | 5478 | 790 |
|
32 |
+
| Valid | 7063 | 570 | 1034 | 787 | 100 | 1078 | 103 | 2106 | 147 | 409 | 76 | 560 | 104 | 458 | 7 | 998 | 136 |
|
33 |
+
| Test | 8299 | 779 | 1319 | 935 | 153 | 1315 | 108 | 2247 | 172 | 483 | 104 | 660 | 167 | 617 | 10 | 1089 | 158 |
|
34 |
+
|
35 |
+
|
36 |
+
## Evaluation
|
37 |
+
|
38 |
+
The following tables summarize the scores obtained by model overall and per each class.
|
39 |
+
|
40 |
+
| entity | precision | recall | f1-score | support |
|
41 |
+
|:-------------:|:---------:|:--------:|:--------:|:-------:|
|
42 |
+
| Date | 0.961881 | 0.971759 | 0.966794 | 779.0 |
|
43 |
+
| Location | 0.963047 | 0.968158 | 0.965595 | 1319.0 |
|
44 |
+
| Miscellaneous | 0.884946 | 0.880214 | 0.882574 | 935.0 |
|
45 |
+
| Money | 0.980132 | 0.967320 | 0.973684 | 153.0 |
|
46 |
+
| Organization | 0.924300 | 0.928517 | 0.926404 | 1315.0 |
|
47 |
+
| Percent | 1.000000 | 1.000000 | 1.000000 | 108.0 |
|
48 |
+
| Person | 0.978591 | 0.976413 | 0.977501 | 2247.0 |
|
49 |
+
| Time | 0.965116 | 0.965116 | 0.965116 | 172.0 |
|
50 |
+
| micro avg | 0.951258 | 0.952476 | 0.951866 | 7028.0 |
|
51 |
+
| macro avg | 0.957252 | 0.957187 | 0.957209 | 7028.0 |
|
52 |
+
| weighted avg | 0.951237 | 0.952476 | 0.951849 | 7028.0 |
|
53 |
+
|
54 |
+
|
55 |
+
## How To Use
|
56 |
+
You use this model with Transformers pipeline for NER.
|
57 |
+
|
58 |
+
### Installing requirements
|
59 |
+
|
60 |
+
```bash
|
61 |
+
pip install transformers
|
62 |
+
```
|
63 |
+
|
64 |
+
### How to predict using pipeline
|
65 |
+
|
66 |
+
```python
|
67 |
+
from transformers import AutoTokenizer
|
68 |
+
from transformers import AutoModelForTokenClassification # for pytorch
|
69 |
+
from transformers import TFAutoModelForTokenClassification # for tensorflow
|
70 |
+
from transformers import pipeline
|
71 |
+
|
72 |
+
|
73 |
+
model_name_or_path = "m3hrdadfi/icelandic-ner-roberta"
|
74 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name_or_path)
|
75 |
+
model = AutoModelForTokenClassification.from_pretrained(model_name_or_path) # Pytorch
|
76 |
+
# model = TFAutoModelForTokenClassification.from_pretrained(model_name_or_path) # Tensorflow
|
77 |
+
|
78 |
+
nlp = pipeline("ner", model=model, tokenizer=tokenizer)
|
79 |
+
example = "Kristin manneskja getur ekki lagt frásagnir af Jesú Kristi á hilluna vegna þess að hún sé búin að lesa þær ."
|
80 |
+
|
81 |
+
ner_results = nlp(example)
|
82 |
+
print(ner_results)
|
83 |
+
```
|
84 |
+
|
85 |
+
|
86 |
+
## Questions?
|
87 |
+
Post a Github issue on the [IcelandicNER Issues](https://github.com/m3hrdadfi/icelandic-ner/issues) repo.
|
config.json
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"_name_or_path": "mideind/IceBERT",
|
3 |
+
"architectures": [
|
4 |
+
"RobertaForTokenClassification"
|
5 |
+
],
|
6 |
+
"attention_probs_dropout_prob": 0.1,
|
7 |
+
"bos_token_id": 0,
|
8 |
+
"eos_token_id": 2,
|
9 |
+
"finetuning_task": "ner",
|
10 |
+
"gradient_checkpointing": false,
|
11 |
+
"hidden_act": "gelu",
|
12 |
+
"hidden_dropout_prob": 0.1,
|
13 |
+
"hidden_size": 768,
|
14 |
+
"id2label": {
|
15 |
+
"0": "O",
|
16 |
+
"1": "B-Date",
|
17 |
+
"2": "B-Location",
|
18 |
+
"3": "B-Miscellaneous",
|
19 |
+
"4": "B-Money",
|
20 |
+
"5": "B-Organization",
|
21 |
+
"6": "B-Percent",
|
22 |
+
"7": "B-Person",
|
23 |
+
"8": "B-Time",
|
24 |
+
"9": "I-Date",
|
25 |
+
"10": "I-Location",
|
26 |
+
"11": "I-Miscellaneous",
|
27 |
+
"12": "I-Money",
|
28 |
+
"13": "I-Organization",
|
29 |
+
"14": "I-Percent",
|
30 |
+
"15": "I-Person",
|
31 |
+
"16": "I-Time"
|
32 |
+
},
|
33 |
+
"initializer_range": 0.02,
|
34 |
+
"intermediate_size": 3072,
|
35 |
+
"label2id": {
|
36 |
+
"B-Date": 1,
|
37 |
+
"B-Location": 2,
|
38 |
+
"B-Miscellaneous": 3,
|
39 |
+
"B-Money": 4,
|
40 |
+
"B-Organization": 5,
|
41 |
+
"B-Percent": 6,
|
42 |
+
"B-Person": 7,
|
43 |
+
"B-Time": 8,
|
44 |
+
"I-Date": 9,
|
45 |
+
"I-Location": 10,
|
46 |
+
"I-Miscellaneous": 11,
|
47 |
+
"I-Money": 12,
|
48 |
+
"I-Organization": 13,
|
49 |
+
"I-Percent": 14,
|
50 |
+
"I-Person": 15,
|
51 |
+
"I-Time": 16,
|
52 |
+
"O": 0
|
53 |
+
},
|
54 |
+
"layer_norm_eps": 1e-05,
|
55 |
+
"max_position_embeddings": 514,
|
56 |
+
"model_type": "roberta",
|
57 |
+
"num_attention_heads": 12,
|
58 |
+
"num_hidden_layers": 12,
|
59 |
+
"pad_token_id": 1,
|
60 |
+
"position_embedding_type": "absolute",
|
61 |
+
"transformers_version": "4.7.0.dev0",
|
62 |
+
"type_vocab_size": 1,
|
63 |
+
"use_cache": true,
|
64 |
+
"vocab_size": 50000
|
65 |
+
}
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:b9eb58d426b82ac19564c792f4cc1832e90354935a7976841a1a68c6b7983770
|
3 |
+
size 495548151
|
special_tokens_map.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"bos_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "eos_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "unk_token": {"content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "sep_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "pad_token": {"content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "cls_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true}, "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true}}
|
tf_model.h5
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:453d2d3a42efb71ed0cb0b0fd497994e3bf9df1988ca6b69c0a96b835e566b63
|
3 |
+
size 495746192
|
tokenizer.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|
tokenizer_config.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"unk_token": {"content": "<unk>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "bos_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "eos_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "add_prefix_space": true, "errors": "replace", "sep_token": {"content": "</s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "cls_token": {"content": "<s>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "pad_token": {"content": "<pad>", "single_word": false, "lstrip": false, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "mask_token": {"content": "<mask>", "single_word": false, "lstrip": true, "rstrip": false, "normalized": true, "__type": "AddedToken"}, "special_tokens_map_file": "/content/cache/b21a20c1d1a8c4ce0f3f9b2a311ea6fa001eaaaee064c36040b1c5885cdc73f0.cb2244924ab24d706b02fd7fcedaea4531566537687a539ebb94db511fd122a0", "name_or_path": "mideind/IceBERT"}
|
vocab.json
ADDED
The diff for this file is too large to render.
See raw diff
|
|