alanakbik commited on
Commit
09f1678
1 Parent(s): dfbfe88

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +9 -12
README.md CHANGED
@@ -59,17 +59,14 @@ Span [5]: "Washington" [− Labels: LOC (0.9994)]
59
  ```
60
 
61
 
62
- ### Script to train this model
63
 
64
  The following Flair script was used to train this model:
65
 
66
  ```python
67
- from flair import set_seed
68
  from flair.data import Corpus
69
  from flair.datasets import CONLL_03
70
- from flair.embeddings import TokenEmbeddings, WordEmbeddings, StackedEmbeddings, FlairEmbeddings
71
- from typing import List
72
-
73
 
74
  # 1. get the corpus
75
  corpus: Corpus = CONLL_03()
@@ -80,8 +77,8 @@ tag_type = 'ner'
80
  # 3. make the tag dictionary from the corpus
81
  tag_dictionary = corpus.make_tag_dictionary(tag_type=tag_type)
82
 
83
- # 4. initialize embeddings
84
- embedding_types: List[TokenEmbeddings] = [
85
 
86
  # GloVe embeddings
87
  WordEmbeddings('glove'),
@@ -99,15 +96,15 @@ embeddings = StackedEmbeddings(embeddings=embedding_types)
99
  # 5. initialize sequence tagger
100
  from flair.models import SequenceTagger
101
 
102
- tagger: SequenceTagger = SequenceTagger(hidden_size=256,
103
- embeddings=embeddings,
104
- tag_dictionary=tag_dictionary,
105
- tag_type=tag_type)
106
 
107
  # 6. initialize trainer
108
  from flair.trainers import ModelTrainer
109
 
110
- trainer: ModelTrainer = ModelTrainer(tagger, corpus)
111
 
112
  # 7. run training
113
  trainer.train('resources/taggers/ner-english',
 
59
  ```
60
 
61
 
62
+ ### Training: Script to train this model
63
 
64
  The following Flair script was used to train this model:
65
 
66
  ```python
 
67
  from flair.data import Corpus
68
  from flair.datasets import CONLL_03
69
+ from flair.embeddings import WordEmbeddings, StackedEmbeddings, FlairEmbeddings
 
 
70
 
71
  # 1. get the corpus
72
  corpus: Corpus = CONLL_03()
 
77
  # 3. make the tag dictionary from the corpus
78
  tag_dictionary = corpus.make_tag_dictionary(tag_type=tag_type)
79
 
80
+ # 4. initialize each embedding we use
81
+ embedding_types = [
82
 
83
  # GloVe embeddings
84
  WordEmbeddings('glove'),
 
96
  # 5. initialize sequence tagger
97
  from flair.models import SequenceTagger
98
 
99
+ tagger = SequenceTagger(hidden_size=256,
100
+ embeddings=embeddings,
101
+ tag_dictionary=tag_dictionary,
102
+ tag_type=tag_type)
103
 
104
  # 6. initialize trainer
105
  from flair.trainers import ModelTrainer
106
 
107
+ trainer = ModelTrainer(tagger, corpus)
108
 
109
  # 7. run training
110
  trainer.train('resources/taggers/ner-english',