olgen julien-c HF staff commited on
Commit
d876181
0 Parent(s):

Duplicate from flair/ner-german

Browse files

Co-authored-by: Julien Chaumond <julien-c@users.noreply.huggingface.co>

Files changed (6) hide show
  1. .gitattributes +8 -0
  2. README.md +146 -0
  3. loss.tsv +130 -0
  4. pytorch_model.bin +3 -0
  5. test.tsv +0 -0
  6. training.log +0 -0
.gitattributes ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
2
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.h5 filter=lfs diff=lfs merge=lfs -text
5
+ *.tflite filter=lfs diff=lfs merge=lfs -text
6
+ *.tar.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.ot filter=lfs diff=lfs merge=lfs -text
8
+ *.onnx filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,146 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - flair
4
+ - token-classification
5
+ - sequence-tagger-model
6
+ language: de
7
+ datasets:
8
+ - conll2003
9
+ widget:
10
+ - text: "George Washington ging nach Washington"
11
+ ---
12
+
13
+ ## German NER in Flair (default model)
14
+
15
+ This is the standard 4-class NER model for German that ships with [Flair](https://github.com/flairNLP/flair/).
16
+
17
+ F1-Score: **87,94** (CoNLL-03 German revised)
18
+
19
+ Predicts 4 tags:
20
+
21
+ | **tag** | **meaning** |
22
+ |---------------------------------|-----------|
23
+ | PER | person name |
24
+ | LOC | location name |
25
+ | ORG | organization name |
26
+ | MISC | other name |
27
+
28
+ Based on [Flair embeddings](https://www.aclweb.org/anthology/C18-1139/) and LSTM-CRF.
29
+
30
+ ---
31
+
32
+ ### Demo: How to use in Flair
33
+
34
+ Requires: **[Flair](https://github.com/flairNLP/flair/)** (`pip install flair`)
35
+
36
+ ```python
37
+ from flair.data import Sentence
38
+ from flair.models import SequenceTagger
39
+
40
+ # load tagger
41
+ tagger = SequenceTagger.load("flair/ner-german")
42
+
43
+ # make example sentence
44
+ sentence = Sentence("George Washington ging nach Washington")
45
+
46
+ # predict NER tags
47
+ tagger.predict(sentence)
48
+
49
+ # print sentence
50
+ print(sentence)
51
+
52
+ # print predicted NER spans
53
+ print('The following NER tags are found:')
54
+ # iterate over entities and print
55
+ for entity in sentence.get_spans('ner'):
56
+ print(entity)
57
+
58
+ ```
59
+
60
+ This yields the following output:
61
+ ```
62
+ Span [1,2]: "George Washington" [− Labels: PER (0.9977)]
63
+ Span [5]: "Washington" [− Labels: LOC (0.9895)]
64
+ ```
65
+
66
+ So, the entities "*George Washington*" (labeled as a **person**) and "*Washington*" (labeled as a **location**) are found in the sentence "*George Washington ging nach Washington*".
67
+
68
+
69
+ ---
70
+
71
+ ### Training: Script to train this model
72
+
73
+ The following Flair script was used to train this model:
74
+
75
+ ```python
76
+ from flair.data import Corpus
77
+ from flair.datasets import CONLL_03_GERMAN
78
+ from flair.embeddings import WordEmbeddings, StackedEmbeddings, FlairEmbeddings
79
+
80
+ # 1. get the corpus
81
+ corpus: Corpus = CONLL_03_GERMAN()
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 each embedding we use
90
+ embedding_types = [
91
+
92
+ # GloVe embeddings
93
+ WordEmbeddings('de'),
94
+
95
+ # contextual string embeddings, forward
96
+ FlairEmbeddings('de-forward'),
97
+
98
+ # contextual string embeddings, backward
99
+ FlairEmbeddings('de-backward'),
100
+ ]
101
+
102
+ # embedding stack consists of Flair and GloVe embeddings
103
+ embeddings = StackedEmbeddings(embeddings=embedding_types)
104
+
105
+ # 5. initialize sequence tagger
106
+ from flair.models import SequenceTagger
107
+
108
+ tagger = SequenceTagger(hidden_size=256,
109
+ embeddings=embeddings,
110
+ tag_dictionary=tag_dictionary,
111
+ tag_type=tag_type)
112
+
113
+ # 6. initialize trainer
114
+ from flair.trainers import ModelTrainer
115
+
116
+ trainer = ModelTrainer(tagger, corpus)
117
+
118
+ # 7. run training
119
+ trainer.train('resources/taggers/ner-german',
120
+ train_with_dev=True,
121
+ max_epochs=150)
122
+ ```
123
+
124
+
125
+
126
+ ---
127
+
128
+ ### Cite
129
+
130
+ Please cite the following paper when using this model.
131
+
132
+ ```
133
+ @inproceedings{akbik2018coling,
134
+ title={Contextual String Embeddings for Sequence Labeling},
135
+ author={Akbik, Alan and Blythe, Duncan and Vollgraf, Roland},
136
+ booktitle = {{COLING} 2018, 27th International Conference on Computational Linguistics},
137
+ pages = {1638--1649},
138
+ year = {2018}
139
+ }
140
+ ```
141
+
142
+ ---
143
+
144
+ ### Issues?
145
+
146
+ The Flair issue tracker is available [here](https://github.com/flairNLP/flair/issues/).
loss.tsv ADDED
@@ -0,0 +1,130 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ EPOCH TIMESTAMP BAD_EPOCHS LEARNING_RATE TRAIN_LOSS
2
+ 1 16:43:55 0 0.1000 0.16714021805153634
3
+ 2 16:44:30 0 0.1000 0.08062364144493428
4
+ 3 16:45:06 0 0.1000 0.06453558649239376
5
+ 4 16:45:41 0 0.1000 0.05684441862360301
6
+ 5 16:46:17 0 0.1000 0.05113178859968153
7
+ 6 16:46:52 0 0.1000 0.04722660041246348
8
+ 7 16:47:27 0 0.1000 0.044290275404877975
9
+ 8 16:48:02 0 0.1000 0.04132887578737328
10
+ 9 16:48:37 0 0.1000 0.03841102462630823
11
+ 10 16:49:13 0 0.1000 0.0369903737692544
12
+ 11 16:49:51 0 0.1000 0.03561572946051966
13
+ 12 16:50:26 0 0.1000 0.03404762323977633
14
+ 13 16:51:02 0 0.1000 0.033177074313734664
15
+ 14 16:51:37 0 0.1000 0.03190504332844356
16
+ 15 16:52:12 0 0.1000 0.030085326106881128
17
+ 16 16:52:47 0 0.1000 0.028965764653536463
18
+ 17 16:53:21 0 0.1000 0.028653883764818873
19
+ 18 16:53:56 0 0.1000 0.027480389382556564
20
+ 19 16:54:31 0 0.1000 0.02612889673796642
21
+ 20 16:55:06 0 0.1000 0.025710122299125147
22
+ 21 16:55:41 0 0.1000 0.024692159464373923
23
+ 22 16:56:16 0 0.1000 0.024283221161684913
24
+ 23 16:56:52 0 0.1000 0.023934773212015058
25
+ 24 16:57:26 0 0.1000 0.02333680020074461
26
+ 25 16:58:01 0 0.1000 0.02287939537353982
27
+ 26 16:58:35 0 0.1000 0.022274844210677887
28
+ 27 16:59:10 0 0.1000 0.02197041768108259
29
+ 28 16:59:44 0 0.1000 0.02144288421801979
30
+ 29 17:00:19 0 0.1000 0.02106162465171787
31
+ 30 17:00:54 1 0.1000 0.021360275748878936
32
+ 31 17:01:28 0 0.1000 0.019874975850589862
33
+ 32 17:02:03 0 0.1000 0.019536857728197153
34
+ 33 17:02:40 0 0.1000 0.019115562072847887
35
+ 34 17:03:15 1 0.1000 0.019216390005677673
36
+ 35 17:03:50 0 0.1000 0.018706915839335814
37
+ 36 17:04:25 0 0.1000 0.018431588821349598
38
+ 37 17:04:59 1 0.1000 0.018899753100169222
39
+ 38 17:05:33 0 0.1000 0.017661466468559095
40
+ 39 17:06:09 1 0.1000 0.018141948529376294
41
+ 40 17:06:43 0 0.1000 0.01711635609399662
42
+ 41 17:07:19 1 0.1000 0.01734413048134327
43
+ 42 17:07:54 2 0.1000 0.01758468807705332
44
+ 43 17:08:30 0 0.1000 0.016825134859833325
45
+ 44 17:09:05 0 0.1000 0.016023269298303163
46
+ 45 17:09:40 1 0.1000 0.016962951940683983
47
+ 46 17:10:15 2 0.1000 0.016876186667644302
48
+ 47 17:10:51 0 0.1000 0.015554944852515542
49
+ 48 17:11:26 1 0.1000 0.01576155647259666
50
+ 49 17:12:00 2 0.1000 0.015811000957775857
51
+ 50 17:12:35 0 0.1000 0.0153711183968699
52
+ 51 17:13:10 1 0.1000 0.015947470751778072
53
+ 52 17:13:45 0 0.1000 0.015170380193721082
54
+ 53 17:14:20 0 0.1000 0.014486768731138739
55
+ 54 17:14:58 1 0.1000 0.014932200606406461
56
+ 55 17:15:34 0 0.1000 0.014433655480233783
57
+ 56 17:16:09 1 0.1000 0.014711264406434632
58
+ 57 17:16:44 0 0.1000 0.014172153698061584
59
+ 58 17:17:20 0 0.1000 0.014112577238918646
60
+ 59 17:17:56 1 0.1000 0.01473962338135639
61
+ 60 17:18:31 0 0.1000 0.013978536329878168
62
+ 61 17:19:06 1 0.1000 0.014060741555123124
63
+ 62 17:19:42 0 0.1000 0.013879897973716759
64
+ 63 17:20:17 1 0.1000 0.014101407006138834
65
+ 64 17:20:53 0 0.1000 0.012781305202958757
66
+ 65 17:21:28 1 0.1000 0.013645179877228138
67
+ 66 17:22:03 2 0.1000 0.013889747300089917
68
+ 67 17:22:37 3 0.1000 0.013156851519296374
69
+ 68 17:23:12 4 0.1000 0.01353645288640021
70
+ 69 17:23:46 0 0.0500 0.01148547905917516
71
+ 70 17:24:21 0 0.0500 0.010945007873732773
72
+ 71 17:24:55 0 0.0500 0.010772656910264772
73
+ 72 17:25:31 1 0.0500 0.010959309841816239
74
+ 73 17:26:05 0 0.0500 0.010662426234254946
75
+ 74 17:26:39 0 0.0500 0.010209775539523751
76
+ 75 17:27:17 0 0.0500 0.009538764506529566
77
+ 76 17:27:51 1 0.0500 0.010128501167010447
78
+ 77 17:28:25 0 0.0500 0.009272778049253461
79
+ 78 17:29:00 1 0.0500 0.009608638759556051
80
+ 79 17:29:34 2 0.0500 0.009814391130961799
81
+ 80 17:30:10 3 0.0500 0.009430894880059739
82
+ 81 17:30:45 4 0.0500 0.00996502910652127
83
+ 82 17:31:19 0 0.0250 0.008840312161124382
84
+ 83 17:31:54 0 0.0250 0.00771746634277715
85
+ 84 17:32:28 1 0.0250 0.008270654785478468
86
+ 85 17:33:03 2 0.0250 0.00837524004694573
87
+ 86 17:33:38 3 0.0250 0.008437814454866108
88
+ 87 17:34:13 4 0.0250 0.007876977568363634
89
+ 88 17:34:47 1 0.0125 0.007851667418785624
90
+ 89 17:35:21 0 0.0125 0.007666708488460381
91
+ 90 17:35:55 0 0.0125 0.007482834924882973
92
+ 91 17:36:30 1 0.0125 0.007566406280149076
93
+ 92 17:37:05 0 0.0125 0.006980928176699636
94
+ 93 17:37:40 1 0.0125 0.007134038376518066
95
+ 94 17:38:15 2 0.0125 0.007297661182388887
96
+ 95 17:38:49 0 0.0125 0.00653816826332155
97
+ 96 17:39:26 1 0.0125 0.006705126310761243
98
+ 97 17:40:01 2 0.0125 0.006834550642488876
99
+ 98 17:40:35 3 0.0125 0.006686119202453218
100
+ 99 17:41:10 4 0.0125 0.007038079519515377
101
+ 100 17:41:44 1 0.0063 0.007233087513844456
102
+ 101 17:42:19 2 0.0063 0.007012748642447391
103
+ 102 17:42:53 3 0.0063 0.006878036916458598
104
+ 103 17:43:27 0 0.0063 0.006472207737265995
105
+ 104 17:44:02 1 0.0063 0.0066856462388183106
106
+ 105 17:44:36 0 0.0063 0.0058046129714833155
107
+ 106 17:45:10 1 0.0063 0.006675171319111331
108
+ 107 17:45:45 2 0.0063 0.006656363948433984
109
+ 108 17:46:19 3 0.0063 0.00609690261353901
110
+ 109 17:46:53 4 0.0063 0.006627999320560416
111
+ 110 17:47:28 1 0.0031 0.006647532153386923
112
+ 111 17:48:02 2 0.0031 0.006300284513818407
113
+ 112 17:48:36 3 0.0031 0.00620262034968587
114
+ 113 17:49:11 4 0.0031 0.006596431353326914
115
+ 114 17:49:46 1 0.0016 0.006449565780943083
116
+ 115 17:50:22 2 0.0016 0.006462379138382813
117
+ 116 17:50:56 3 0.0016 0.005973591007037035
118
+ 117 17:51:33 4 0.0016 0.006757201302850125
119
+ 118 17:52:08 1 0.0008 0.006685787562613602
120
+ 119 17:52:43 2 0.0008 0.006052485486837637
121
+ 120 17:53:17 3 0.0008 0.006076508647719862
122
+ 121 17:53:52 4 0.0008 0.006112146740257748
123
+ 122 17:54:26 1 0.0004 0.006214267314735132
124
+ 123 17:55:00 2 0.0004 0.005994278926350389
125
+ 124 17:55:35 3 0.0004 0.006510261524544725
126
+ 125 17:56:10 4 0.0004 0.006700430592123035
127
+ 126 17:56:45 1 0.0002 0.0059601953955607054
128
+ 127 17:57:20 2 0.0002 0.00591625123249424
129
+ 128 17:57:54 3 0.0002 0.006712497759923629
130
+ 129 17:58:28 4 0.0002 0.006647466202282454
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c7b858e7012dd2ba991edee27f5cd09f22cead225b1dcfc8f8d55fd73adac2a0
3
+ size 1474934456
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