This repository has been archived by the owner on Dec 16, 2022. It is now read-only.
/
ner_elmo.jsonnet
101 lines (100 loc) · 2.87 KB
/
ner_elmo.jsonnet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
// Configuration for the NER model with ELMo, modified slightly from
// the version included in "Deep Contextualized Word Representations",
// (https://arxiv.org/abs/1802.05365). Compared to the version in this paper,
// this configuration replaces the original Senna word embeddings with
// 50d GloVe embeddings.
//
// There is a trained model available at https://s3-us-west-2.amazonaws.com/allennlp/models/ner-model-2018.04.30.tar.gz
// with test set F1 of 92.51 compared to the single model reported
// result of 92.22 +/- 0.10.
{
"dataset_reader": {
"type": "conll2003",
"tag_label": "ner",
"coding_scheme": "BIOUL",
"token_indexers": {
"tokens": {
"type": "single_id",
"lowercase_tokens": true
},
"token_characters": {
"type": "characters",
"min_padding_length": 3
},
"elmo": {
"type": "elmo_characters"
}
}
},
"train_data_path": std.extVar("NER_TRAIN_DATA_PATH"),
"validation_data_path": std.extVar("NER_TEST_A_PATH"),
"model": {
"type": "crf_tagger",
"label_encoding": "BIOUL",
"dropout": 0.5,
"include_start_end_transitions": false,
"text_field_embedder": {
"token_embedders": {
"tokens": {
"type": "embedding",
"embedding_dim": 50,
"pretrained_file": "https://s3-us-west-2.amazonaws.com/allennlp/datasets/glove/glove.6B.50d.txt.gz",
"trainable": true
},
"elmo":{
"type": "elmo_token_embedder",
"options_file": "https://s3-us-west-2.amazonaws.com/allennlp/models/elmo/2x4096_512_2048cnn_2xhighway/elmo_2x4096_512_2048cnn_2xhighway_options.json",
"weight_file": "https://s3-us-west-2.amazonaws.com/allennlp/models/elmo/2x4096_512_2048cnn_2xhighway/elmo_2x4096_512_2048cnn_2xhighway_weights.hdf5",
"do_layer_norm": false,
"dropout": 0.0
},
"token_characters": {
"type": "character_encoding",
"embedding": {
"embedding_dim": 16
},
"encoder": {
"type": "cnn",
"embedding_dim": 16,
"num_filters": 128,
"ngram_filter_sizes": [3],
"conv_layer_activation": "relu"
}
}
}
},
"encoder": {
"type": "lstm",
"input_size": 1202,
"hidden_size": 200,
"num_layers": 2,
"dropout": 0.5,
"bidirectional": true
},
"regularizer": [
[
"scalar_parameters",
{
"type": "l2",
"alpha": 0.1
}
]
]
},
"iterator": {
"type": "basic",
"batch_size": 64
},
"trainer": {
"optimizer": {
"type": "adam",
"lr": 0.001
},
"validation_metric": "+f1-measure-overall",
"num_serialized_models_to_keep": 3,
"num_epochs": 75,
"grad_norm": 5.0,
"patience": 25,
"cuda_device": 0
}
}