Added basic model class for LSTMs and config file for basic classifier

isaac
Pavan Mandava 6 years ago
parent 9f9a271bc0
commit 931c99602d

@ -0,0 +1,11 @@
from typing import Dict
import torch
from allennlp.models import Model
@Model.register("basic_bilstm_classifier")
class BiLstmClassifier(Model):
def forward(self, *inputs) -> Dict[str, torch.Tensor]:
pass

@ -0,0 +1,30 @@
{
"dataset_reader": {
"type": "citation_dataset_reader"
},
"train_data_path": "data/jsonl/train.jsonl",
"validation_data_path": "data/jsonl/test.jsonl",
"test_data_path": "data/jsonl/test.jsonl",
"model": {
"type": "basic_bilstm_classifier",
"elmo_text_field_embedder": {
"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
},
"elmo": {
"type": "elmo_token_embedder",
"options_file": "https://s3-us-west-2.amazonaws.com/allennlp/models/elmo/2x4096_512_2048cnn_2xhighway_5.5B/elmo_2x4096_512_2048cnn_2xhighway_5.5B_options.json",
"weight_file": "https://s3-us-west-2.amazonaws.com/allennlp/models/elmo/2x4096_512_2048cnn_2xhighway_5.5B/elmo_2x4096_512_2048cnn_2xhighway_5.5B_weights.hdf5",
"do_layer_norm": true,
"dropout": 0.5
}
}
},
"trainer": {
"optimizer": "adam",
"num_epochs": 10
}
}

@ -11,6 +11,7 @@ from allennlp.data.token_indexers import SingleIdTokenIndexer, ELMoTokenCharacte
import utils.constants as const import utils.constants as const
@DatasetReader.register("citation_dataset_reader") # type for config files
class CitationDataSetReader(DatasetReader): class CitationDataSetReader(DatasetReader):
def __init__(self): def __init__(self):
super().__init__() super().__init__()

Loading…
Cancel
Save