-
Notifications
You must be signed in to change notification settings - Fork 148
/
Copy pathbidaf.jsonnet
116 lines (115 loc) · 3.28 KB
/
bidaf.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Configuration for the a machine comprehension model based on:
// Seo, Min Joon et al. “Bidirectional Attention Flow for Machine Comprehension.”
// ArXiv/1611.01603 (2016)
{
"dataset_reader": {
"type": "squad",
"token_indexers": {
"tokens": {
"type": "single_id",
"lowercase_tokens": true
},
"token_characters": {
"type": "characters",
"character_tokenizer": {
"byte_encoding": "utf-8",
"start_tokens": [259],
"end_tokens": [260]
}
},
"elmo": {
"type": "elmo_characters"
}
}
},
"train_data_path": "https://s3-us-west-2.amazonaws.com/allennlp/datasets/squad/squad-train-v1.1.json",
"validation_data_path": "https://s3-us-west-2.amazonaws.com/allennlp/datasets/squad/squad-dev-v1.1.json",
"model": {
"type": "bidaf",
"text_field_embedder": {
"token_embedders": {
"tokens": {
"type": "embedding",
"pretrained_file": "https://s3-us-west-2.amazonaws.com/allennlp/datasets/glove/glove.6B.100d.txt.gz",
"embedding_dim": 100,
"trainable": false
},
"token_characters": {
"type": "character_encoding",
"embedding": {
"num_embeddings": 262,
"embedding_dim": 16
},
"encoder": {
"type": "cnn",
"embedding_dim": 16,
"num_filters": 100,
"ngram_filter_sizes": [5]
},
"dropout": 0.2
},
"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.5
}
}
},
"num_highway_layers": 2,
"phrase_layer": {
"type": "lstm",
"bidirectional": true,
"input_size": 1224,
"hidden_size": 100,
"num_layers": 1,
"dropout": 0.2
},
"similarity_function": {
"type": "linear",
"combination": "x,y,x*y",
"tensor_1_dim": 200,
"tensor_2_dim": 200
},
"modeling_layer": {
"type": "lstm",
"bidirectional": true,
"input_size": 800,
"hidden_size": 100,
"num_layers": 2,
"dropout": 0.2
},
"span_end_encoder": {
"type": "lstm",
"bidirectional": true,
"input_size": 1400,
"hidden_size": 100,
"num_layers": 1,
"dropout": 0.2
},
"dropout": 0.2
},
"iterator": {
"type": "bucket",
"sorting_keys": [["passage", "num_tokens"], ["question", "num_tokens"]],
"batch_size": 40
},
"trainer": {
"num_epochs": 20,
"grad_norm": 5.0,
"patience": 10,
"validation_metric": "+em",
"cuda_device": 0,
"learning_rate_scheduler": {
"type": "reduce_on_plateau",
"factor": 0.5,
"mode": "max",
"patience": 2
},
"optimizer": {
"type": "adam",
"betas": [0.9, 0.9]
}
}
}