initial model commit
Browse files- README.md +140 -0
- loss.tsv +151 -0
- pytorch_model.bin +3 -0
- training.log +0 -0
README.md
ADDED
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 (default model)
|
13 |
+
|
14 |
+
This is the standard verb disambiguation model for English that ships with [Flair](https://github.com/flairNLP/flair/).
|
15 |
+
|
16 |
+
F1-Score: **89,34** (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/pos-english")
|
32 |
+
|
33 |
+
# make example sentence
|
34 |
+
sentence = Sentence("I love Berlin.")
|
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 NER tags are found:')
|
44 |
+
# iterate over entities and print
|
45 |
+
for entity in sentence.get_spans('pos'):
|
46 |
+
print(entity)
|
47 |
+
|
48 |
+
```
|
49 |
+
|
50 |
+
This yields the following output:
|
51 |
+
```
|
52 |
+
Span [1]: "I" [− Labels: PRP (1.0)]
|
53 |
+
Span [2]: "love" [− Labels: VBP (1.0)]
|
54 |
+
Span [3]: "Berlin" [− Labels: NNP (0.9999)]
|
55 |
+
Span [4]: "." [− Labels: . (1.0)]
|
56 |
+
|
57 |
+
```
|
58 |
+
|
59 |
+
So, the word "*I*" is labeled as a **pronoun** (PRP), "*love*" is labeled as a **verb** (VBP) and "*Berlin*" is labeled as a **proper noun** (NNP) in the sentence "*TheI love Berlin*".
|
60 |
+
|
61 |
+
|
62 |
+
---
|
63 |
+
|
64 |
+
### Training: Script to train this model
|
65 |
+
|
66 |
+
The following Flair script was used to train this model:
|
67 |
+
|
68 |
+
```python
|
69 |
+
from flair.data import Corpus
|
70 |
+
from flair.datasets import ColumnCorpus
|
71 |
+
from flair.embeddings import WordEmbeddings, StackedEmbeddings, FlairEmbeddings
|
72 |
+
|
73 |
+
# 1. load the corpus (Ontonotes does not ship with Flair, you need to download and reformat into a column format yourself)
|
74 |
+
corpus = ColumnCorpus(
|
75 |
+
"resources/tasks/srl", column_format={1: "text", 11: "frame"}
|
76 |
+
)
|
77 |
+
|
78 |
+
|
79 |
+
# 2. what tag do we want to predict?
|
80 |
+
tag_type = 'frame'
|
81 |
+
|
82 |
+
# 3. make the tag dictionary from the corpus
|
83 |
+
tag_dictionary = corpus.make_tag_dictionary(tag_type=tag_type)
|
84 |
+
|
85 |
+
# 4. initialize each embedding we use
|
86 |
+
embedding_types = [
|
87 |
+
|
88 |
+
BytePairEmbeddings("en"),
|
89 |
+
|
90 |
+
FlairEmbeddings("news-forward-fast"),
|
91 |
+
|
92 |
+
FlairEmbeddings("news-backward-fast"),
|
93 |
+
]
|
94 |
+
|
95 |
+
# embedding stack consists of Flair and GloVe embeddings
|
96 |
+
embeddings = StackedEmbeddings(embeddings=embedding_types)
|
97 |
+
|
98 |
+
# 5. initialize sequence tagger
|
99 |
+
from flair.models import SequenceTagger
|
100 |
+
|
101 |
+
tagger = SequenceTagger(hidden_size=256,
|
102 |
+
embeddings=embeddings,
|
103 |
+
tag_dictionary=tag_dictionary,
|
104 |
+
tag_type=tag_type)
|
105 |
+
|
106 |
+
# 6. initialize trainer
|
107 |
+
from flair.trainers import ModelTrainer
|
108 |
+
|
109 |
+
trainer = ModelTrainer(tagger, corpus)
|
110 |
+
|
111 |
+
# 7. run training
|
112 |
+
trainer.train('resources/taggers/frame-english',
|
113 |
+
train_with_dev=True,
|
114 |
+
max_epochs=150)
|
115 |
+
```
|
116 |
+
|
117 |
+
|
118 |
+
|
119 |
+
---
|
120 |
+
|
121 |
+
### Cite
|
122 |
+
|
123 |
+
Please cite the following paper when using this model.
|
124 |
+
|
125 |
+
```
|
126 |
+
@inproceedings{akbik2019flair,
|
127 |
+
title={FLAIR: An easy-to-use framework for state-of-the-art NLP},
|
128 |
+
author={Akbik, Alan and Bergmann, Tanja and Blythe, Duncan and Rasul, Kashif and Schweter, Stefan and Vollgraf, Roland},
|
129 |
+
booktitle={{NAACL} 2019, 2019 Conference of the North American Chapter of the Association for Computational Linguistics (Demonstrations)},
|
130 |
+
pages={54--59},
|
131 |
+
year={2019}
|
132 |
+
}
|
133 |
+
|
134 |
+
```
|
135 |
+
|
136 |
+
---
|
137 |
+
|
138 |
+
### Issues?
|
139 |
+
|
140 |
+
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 22:16:56 0 0.1000 1.0039893659218302
|
3 |
+
1 22:19:32 0 0.1000 0.7061636147521577
|
4 |
+
2 22:22:09 0 0.1000 0.5969159854133174
|
5 |
+
3 22:24:45 0 0.1000 0.5266432488077092
|
6 |
+
4 22:27:20 0 0.1000 0.4787272334942278
|
7 |
+
5 22:29:57 0 0.1000 0.4413028061221231
|
8 |
+
6 22:32:31 0 0.1000 0.4140418250718207
|
9 |
+
7 22:35:07 0 0.1000 0.38958123512706666
|
10 |
+
8 22:37:44 0 0.1000 0.3678484100721917
|
11 |
+
9 22:40:17 0 0.1000 0.35009735131601116
|
12 |
+
10 22:42:53 0 0.1000 0.33932022991607774
|
13 |
+
11 22:45:29 0 0.1000 0.3243708434419812
|
14 |
+
12 22:48:05 0 0.1000 0.31249178839742014
|
15 |
+
13 22:50:41 0 0.1000 0.30411046091678007
|
16 |
+
14 22:53:17 0 0.1000 0.29482137056735325
|
17 |
+
15 22:55:52 0 0.1000 0.2861803585853217
|
18 |
+
16 22:58:28 0 0.1000 0.2790562824398842
|
19 |
+
17 23:01:05 0 0.1000 0.2705823567116036
|
20 |
+
18 23:03:41 0 0.1000 0.26671336980923166
|
21 |
+
19 23:06:18 0 0.1000 0.2593297838124464
|
22 |
+
20 23:08:54 0 0.1000 0.25446213510520055
|
23 |
+
21 23:11:30 0 0.1000 0.24768655170809548
|
24 |
+
22 23:14:06 0 0.1000 0.24429248825559077
|
25 |
+
23 23:16:43 0 0.1000 0.24085550292482916
|
26 |
+
24 23:19:19 0 0.1000 0.23584571266792856
|
27 |
+
25 23:21:53 0 0.1000 0.23129866656829726
|
28 |
+
26 23:24:19 0 0.1000 0.22962194557741003
|
29 |
+
27 23:26:57 0 0.1000 0.22643692269921303
|
30 |
+
28 23:29:34 0 0.1000 0.22286132424226346
|
31 |
+
29 23:32:12 0 0.1000 0.22026822692661915
|
32 |
+
30 23:34:49 0 0.1000 0.21729991109866018
|
33 |
+
31 23:37:26 0 0.1000 0.2145115195748941
|
34 |
+
32 23:40:07 0 0.1000 0.2117686057807702
|
35 |
+
33 23:42:44 0 0.1000 0.20961582855795916
|
36 |
+
34 23:45:20 0 0.1000 0.20412308041920077
|
37 |
+
35 23:47:56 0 0.1000 0.20272977979678028
|
38 |
+
36 23:50:33 0 0.1000 0.2013391835748587
|
39 |
+
37 23:53:05 0 0.1000 0.19829643093190102
|
40 |
+
38 23:55:41 1 0.1000 0.19841094032211123
|
41 |
+
39 23:58:17 0 0.1000 0.19503913455695476
|
42 |
+
40 00:00:52 0 0.1000 0.19209832764880838
|
43 |
+
41 00:03:28 0 0.1000 0.19079046875519573
|
44 |
+
42 00:06:04 0 0.1000 0.18920110067387796
|
45 |
+
43 00:08:41 0 0.1000 0.18687667162069735
|
46 |
+
44 00:11:17 0 0.1000 0.18621931438879022
|
47 |
+
45 00:13:53 0 0.1000 0.18598864254383546
|
48 |
+
46 00:16:24 0 0.1000 0.18228494104349388
|
49 |
+
47 00:18:57 0 0.1000 0.18072697211267813
|
50 |
+
48 00:21:33 0 0.1000 0.1804653215984691
|
51 |
+
49 00:24:09 0 0.1000 0.17930122343999036
|
52 |
+
50 00:26:43 0 0.1000 0.17748751340609675
|
53 |
+
51 00:29:19 0 0.1000 0.1752133839085417
|
54 |
+
52 00:31:55 1 0.1000 0.17594264423509814
|
55 |
+
53 00:34:31 0 0.1000 0.17262986932723026
|
56 |
+
54 00:37:03 0 0.1000 0.17199531916318075
|
57 |
+
55 00:39:34 0 0.1000 0.1710775262061155
|
58 |
+
56 00:42:11 0 0.1000 0.16777184028670472
|
59 |
+
57 00:44:47 1 0.1000 0.1685719361957514
|
60 |
+
58 00:47:23 0 0.1000 0.16631305848090153
|
61 |
+
59 00:50:00 0 0.1000 0.1660435242725993
|
62 |
+
60 00:52:37 0 0.1000 0.1637892189354829
|
63 |
+
61 00:55:13 1 0.1000 0.16440932420486548
|
64 |
+
62 00:57:49 0 0.1000 0.16141063866609673
|
65 |
+
63 01:00:25 1 0.1000 0.16214315994871112
|
66 |
+
64 01:03:01 0 0.1000 0.15980435563848827
|
67 |
+
65 01:05:37 1 0.1000 0.1604709279059239
|
68 |
+
66 01:08:14 0 0.1000 0.15847808923361437
|
69 |
+
67 01:10:50 0 0.1000 0.157500858904337
|
70 |
+
68 01:13:26 0 0.1000 0.15638931530826497
|
71 |
+
69 01:16:03 0 0.1000 0.1555610438323808
|
72 |
+
70 01:18:39 0 0.1000 0.1532352480587532
|
73 |
+
71 01:21:15 1 0.1000 0.15329415766416857
|
74 |
+
72 01:23:47 2 0.1000 0.1536654862269478
|
75 |
+
73 01:26:24 0 0.1000 0.1525104184111334
|
76 |
+
74 01:29:00 0 0.1000 0.15176699819148712
|
77 |
+
75 01:31:35 0 0.1000 0.15075179436999672
|
78 |
+
76 01:34:11 0 0.1000 0.14847835810960464
|
79 |
+
77 01:36:48 1 0.1000 0.14985399553517126
|
80 |
+
78 01:39:25 0 0.1000 0.14741164753740688
|
81 |
+
79 01:42:01 1 0.1000 0.14828819069519358
|
82 |
+
80 01:44:37 0 0.1000 0.1462389815936111
|
83 |
+
81 01:47:13 1 0.1000 0.14666952050378862
|
84 |
+
82 01:49:49 2 0.1000 0.1462645870208178
|
85 |
+
83 01:52:26 0 0.1000 0.14490419472866464
|
86 |
+
84 01:55:02 1 0.1000 0.1463355064799763
|
87 |
+
85 01:57:38 0 0.1000 0.1448573852583485
|
88 |
+
86 02:00:11 0 0.1000 0.14278261882094842
|
89 |
+
87 02:02:46 1 0.1000 0.1432769181270082
|
90 |
+
88 02:05:23 0 0.1000 0.14183188567605784
|
91 |
+
89 02:07:56 0 0.1000 0.14052370639201606
|
92 |
+
90 02:10:32 1 0.1000 0.14088499827486164
|
93 |
+
91 02:13:08 0 0.1000 0.1392386663128745
|
94 |
+
92 02:15:44 1 0.1000 0.13959584156859595
|
95 |
+
93 02:18:21 0 0.1000 0.13846903681333336
|
96 |
+
94 02:20:57 1 0.1000 0.13860615584929034
|
97 |
+
95 02:23:33 0 0.1000 0.13762011011113537
|
98 |
+
96 02:26:09 0 0.1000 0.13614174911436044
|
99 |
+
97 02:28:45 1 0.1000 0.13641496248121532
|
100 |
+
98 02:31:22 0 0.1000 0.13551912194855933
|
101 |
+
99 02:33:57 1 0.1000 0.13605132245230225
|
102 |
+
100 02:36:34 0 0.1000 0.13385561471277813
|
103 |
+
101 02:39:10 1 0.1000 0.13484313386931734
|
104 |
+
102 02:41:46 0 0.1000 0.13224975113036497
|
105 |
+
103 02:44:22 1 0.1000 0.13391570887827087
|
106 |
+
104 02:46:59 0 0.1000 0.13182711181002404
|
107 |
+
105 02:49:35 1 0.1000 0.13251979998822483
|
108 |
+
106 02:52:12 2 0.1000 0.13202438766523353
|
109 |
+
107 02:54:48 0 0.1000 0.13128281369805336
|
110 |
+
108 02:57:24 0 0.1000 0.12939676740540648
|
111 |
+
109 03:00:00 1 0.1000 0.12954153502113977
|
112 |
+
110 03:02:36 2 0.1000 0.13075922897964154
|
113 |
+
111 03:05:13 3 0.1000 0.13048652087320697
|
114 |
+
112 03:07:49 0 0.1000 0.12890468911812553
|
115 |
+
113 03:10:25 1 0.1000 0.12892177955019024
|
116 |
+
114 03:13:01 0 0.1000 0.128635391510039
|
117 |
+
115 03:15:36 0 0.1000 0.12629613022478123
|
118 |
+
116 03:18:12 1 0.1000 0.12783387429590495
|
119 |
+
117 03:20:49 2 0.1000 0.12665061510255876
|
120 |
+
118 03:23:19 3 0.1000 0.1267600216526749
|
121 |
+
119 03:25:55 0 0.1000 0.12617559208200788
|
122 |
+
120 03:28:32 0 0.1000 0.12521145474798273
|
123 |
+
121 03:31:08 0 0.1000 0.12497721069053097
|
124 |
+
122 03:33:44 1 0.1000 0.12529846722646704
|
125 |
+
123 03:36:20 0 0.1000 0.1248895901722728
|
126 |
+
124 03:38:57 0 0.1000 0.12346008466170082
|
127 |
+
125 03:41:33 1 0.1000 0.1235640672074174
|
128 |
+
126 03:44:10 0 0.1000 0.12268940063369162
|
129 |
+
127 03:46:46 0 0.1000 0.12130651440822854
|
130 |
+
128 03:49:22 1 0.1000 0.12257342219774453
|
131 |
+
129 03:51:58 2 0.1000 0.12226920841086024
|
132 |
+
130 03:54:35 3 0.1000 0.12219730263821921
|
133 |
+
131 03:57:11 4 0.1000 0.12310085796030625
|
134 |
+
132 03:59:42 0 0.0500 0.12108087065506656
|
135 |
+
133 04:02:18 0 0.0500 0.11954833609737316
|
136 |
+
134 04:04:55 1 0.0500 0.11963284577120026
|
137 |
+
135 04:07:31 0 0.0500 0.11788792767192957
|
138 |
+
136 04:10:07 1 0.0500 0.11916132699417056
|
139 |
+
137 04:12:43 2 0.0500 0.11934914865372878
|
140 |
+
138 04:15:16 0 0.0500 0.11769732458130369
|
141 |
+
139 04:17:49 0 0.0500 0.11766204663464483
|
142 |
+
140 04:20:25 0 0.0500 0.11757042552291784
|
143 |
+
141 04:23:01 0 0.0500 0.11738244868252637
|
144 |
+
142 04:25:37 0 0.0500 0.11603592486454631
|
145 |
+
143 04:28:14 0 0.0500 0.11534709937167617
|
146 |
+
144 04:30:50 1 0.0500 0.11650450829627379
|
147 |
+
145 04:33:26 2 0.0500 0.11535481170803871
|
148 |
+
146 04:36:02 3 0.0500 0.11545257576934571
|
149 |
+
147 04:38:38 0 0.0500 0.1152307657166472
|
150 |
+
148 04:41:13 1 0.0500 0.11627023742165206
|
151 |
+
149 04:43:46 0 0.0500 0.1151900436061452
|
pytorch_model.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:cd17c26020bd000092df4319d51962ab2e74d15e3bb43205271fd143ef36cfbc
|
3 |
+
size 290521503
|
training.log
ADDED
The diff for this file is too large to render.
See raw diff
|
|