alanakbik commited on
Commit
6ad8188
1 Parent(s): 119262b

initial model commit

Browse files
Files changed (4) hide show
  1. README.md +136 -0
  2. loss.tsv +151 -0
  3. pytorch_model.bin +3 -0
  4. training.log +0 -0
README.md ADDED
@@ -0,0 +1,136 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - flair
4
+ - token-classification
5
+ - sequence-tagger-model
6
+ language: en
7
+ datasets:
8
+ - ontonotes
9
+ inference: false
10
+ ---
11
+
12
+ ## English Verb Disambiguation in Flair (fast model)
13
+
14
+ This is the fast verb disambiguation model for English that ships with [Flair](https://github.com/flairNLP/flair/).
15
+
16
+ F1-Score: **88,27** (Ontonotes) - predicts [Proposition Bank verb frames](http://verbs.colorado.edu/propbank/framesets-english-aliases/).
17
+
18
+ Based on [Flair embeddings](https://www.aclweb.org/anthology/C18-1139/) and LSTM-CRF.
19
+
20
+ ---
21
+
22
+ ### Demo: How to use in Flair
23
+
24
+ Requires: **[Flair](https://github.com/flairNLP/flair/)** (`pip install flair`)
25
+
26
+ ```python
27
+ from flair.data import Sentence
28
+ from flair.models import SequenceTagger
29
+
30
+ # load tagger
31
+ tagger = SequenceTagger.load("flair/frame-english-fast")
32
+
33
+ # make example sentence
34
+ sentence = Sentence("George returned to Berlin to return his hat.")
35
+
36
+ # predict NER tags
37
+ tagger.predict(sentence)
38
+
39
+ # print sentence
40
+ print(sentence)
41
+
42
+ # print predicted NER spans
43
+ print('The following frame tags are found:')
44
+ # iterate over entities and print
45
+ for entity in sentence.get_spans('frame'):
46
+ print(entity)
47
+
48
+ ```
49
+
50
+ This yields the following output:
51
+ ```
52
+ Span [2]: "returned" [− Labels: return.01 (0.9867)]
53
+ Span [6]: "return" [− Labels: return.02 (0.4741)]
54
+ ```
55
+
56
+ So, the word "*returned*" is labeled as **return.01** (as in *go back somewhere*) while "*return*" is labeled as **return.02** (as in *give back something*) in the sentence "*George returned to Berlin to return his hat*".
57
+
58
+
59
+ ---
60
+
61
+ ### Training: Script to train this model
62
+
63
+ The following Flair script was used to train this model:
64
+
65
+ ```python
66
+ from flair.data import Corpus
67
+ from flair.datasets import ColumnCorpus
68
+ from flair.embeddings import WordEmbeddings, StackedEmbeddings, FlairEmbeddings
69
+
70
+ # 1. load the corpus (Ontonotes does not ship with Flair, you need to download and reformat into a column format yourself)
71
+ corpus = ColumnCorpus(
72
+ "resources/tasks/srl", column_format={1: "text", 11: "frame"}
73
+ )
74
+
75
+ # 2. what tag do we want to predict?
76
+ tag_type = 'frame'
77
+
78
+ # 3. make the tag dictionary from the corpus
79
+ tag_dictionary = corpus.make_tag_dictionary(tag_type=tag_type)
80
+
81
+ # 4. initialize each embedding we use
82
+ embedding_types = [
83
+
84
+ BytePairEmbeddings("en"),
85
+
86
+ FlairEmbeddings("news-forward-fast"),
87
+
88
+ FlairEmbeddings("news-backward-fast"),
89
+ ]
90
+
91
+ # embedding stack consists of Flair and GloVe embeddings
92
+ embeddings = StackedEmbeddings(embeddings=embedding_types)
93
+
94
+ # 5. initialize sequence tagger
95
+ from flair.models import SequenceTagger
96
+
97
+ tagger = SequenceTagger(hidden_size=256,
98
+ embeddings=embeddings,
99
+ tag_dictionary=tag_dictionary,
100
+ tag_type=tag_type)
101
+
102
+ # 6. initialize trainer
103
+ from flair.trainers import ModelTrainer
104
+
105
+ trainer = ModelTrainer(tagger, corpus)
106
+
107
+ # 7. run training
108
+ trainer.train('resources/taggers/frame-english-fast',
109
+ train_with_dev=True,
110
+ max_epochs=150)
111
+ ```
112
+
113
+
114
+
115
+ ---
116
+
117
+ ### Cite
118
+
119
+ Please cite the following paper when using this model.
120
+
121
+ ```
122
+ @inproceedings{akbik2019flair,
123
+ title={FLAIR: An easy-to-use framework for state-of-the-art NLP},
124
+ author={Akbik, Alan and Bergmann, Tanja and Blythe, Duncan and Rasul, Kashif and Schweter, Stefan and Vollgraf, Roland},
125
+ booktitle={{NAACL} 2019, 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations)},
126
+ pages={54--59},
127
+ year={2019}
128
+ }
129
+
130
+ ```
131
+
132
+ ---
133
+
134
+ ### Issues?
135
+
136
+ The Flair issue tracker is available [here](https://github.com/flairNLP/flair/issues/).
loss.tsv ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ EPOCH TIMESTAMP BAD_EPOCHS LEARNING_RATE TRAIN_LOSS
2
+ 0 16:57:14 0 0.1000 1.0331835177934394
3
+ 1 16:59:12 0 0.1000 0.7534246457297847
4
+ 2 17:01:13 0 0.1000 0.6512561359383026
5
+ 3 17:03:14 0 0.1000 0.5802008084643562
6
+ 4 17:05:13 0 0.1000 0.5318850766825226
7
+ 5 17:07:13 0 0.1000 0.49175757394646696
8
+ 6 17:09:14 0 0.1000 0.4636917464969293
9
+ 7 17:11:13 0 0.1000 0.4397412589248621
10
+ 8 17:13:15 0 0.1000 0.4138992549001046
11
+ 9 17:15:16 0 0.1000 0.39738916210970787
12
+ 10 17:17:15 0 0.1000 0.38295740701679915
13
+ 11 17:19:14 0 0.1000 0.36864354551963086
14
+ 12 17:21:15 0 0.1000 0.35686040904162064
15
+ 13 17:23:16 0 0.1000 0.3453934264239275
16
+ 14 17:25:19 0 0.1000 0.3375645263127561
17
+ 15 17:27:19 0 0.1000 0.3270221893405015
18
+ 16 17:29:20 0 0.1000 0.32138253754321133
19
+ 17 17:31:19 0 0.1000 0.31224814824057073
20
+ 18 17:33:18 0 0.1000 0.3062455494336362
21
+ 19 17:35:15 0 0.1000 0.2996281926333904
22
+ 20 17:37:14 0 0.1000 0.2947730497003726
23
+ 21 17:39:17 0 0.1000 0.28902314991321204
24
+ 22 17:41:18 0 0.1000 0.2831355856865082
25
+ 23 17:43:16 0 0.1000 0.2788279781420276
26
+ 24 17:45:18 0 0.1000 0.2748661895377456
27
+ 25 17:47:19 0 0.1000 0.2696077431035492
28
+ 26 17:49:20 0 0.1000 0.2637459493498757
29
+ 27 17:51:21 1 0.1000 0.26441867144040343
30
+ 28 17:53:21 0 0.1000 0.2582800485756037
31
+ 29 17:55:25 0 0.1000 0.25666302521273776
32
+ 30 17:57:22 0 0.1000 0.25244936207836527
33
+ 31 17:59:25 0 0.1000 0.24905876575494712
34
+ 32 18:01:17 0 0.1000 0.24767023563947319
35
+ 33 18:03:16 0 0.1000 0.24386378206453233
36
+ 34 18:05:14 0 0.1000 0.2412380929825441
37
+ 35 18:07:15 0 0.1000 0.2386068048623373
38
+ 36 18:09:17 0 0.1000 0.2357153587240093
39
+ 37 18:11:19 0 0.1000 0.23516571177345402
40
+ 38 18:13:21 0 0.1000 0.23385607737415243
41
+ 39 18:15:22 0 0.1000 0.23066844930907465
42
+ 40 18:17:22 0 0.1000 0.22724409378080998
43
+ 41 18:19:22 0 0.1000 0.22416442974277262
44
+ 42 18:21:22 0 0.1000 0.2223501536221999
45
+ 43 18:23:21 0 0.1000 0.22130560749825443
46
+ 44 18:25:21 0 0.1000 0.21995896535380832
47
+ 45 18:27:18 0 0.1000 0.21820789429095555
48
+ 46 18:29:18 0 0.1000 0.21622849897955948
49
+ 47 18:31:21 0 0.1000 0.21285639654071825
50
+ 48 18:33:22 1 0.1000 0.21415038008172557
51
+ 49 18:35:25 0 0.1000 0.21017705502375117
52
+ 50 18:37:24 1 0.1000 0.21117525756640254
53
+ 51 18:39:24 0 0.1000 0.20859856243684607
54
+ 52 18:41:25 0 0.1000 0.20696946369308344
55
+ 53 18:43:23 0 0.1000 0.2034898224922846
56
+ 54 18:45:25 1 0.1000 0.2036386628280271
57
+ 55 18:47:26 2 0.1000 0.20351923452514523
58
+ 56 18:49:25 0 0.1000 0.20184031808432543
59
+ 57 18:51:24 0 0.1000 0.19936612990104927
60
+ 58 18:53:25 1 0.1000 0.20003940500178427
61
+ 59 18:55:24 0 0.1000 0.19871857148718158
62
+ 60 18:57:25 0 0.1000 0.19630298754235484
63
+ 61 18:59:29 0 0.1000 0.19466442022683486
64
+ 62 19:01:29 1 0.1000 0.19517241837983987
65
+ 63 19:03:28 0 0.1000 0.19327369366052016
66
+ 64 19:05:28 0 0.1000 0.19094432177127532
67
+ 65 19:07:31 1 0.1000 0.19181827962679682
68
+ 66 19:09:33 0 0.1000 0.1905410680399751
69
+ 67 19:11:33 0 0.1000 0.18911360864650528
70
+ 68 19:13:33 0 0.1000 0.18823809698926952
71
+ 69 19:15:34 0 0.1000 0.18625521179640067
72
+ 70 19:17:36 0 0.1000 0.18619693292621173
73
+ 71 19:19:38 0 0.1000 0.18402512382083344
74
+ 72 19:21:38 1 0.1000 0.18475884994527078
75
+ 73 19:23:40 0 0.1000 0.1827168076780607
76
+ 74 19:25:42 0 0.1000 0.1817589691632761
77
+ 75 19:27:43 1 0.1000 0.18176379647035643
78
+ 76 19:29:46 0 0.1000 0.17918735781930528
79
+ 77 19:31:41 1 0.1000 0.1793345402195206
80
+ 78 19:33:42 0 0.1000 0.1786906721850611
81
+ 79 19:35:43 1 0.1000 0.1789407252745246
82
+ 80 19:37:45 0 0.1000 0.17831588239602322
83
+ 81 19:39:42 0 0.1000 0.17584702046271766
84
+ 82 19:41:43 1 0.1000 0.1762350451833797
85
+ 83 19:43:43 2 0.1000 0.17732474481300364
86
+ 84 19:45:41 0 0.1000 0.17411043922293862
87
+ 85 19:47:44 1 0.1000 0.17464976874584298
88
+ 86 19:49:43 0 0.1000 0.17278475104216134
89
+ 87 19:51:38 0 0.1000 0.17179934699580354
90
+ 88 19:53:41 1 0.1000 0.17227861699630628
91
+ 89 19:55:41 0 0.1000 0.17142761870656373
92
+ 90 19:57:39 1 0.1000 0.172426446091454
93
+ 91 19:59:39 0 0.1000 0.16916301577580425
94
+ 92 20:01:33 1 0.1000 0.16914823445649643
95
+ 93 20:03:33 2 0.1000 0.16946013499965082
96
+ 94 20:05:32 0 0.1000 0.16705357644777252
97
+ 95 20:07:32 1 0.1000 0.16741124850539665
98
+ 96 20:09:34 0 0.1000 0.16701223869931023
99
+ 97 20:11:34 0 0.1000 0.16492121913101312
100
+ 98 20:13:28 1 0.1000 0.16647207704355133
101
+ 99 20:15:29 2 0.1000 0.1652054013494613
102
+ 100 20:17:31 0 0.1000 0.16403524821659304
103
+ 101 20:19:31 0 0.1000 0.16295314669187339
104
+ 102 20:21:31 0 0.1000 0.1626499580690321
105
+ 103 20:23:33 0 0.1000 0.16245061348772274
106
+ 104 20:25:33 0 0.1000 0.16223129581449167
107
+ 105 20:27:35 0 0.1000 0.16204805483795562
108
+ 106 20:29:31 0 0.1000 0.16133132974494177
109
+ 107 20:31:34 0 0.1000 0.15999848231813818
110
+ 108 20:33:26 1 0.1000 0.16073288552041323
111
+ 109 20:35:25 0 0.1000 0.1589496636812417
112
+ 110 20:37:26 0 0.1000 0.15854845318451244
113
+ 111 20:39:28 1 0.1000 0.15915251742275255
114
+ 112 20:41:20 0 0.1000 0.15699748720903442
115
+ 113 20:43:21 0 0.1000 0.15639148999638153
116
+ 114 20:45:22 0 0.1000 0.15555391123694068
117
+ 115 20:47:20 1 0.1000 0.15687556487912277
118
+ 116 20:49:19 0 0.1000 0.1554397045230528
119
+ 117 20:51:21 1 0.1000 0.15632058387516803
120
+ 118 20:53:23 2 0.1000 0.15620806326421927
121
+ 119 20:55:23 0 0.1000 0.15403140755756847
122
+ 120 20:57:23 1 0.1000 0.1557127451404648
123
+ 121 20:59:26 0 0.1000 0.15287466880426093
124
+ 122 21:01:27 1 0.1000 0.15640640995693655
125
+ 123 21:03:26 0 0.1000 0.15265837827381099
126
+ 124 21:05:28 0 0.1000 0.1526175081673658
127
+ 125 21:07:30 0 0.1000 0.1525260404300577
128
+ 126 21:09:31 0 0.1000 0.1517760738280584
129
+ 127 21:11:32 0 0.1000 0.151606065611232
130
+ 128 21:13:35 0 0.1000 0.14943727196387524
131
+ 129 21:15:36 1 0.1000 0.15108451109168664
132
+ 130 21:17:41 2 0.1000 0.1498852201874526
133
+ 131 21:19:41 3 0.1000 0.150005940512385
134
+ 132 21:21:43 4 0.1000 0.14968857790361034
135
+ 133 21:23:41 0 0.0500 0.1478070142921412
136
+ 134 21:25:42 0 0.0500 0.147253034192155
137
+ 135 21:27:42 0 0.0500 0.14682998076081277
138
+ 136 21:29:42 1 0.0500 0.1477076671328747
139
+ 137 21:31:40 2 0.0500 0.14722670022468523
140
+ 138 21:33:43 0 0.0500 0.14526898582870104
141
+ 139 21:35:43 1 0.0500 0.1462407725768269
142
+ 140 21:37:47 2 0.0500 0.14537999585973765
143
+ 141 21:39:47 3 0.0500 0.14673884121173958
144
+ 142 21:41:51 4 0.0500 0.1463078955729615
145
+ 143 21:43:51 0 0.0250 0.14519840987223498
146
+ 144 21:45:52 1 0.0250 0.14544011011579128
147
+ 145 21:47:55 0 0.0250 0.1447246475363115
148
+ 146 21:49:55 0 0.0250 0.144590772277904
149
+ 147 21:51:55 0 0.0250 0.14405259212092408
150
+ 148 21:53:57 1 0.0250 0.14514965839402855
151
+ 149 21:55:58 2 0.0250 0.1447441032781916
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0da4b41236ad48520a42c15b4fe34c986a04c4b06903b954620b8f20988ea5e2
3
+ size 115076956
training.log ADDED
The diff for this file is too large to render. See raw diff