-
Notifications
You must be signed in to change notification settings - Fork 3
/
drop_parser_bert.jsonnet
140 lines (117 loc) · 3.98 KB
/
drop_parser_bert.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
local utils = import 'utils.libsonnet';
{
"dataset_reader": {
"type": std.extVar("DATASET_READER"),
"lazy": false,
"skip_instances": true,
"skip_due_to_gold_programs": true,
"convert_spananswer_to_num": true,
"question_length_limit": 50,
"pretrained_model": "bert-base-uncased",
"token_indexers": {
"tokens": {
"type": "bert-drop",
"pretrained_model": "bert-base-uncased"
}
}
},
"validation_dataset_reader": {
"type": std.extVar("DATASET_READER"),
"lazy": false,
"skip_instances": false,
"skip_due_to_gold_programs": false,
"question_length_limit": 50,
"pretrained_model": "bert-base-uncased",
"token_indexers": {
"tokens": {
"type": "bert-drop",
"pretrained_model": "bert-base-uncased"
}
}
},
"train_data_path": std.extVar("TRAINING_DATA_FILE"),
"validation_data_path": std.extVar("VAL_DATA_FILE"),
"test_data_path": std.extVar("TEST_DATA_FILE"),
"model": {
"type": "drop_parser_bert",
"pretrained_bert_model": "bert-base-uncased",
"max_ques_len": 50,
"transitionfunc_attention": {
"type": "dot_product",
"normalize": true
},
"passage_attention_to_span": {
"type": "gru",
"input_size": 4,
"hidden_size": 20,
"num_layers": 3,
"bidirectional": true,
},
"question_attention_to_span": {
"type": "gru",
"input_size": 4,
"hidden_size": 20,
"num_layers": 3,
"bidirectional": true,
},
"passage_attention_to_count": {
"type": "gru",
"input_size": 4,
"hidden_size": 20,
"num_layers": 2,
"bidirectional": true,
},
"action_embedding_dim": 100,
"beam_size": utils.parse_number(std.extVar("BEAMSIZE")),
"max_decoding_steps": utils.parse_number(std.extVar("MAX_DECODE_STEP")),
"dropout": utils.parse_number(std.extVar("DROPOUT")),
"initializers":
[
["passage_attention_to_count|passage_count_hidden2logits",
{
"type": "pretrained",
"weights_file_path": "./pattn2count_ckpt/best.th"
},
],
[".*_text_field_embedder.*", "prevent"]
],
"auxwinloss": utils.boolparser(std.extVar("AUXLOSS")),
"countfixed": utils.boolparser(std.extVar("COUNT_FIXED")),
"denotationloss": utils.boolparser(std.extVar("DENLOSS")),
"excloss": utils.boolparser(std.extVar("EXCLOSS")),
"qattloss": utils.boolparser(std.extVar("QATTLOSS")),
"mmlloss": utils.boolparser(std.extVar("MMLLOSS")),
"debug": utils.boolparser(std.extVar("DEBUG"))
},
"iterator": {
"type": "filter",
"track_epoch": true,
"batch_size": std.extVar("BS"),
// "max_instances_in_memory":
"filter_instances": utils.boolparser(std.extVar("SUPFIRST")),
"filter_for_epochs": utils.parse_number(std.extVar("SUPEPOCHS")),
},
"validation_iterator": {
"type": "basic",
"track_epoch": true,
"batch_size": std.extVar("BS")
},
"trainer": {
"num_serialized_models_to_keep": 2,
"grad_norm": 5,
"patience": 20,
"cuda_device": utils.parse_number(std.extVar("GPU")),
"num_epochs": utils.parse_number(std.extVar("EPOCHS")),
"shuffle": true,
"optimizer": {
"type": "bert_adam",
"lr": 1e-5
},
"summary_interval": 100,
"should_log_parameter_statistics": false,
"validation_metric": "+f1"
},
"random_seed": utils.parse_number(std.extVar("SEED")),
"numpy_seed": utils.parse_number(std.extVar("SEED")),
"pytorch_seed": utils.parse_number(std.extVar("SEED"))
}