1
+ // Configuration for an Elmo-augmented constituency parser based on:
2
+ // Stern, Mitchell et al. “A Minimal Span-Based Neural Constituency Parser.” ACL (2017).
3
+ {
4
+ "dataset_reader" :{
5
+ "type" :"ptb_trees" ,
6
+ "use_pos_tags" : true ,
7
+ "token_indexers" : {
8
+ "elmo" : {
9
+ "type" : "elmo_characters"
10
+ }
11
+ }
12
+ },
13
+ "train_data_path" : std.extVar('PTB_TRAIN_PATH' ),
14
+ "validation_data_path" : std.extVar('PTB_DEV_PATH' ),
15
+ "test_data_path" : std.extVar('PTB_TEST_PATH' ),
16
+ "model" : {
17
+ "type" : "constituency_parser" ,
18
+ "text_field_embedder" : {
19
+ "token_embedders" : {
20
+ "elmo" : {
21
+ "type" : "elmo_token_embedder" ,
22
+ "dropout" : 0.2 ,
23
+ "options_file" : "https://s3-us-west-2.amazonaws.com/allennlp/models/elmo/2x4096_512_2048cnn_2xhighway/elmo_2x4096_512_2048cnn_2xhighway_options.json" ,
24
+ "weight_file" : "https://s3-us-west-2.amazonaws.com/allennlp/models/elmo/2x4096_512_2048cnn_2xhighway/elmo_2x4096_512_2048cnn_2xhighway_weights.hdf5" ,
25
+ "do_layer_norm" : false
26
+ }
27
+ }
28
+ },
29
+ "pos_tag_embedding" :{
30
+ "embedding_dim" : 50 ,
31
+ "vocab_namespace" : "pos"
32
+ },
33
+ "initializer" : [
34
+ ["tag_projection_layer.*weight" , {"type" : "xavier_normal" }],
35
+ ["feedforward_layer.*weight" , {"type" : "xavier_normal" }],
36
+ ["encoder._module.weight_ih.*" , {"type" : "xavier_normal" }],
37
+ ["encoder._module.weight_hh.*" , {"type" : "orthogonal" }]
38
+ ],
39
+ "encoder" : {
40
+ "type" : "lstm" ,
41
+ "input_size" : 1074 ,
42
+ "hidden_size" : 250 ,
43
+ "num_layers" : 2 ,
44
+ "bidirectional" : true ,
45
+ "dropout" : 0.2
46
+ },
47
+ "feedforward" : {
48
+ "input_dim" : 500 ,
49
+ "num_layers" : 1 ,
50
+ "hidden_dims" : 250 ,
51
+ "activations" : "relu" ,
52
+ "dropout" : 0.1
53
+ },
54
+ "span_extractor" : {
55
+ "type" : "bidirectional_endpoint" ,
56
+ "input_dim" : 500
57
+ }
58
+ },
59
+ "iterator" : {
60
+ "type" : "bucket" ,
61
+ "sorting_keys" : [["tokens" , "num_tokens" ]],
62
+ "batch_size" : 32
63
+ },
64
+ "trainer" : {
65
+ "learning_rate_scheduler" : {
66
+ "type" : "multi_step" ,
67
+ "milestones" : [40 , 50 , 60 , 70 , 80 ],
68
+ "gamma" : 0.8
69
+ },
70
+ "num_epochs" : 150 ,
71
+ "grad_norm" : 5.0 ,
72
+ "patience" : 20 ,
73
+ "validation_metric" : "+evalb_f1_measure" ,
74
+ "cuda_device" : 0 ,
75
+ "optimizer" : {
76
+ "type" : "adadelta" ,
77
+ "lr" : 1.0 ,
78
+ "rho" : 0.95
79
+ }
80
+ }
81
+ }
0 commit comments