// 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://allennlp.s3.amazonaws.com/models/ner-model-2018.12.18.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_DATA_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://allennlp.s3.amazonaws.com/datasets/glove/glove.6B.50d.txt.gz", "trainable": true }, "elmo":{ "type": "elmo_token_embedder", "options_file": "https://allennlp.s3.amazonaws.com/models/elmo/2x4096_512_2048cnn_2xhighway/elmo_2x4096_512_2048cnn_2xhighway_options.json", "weight_file": "https://allennlp.s3.amazonaws.com/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": { "regexes": [ [ "scalar_parameters", { "type": "l2", "alpha": 0.1 } ] ] } }, "data_loader": { "batch_size": 64 }, "trainer": { "optimizer": { "type": "adam", "lr": 0.001 }, "checkpointer": { "num_serialized_models_to_keep": 3, }, "validation_metric": "+f1-measure-overall", "num_epochs": 75, "grad_norm": 5.0, "patience": 25, } }