alanakbik commited on
Commit
55dfe52
1 Parent(s): f4b0284

initial model commit

Browse files
Files changed (4) hide show
  1. README.md +122 -0
  2. loss.tsv +151 -0
  3. test.tsv +0 -0
  4. training.log +0 -0
README.md ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - flair
4
+ - token-classification
5
+ - sequence-tagger-model
6
+ language: nl
7
+ datasets:
8
+ - conll2003
9
+ inference: false
10
+ ---
11
+
12
+ ## English NER in Flair (default model)
13
+
14
+ This is the standard 4-class NER model for Dutch that ships with [Flair](https://github.com/flairNLP/flair/).
15
+
16
+ F1-Score: **92,58** (CoNLL-03)
17
+
18
+ Predicts 4 tags:
19
+
20
+ | **tag** | **meaning** |
21
+ |---------------------------------|-----------|
22
+ | PER | person name |
23
+ | LOC | location name |
24
+ | ORG | organization name |
25
+ | MISC | other name |
26
+
27
+ Based on [Flair embeddings](https://www.aclweb.org/anthology/C18-1139/) and LSTM-CRF.
28
+
29
+ ---
30
+
31
+ ### Demo: How to use in Flair
32
+
33
+ Requires: **[Flair](https://github.com/flairNLP/flair/)** (`pip install flair`)
34
+
35
+ ```python
36
+ from flair.data import Sentence
37
+ from flair.models import SequenceTagger
38
+
39
+ # load tagger
40
+ tagger = SequenceTagger.load("flair/ner-dutch")
41
+
42
+ # make example sentence
43
+ sentence = Sentence("George Washington ging naar Washington")
44
+
45
+ # predict NER tags
46
+ tagger.predict(sentence)
47
+
48
+ # print sentence
49
+ print(sentence)
50
+
51
+ # print predicted NER spans
52
+ print('The following NER tags are found:')
53
+ # iterate over entities and print
54
+ for entity in sentence.get_spans('ner'):
55
+ print(entity)
56
+
57
+ ```
58
+
59
+ This yields the following output:
60
+ ```
61
+ Span [1,2]: "George Washington" [− Labels: PER (0.9968)]
62
+ Span [5]: "Washington" [− Labels: LOC (0.9994)]
63
+ ```
64
+
65
+ So, the entities "*George Washington*" (labeled as a **person**) and "*Washington*" (labeled as a **location**) are found in the sentence "*George Washington ging naar Washington*".
66
+
67
+
68
+ ---
69
+
70
+ ### Training: Script to train this model
71
+
72
+ The following Flair script was used to train this model:
73
+
74
+ ```python
75
+ from flair.data import Corpus
76
+ from flair.datasets import CONLL_03_DUTCH
77
+ from flair.embeddings import WordEmbeddings, StackedEmbeddings, FlairEmbeddings
78
+
79
+
80
+ # 1. get the corpus
81
+ corpus: Corpus = CONLL_03_DUTCH()
82
+
83
+ # 2. what tag do we want to predict?
84
+ tag_type = 'ner'
85
+
86
+ # 3. make the tag dictionary from the corpus
87
+ tag_dictionary = corpus.make_tag_dictionary(tag_type=tag_type)
88
+
89
+ # 4. initialize embeddings
90
+ embeddings = TransformerWordEmbeddings('wietsedv/bert-base-dutch-cased')
91
+
92
+ # 5. initialize sequence tagger
93
+ tagger: SequenceTagger = SequenceTagger(hidden_size=256,
94
+ embeddings=embeddings,
95
+ tag_dictionary=tag_dictionary,
96
+ tag_type=tag_type)
97
+
98
+ # 6. initialize trainer
99
+ trainer: ModelTrainer = ModelTrainer(tagger, corpus)
100
+
101
+ # 7. run training
102
+ trainer.train('resources/taggers/ner-dutch',
103
+ train_with_dev=True,
104
+ max_epochs=150)
105
+ ```
106
+
107
+
108
+ ---
109
+
110
+ ### Cite
111
+
112
+ Please cite the following paper when using this model.
113
+
114
+ ```
115
+ @inproceedings{akbik2018coling,
116
+ title={Contextual String Embeddings for Sequence Labeling},
117
+ author={Akbik, Alan and Blythe, Duncan and Vollgraf, Roland},
118
+ booktitle = {{COLING} 2018, 27th International Conference on Computational Linguistics},
119
+ pages = {1638--1649},
120
+ year = {2018}
121
+ }
122
+ ```
loss.tsv ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ EPOCH TIMESTAMP BAD_EPOCHS LEARNING_RATE TRAIN_LOSS
2
+ 1 14:01:30 0 0.1000 2.779733479175812
3
+ 2 14:03:00 0 0.1000 1.3395338043188438
4
+ 3 14:04:30 0 0.1000 1.0816994036874201
5
+ 4 14:06:01 0 0.1000 0.9621152551255674
6
+ 5 14:07:31 0 0.1000 0.8333948618835874
7
+ 6 14:09:01 0 0.1000 0.7716772701495733
8
+ 7 14:10:31 0 0.1000 0.7374578891911059
9
+ 8 14:12:01 0 0.1000 0.6992316849211342
10
+ 9 14:13:31 0 0.1000 0.6452770539328583
11
+ 10 14:15:01 1 0.1000 0.6467076227960423
12
+ 11 14:16:31 0 0.1000 0.620160369358511
13
+ 12 14:18:01 0 0.1000 0.5951391830658301
14
+ 13 14:19:31 0 0.1000 0.5727337152020544
15
+ 14 14:21:01 0 0.1000 0.5662796683163724
16
+ 15 14:22:32 0 0.1000 0.5356569104979181
17
+ 16 14:24:01 0 0.1000 0.5295078084764318
18
+ 17 14:25:31 0 0.1000 0.5199492649644868
19
+ 18 14:27:01 0 0.1000 0.5174320767832618
20
+ 19 14:28:31 0 0.1000 0.4972612695816236
21
+ 20 14:30:01 0 0.1000 0.4858957131194253
22
+ 21 14:31:30 1 0.1000 0.4954718519734521
23
+ 22 14:33:00 0 0.1000 0.475096299760362
24
+ 23 14:34:29 0 0.1000 0.45335076690739035
25
+ 24 14:35:58 0 0.1000 0.45071878243460617
26
+ 25 14:37:28 0 0.1000 0.4470571254053686
27
+ 26 14:38:57 0 0.1000 0.4351186317511094
28
+ 27 14:40:26 1 0.1000 0.435719607044489
29
+ 28 14:41:55 0 0.1000 0.43325941297743054
30
+ 29 14:43:24 0 0.1000 0.4213554557444703
31
+ 30 14:44:54 0 0.1000 0.41895739234920243
32
+ 31 14:46:23 1 0.1000 0.424293908655134
33
+ 32 14:47:53 0 0.1000 0.41112876903806994
34
+ 33 14:49:22 0 0.1000 0.4081363928368968
35
+ 34 14:50:52 0 0.1000 0.3930869156988258
36
+ 35 14:52:21 1 0.1000 0.4032204799927198
37
+ 36 14:53:50 0 0.1000 0.3917345738818503
38
+ 37 14:55:19 1 0.1000 0.4003689407920226
39
+ 38 14:56:48 0 0.1000 0.385329091319671
40
+ 39 14:58:17 0 0.1000 0.38347142062380785
41
+ 40 14:59:46 0 0.1000 0.3804049695515607
42
+ 41 15:01:14 0 0.1000 0.3764326793770505
43
+ 42 15:02:43 0 0.1000 0.3761323136142176
44
+ 43 15:04:12 1 0.1000 0.3851716780764425
45
+ 44 15:05:41 2 0.1000 0.3771476393326735
46
+ 45 15:07:11 0 0.1000 0.3616421103222757
47
+ 46 15:08:40 1 0.1000 0.3686442003800319
48
+ 47 15:10:09 0 0.1000 0.35834919491894224
49
+ 48 15:11:38 1 0.1000 0.3613178371618956
50
+ 49 15:13:07 0 0.1000 0.3519833675561807
51
+ 50 15:14:36 1 0.1000 0.35567070319611804
52
+ 51 15:16:05 0 0.1000 0.34542505874847756
53
+ 52 15:17:34 1 0.1000 0.34995765023761327
54
+ 53 15:19:03 0 0.1000 0.3352116090110224
55
+ 54 15:20:32 0 0.1000 0.3264291577868991
56
+ 55 15:22:01 1 0.1000 0.3271228834222525
57
+ 56 15:23:30 2 0.1000 0.33473273961462524
58
+ 57 15:25:00 3 0.1000 0.3365086276052345
59
+ 58 15:26:26 4 0.1000 0.33411403429559156
60
+ 59 15:27:48 0 0.0500 0.30620485559487953
61
+ 60 15:29:11 0 0.0500 0.28616658293793346
62
+ 61 15:30:37 0 0.0500 0.2821873968674077
63
+ 62 15:32:02 0 0.0500 0.26961317198653506
64
+ 63 15:33:25 0 0.0500 0.2660407587249055
65
+ 64 15:34:48 0 0.0500 0.2553254587782754
66
+ 65 15:36:12 1 0.0500 0.25559193193912505
67
+ 66 15:37:36 0 0.0500 0.24891968863642114
68
+ 67 15:38:59 1 0.0500 0.2530737343761656
69
+ 68 15:40:22 0 0.0500 0.2413989709992694
70
+ 69 15:41:45 1 0.0500 0.24797574456176188
71
+ 70 15:43:08 2 0.0500 0.242591819476782
72
+ 71 15:44:30 0 0.0500 0.23441884385851713
73
+ 72 15:45:54 1 0.0500 0.23821192036072414
74
+ 73 15:47:16 0 0.0500 0.23189536440066802
75
+ 74 15:48:39 0 0.0500 0.23109626505109998
76
+ 75 15:50:02 0 0.0500 0.21557108603545233
77
+ 76 15:51:24 1 0.0500 0.21703473255675063
78
+ 77 15:52:47 2 0.0500 0.21980291849527603
79
+ 78 15:54:09 3 0.0500 0.21841833248225032
80
+ 79 15:55:32 0 0.0500 0.21489991823322752
81
+ 80 15:56:55 0 0.0500 0.20688325222740825
82
+ 81 15:58:17 1 0.0500 0.22208200507184378
83
+ 82 15:59:40 2 0.0500 0.21044851431989262
84
+ 83 16:01:03 0 0.0500 0.2044361765568073
85
+ 84 16:02:25 0 0.0500 0.20330230971941582
86
+ 85 16:03:48 1 0.0500 0.2057137251027629
87
+ 86 16:05:11 0 0.0500 0.1991372063373908
88
+ 87 16:06:34 1 0.0500 0.2024117647136888
89
+ 88 16:07:57 2 0.0500 0.20274029105392277
90
+ 89 16:09:20 0 0.0500 0.19314180322819285
91
+ 90 16:10:43 0 0.0500 0.18950988753483847
92
+ 91 16:12:06 1 0.0500 0.19186331494432737
93
+ 92 16:13:29 2 0.0500 0.19439757827462423
94
+ 93 16:14:52 0 0.0500 0.18818266501284053
95
+ 94 16:16:15 0 0.0500 0.17917947142552107
96
+ 95 16:17:38 1 0.0500 0.18487144104945355
97
+ 96 16:19:01 2 0.0500 0.18518399219227652
98
+ 97 16:20:25 3 0.0500 0.18472332790111884
99
+ 98 16:21:48 0 0.0500 0.1754296123706855
100
+ 99 16:23:11 1 0.0500 0.18395276073621125
101
+ 100 16:24:33 2 0.0500 0.18039520557364846
102
+ 101 16:25:57 3 0.0500 0.18199163737077997
103
+ 102 16:27:20 0 0.0500 0.17518249248337542
104
+ 103 16:28:42 0 0.0500 0.17339555085596875
105
+ 104 16:30:05 1 0.0500 0.17634159061643812
106
+ 105 16:31:29 2 0.0500 0.17359274017473317
107
+ 106 16:32:52 0 0.0500 0.17105355417817578
108
+ 107 16:34:15 0 0.0500 0.1707773297260969
109
+ 108 16:35:38 0 0.0500 0.1698240860277771
110
+ 109 16:37:01 0 0.0500 0.16659483982202333
111
+ 110 16:38:24 0 0.0500 0.16050158162784373
112
+ 111 16:39:47 1 0.0500 0.1668573046596641
113
+ 112 16:41:09 0 0.0500 0.1591071498572317
114
+ 113 16:42:32 1 0.0500 0.16081542165106177
115
+ 114 16:43:55 2 0.0500 0.1627739645445194
116
+ 115 16:45:18 3 0.0500 0.16070217188352193
117
+ 116 16:46:41 4 0.0500 0.1620385132284246
118
+ 117 16:48:04 0 0.0250 0.14860385387626468
119
+ 118 16:49:27 0 0.0250 0.13816803481079573
120
+ 119 16:50:49 0 0.0250 0.13735185179135037
121
+ 120 16:52:13 0 0.0250 0.13719079037252654
122
+ 121 16:53:35 0 0.0250 0.13567532561401016
123
+ 122 16:54:57 1 0.0250 0.1358587311501177
124
+ 123 16:56:20 0 0.0250 0.1323100252618265
125
+ 124 16:57:43 1 0.0250 0.1347226249356555
126
+ 125 16:59:05 0 0.0250 0.12610901894732418
127
+ 126 17:00:28 0 0.0250 0.12457475662231446
128
+ 127 17:01:51 0 0.0250 0.12143644379754352
129
+ 128 17:03:14 1 0.0250 0.12776582111150792
130
+ 129 17:04:37 2 0.0250 0.12849602556636192
131
+ 130 17:06:00 3 0.0250 0.1244494532290687
132
+ 131 17:07:22 4 0.0250 0.12194784156277648
133
+ 132 17:08:45 0 0.0125 0.12072199874708796
134
+ 133 17:10:07 0 0.0125 0.11447634765735039
135
+ 134 17:11:29 1 0.0125 0.11593401964403625
136
+ 135 17:12:52 2 0.0125 0.11731710933809543
137
+ 136 17:14:14 0 0.0125 0.11113526996137559
138
+ 137 17:15:37 1 0.0125 0.11634638169382372
139
+ 138 17:17:00 2 0.0125 0.11969016508286835
140
+ 139 17:18:23 0 0.0125 0.11103729783820036
141
+ 140 17:19:45 1 0.0125 0.11450310367294866
142
+ 141 17:21:08 2 0.0125 0.11406106056056471
143
+ 142 17:22:31 3 0.0125 0.1144172125010409
144
+ 143 17:23:54 0 0.0125 0.10564635207510402
145
+ 144 17:25:16 0 0.0125 0.1036626111684192
146
+ 145 17:26:39 1 0.0125 0.10585466057826311
147
+ 146 17:28:02 2 0.0125 0.10889074587159686
148
+ 147 17:29:24 3 0.0125 0.11062939536089125
149
+ 148 17:30:47 4 0.0125 0.10591043005896429
150
+ 149 17:32:10 1 0.0063 0.1120014336748192
151
+ 150 17:33:33 0 0.0063 0.1027476362310923
test.tsv ADDED
The diff for this file is too large to render. See raw diff
 
training.log ADDED
The diff for this file is too large to render. See raw diff