{ | |
"dataset_reader": { | |
"type": "squad", | |
"token_indexers": { | |
"elmo": { | |
"type": "elmo_characters" | |
}, | |
"token_characters": { | |
"type": "characters", | |
"character_tokenizer": { | |
"byte_encoding": "utf-8", | |
"end_tokens": [ | |
260 | |
], | |
"start_tokens": [ | |
259 | |
] | |
}, | |
"min_padding_length": 5 | |
}, | |
"tokens": { | |
"type": "single_id", | |
"lowercase_tokens": true | |
} | |
} | |
}, | |
"model": { | |
"type": "bidaf", | |
"dropout": 0.2, | |
"matrix_attention": { | |
"type": "linear", | |
"combination": "x,y,x*y", | |
"tensor_1_dim": 200, | |
"tensor_2_dim": 200 | |
}, | |
"modeling_layer": { | |
"type": "lstm", | |
"bidirectional": true, | |
"dropout": 0.2, | |
"hidden_size": 100, | |
"input_size": 800, | |
"num_layers": 2 | |
}, | |
"num_highway_layers": 2, | |
"phrase_layer": { | |
"type": "lstm", | |
"bidirectional": true, | |
"hidden_size": 100, | |
"input_size": 1224, | |
"num_layers": 1 | |
}, | |
"span_end_encoder": { | |
"type": "lstm", | |
"bidirectional": true, | |
"hidden_size": 100, | |
"input_size": 1400, | |
"num_layers": 1 | |
}, | |
"text_field_embedder": { | |
"token_embedders": { | |
"elmo": { | |
"type": "elmo_token_embedder", | |
"do_layer_norm": false, | |
"dropout": 0, | |
"options_file": "hf://lysandre/elmo-2x4096_512_2048cnn_2xhighway/options.json", | |
"weight_file": "hf://lysandre/elmo-2x4096_512_2048cnn_2xhighway/weights.hdf5" | |
}, | |
"token_characters": { | |
"type": "character_encoding", | |
"dropout": 0.2, | |
"embedding": { | |
"embedding_dim": 16, | |
"num_embeddings": 262 | |
}, | |
"encoder": { | |
"type": "cnn", | |
"embedding_dim": 16, | |
"ngram_filter_sizes": [ | |
5 | |
], | |
"num_filters": 100 | |
} | |
}, | |
"tokens": { | |
"type": "embedding", | |
"embedding_dim": 100, | |
"pretrained_file": "https://allennlp.s3.amazonaws.com/datasets/glove/glove.6B.100d.txt.gz", | |
"trainable": false | |
} | |
} | |
} | |
}, | |
"train_data_path": "https://allennlp.s3.amazonaws.com/datasets/squad/squad-train-v1.1.json", | |
"validation_data_path": "https://allennlp.s3.amazonaws.com/datasets/squad/squad-dev-v1.1.json", | |
"trainer": { | |
"cuda_device": 0, | |
"grad_norm": 5, | |
"learning_rate_scheduler": { | |
"type": "reduce_on_plateau", | |
"factor": 0.5, | |
"mode": "max", | |
"patience": 2 | |
}, | |
"num_epochs": 20, | |
"optimizer": { | |
"type": "adam", | |
"betas": [ | |
0.9, | |
0.9 | |
] | |
}, | |
"patience": 10, | |
"validation_metric": "+em" | |
}, | |
"data_loader": { | |
"batch_sampler": { | |
"type": "bucket", | |
"batch_size": 40 | |
} | |
} | |
} | |